Spaces:
Paused
Paused
Commit
·
375b3a9
1
Parent(s):
50d4e85
0.2.3 V Alpha
Browse files- Instance.py +1 -1
- app.py +12 -23
Instance.py
CHANGED
@@ -16,7 +16,7 @@ download_progress = {}
|
|
16 |
|
17 |
class Instance:
|
18 |
def __init__(self, id, url, cache_dir, index_file, token, repo):
|
19 |
-
self.version = "0.2.
|
20 |
self.id = id
|
21 |
self.url = url
|
22 |
self.CACHE_DIR = cache_dir
|
|
|
16 |
|
17 |
class Instance:
|
18 |
def __init__(self, id, url, cache_dir, index_file, token, repo):
|
19 |
+
self.version = "0.2.3 V Alpha"
|
20 |
self.id = id
|
21 |
self.url = url
|
22 |
self.CACHE_DIR = cache_dir
|
app.py
CHANGED
@@ -21,10 +21,9 @@ instance = Instance(id=ID, url=URL, cache_dir=CACHE_DIR, index_file=INDEX_FILE,
|
|
21 |
|
22 |
# API Endpoints
|
23 |
|
24 |
-
@app.route('/api/film', methods=['GET'])
|
25 |
-
def get_movie_api():
|
26 |
"""Endpoint to get the movie by title."""
|
27 |
-
title = request.args.get('title')
|
28 |
if not title:
|
29 |
return jsonify({"error": "Title parameter is required"}), 400
|
30 |
|
@@ -56,13 +55,9 @@ def get_movie_api():
|
|
56 |
|
57 |
return jsonify({"status": "Download started", "film_id": film_id})
|
58 |
|
59 |
-
@app.route('/api/tv', methods=['GET'])
|
60 |
-
def get_tv_show_api():
|
61 |
"""Endpoint to get the TV show by title, season, and episode."""
|
62 |
-
title = request.args.get('title')
|
63 |
-
season = request.args.get('season')
|
64 |
-
episode = request.args.get('episode')
|
65 |
-
|
66 |
if not title or not season or not episode:
|
67 |
return jsonify({"error": "Title, season, and episode parameters are required"}), 400
|
68 |
|
@@ -118,21 +113,17 @@ def get_progress_api(id):
|
|
118 |
progress = instance.get_download_progress(id)
|
119 |
return jsonify({"id": id, "progress": progress})
|
120 |
|
121 |
-
@app.route('/api/filmid', methods=['GET'])
|
122 |
-
def get_film_id_by_title_api():
|
123 |
"""Endpoint to get the film ID by providing the movie title."""
|
124 |
-
title = request.args.get('title')
|
125 |
if not title:
|
126 |
return jsonify({"error": "Title parameter is required"}), 400
|
127 |
film_id = instance.get_film_id(title)
|
128 |
return jsonify({"film_id": film_id})
|
129 |
|
130 |
-
@app.route('/api/episodeid', methods=['GET'])
|
131 |
-
def get_episode_id_api():
|
132 |
"""Endpoint to get the episode ID by providing the TV show title, season, and episode."""
|
133 |
-
title = request.args.get('title')
|
134 |
-
season = request.args.get('season')
|
135 |
-
episode = request.args.get('episode')
|
136 |
if not title or not season or not episode:
|
137 |
return jsonify({"error": "Title, season, and episode parameters are required"}), 400
|
138 |
episode_id = instance.encode_episodeid(title,season,episode)
|
@@ -174,10 +165,9 @@ def get_film_store_api():
|
|
174 |
return jsonify(tv_store_data)
|
175 |
return jsonify({}), 404
|
176 |
|
177 |
-
@app.route('/api/film/metadata', methods=['GET'])
|
178 |
-
def get_film_metadata_api():
|
179 |
"""Endpoint to get the film metadata by title."""
|
180 |
-
title = request.args.get('title')
|
181 |
if not title:
|
182 |
return jsonify({'error': 'No title provided'}), 400
|
183 |
|
@@ -190,10 +180,9 @@ def get_film_metadata_api():
|
|
190 |
|
191 |
return jsonify({'error': 'Metadata not found'}), 404
|
192 |
|
193 |
-
@app.route('/api/tv/metadata', methods=['GET'])
|
194 |
-
def get_tv_metadata_api():
|
195 |
"""Endpoint to get the TV show metadata by title."""
|
196 |
-
title = request.args.get('title')
|
197 |
if not title:
|
198 |
return jsonify({'error': 'No title provided'}), 400
|
199 |
|
|
|
21 |
|
22 |
# API Endpoints
|
23 |
|
24 |
+
@app.route('/api/film/<title>', methods=['GET'])
|
25 |
+
def get_movie_api(title):
|
26 |
"""Endpoint to get the movie by title."""
|
|
|
27 |
if not title:
|
28 |
return jsonify({"error": "Title parameter is required"}), 400
|
29 |
|
|
|
55 |
|
56 |
return jsonify({"status": "Download started", "film_id": film_id})
|
57 |
|
58 |
+
@app.route('/api/tv/<title>/<season>/<episode>', methods=['GET'])
|
59 |
+
def get_tv_show_api(title, season, episode):
|
60 |
"""Endpoint to get the TV show by title, season, and episode."""
|
|
|
|
|
|
|
|
|
61 |
if not title or not season or not episode:
|
62 |
return jsonify({"error": "Title, season, and episode parameters are required"}), 400
|
63 |
|
|
|
113 |
progress = instance.get_download_progress(id)
|
114 |
return jsonify({"id": id, "progress": progress})
|
115 |
|
116 |
+
@app.route('/api/filmid/<title>', methods=['GET'])
|
117 |
+
def get_film_id_by_title_api(title):
|
118 |
"""Endpoint to get the film ID by providing the movie title."""
|
|
|
119 |
if not title:
|
120 |
return jsonify({"error": "Title parameter is required"}), 400
|
121 |
film_id = instance.get_film_id(title)
|
122 |
return jsonify({"film_id": film_id})
|
123 |
|
124 |
+
@app.route('/api/episodeid/<title>/<season>/<episode>', methods=['GET'])
|
125 |
+
def get_episode_id_api(title,season,episode):
|
126 |
"""Endpoint to get the episode ID by providing the TV show title, season, and episode."""
|
|
|
|
|
|
|
127 |
if not title or not season or not episode:
|
128 |
return jsonify({"error": "Title, season, and episode parameters are required"}), 400
|
129 |
episode_id = instance.encode_episodeid(title,season,episode)
|
|
|
165 |
return jsonify(tv_store_data)
|
166 |
return jsonify({}), 404
|
167 |
|
168 |
+
@app.route('/api/film/metadata/<title>', methods=['GET'])
|
169 |
+
def get_film_metadata_api(title):
|
170 |
"""Endpoint to get the film metadata by title."""
|
|
|
171 |
if not title:
|
172 |
return jsonify({'error': 'No title provided'}), 400
|
173 |
|
|
|
180 |
|
181 |
return jsonify({'error': 'Metadata not found'}), 404
|
182 |
|
183 |
+
@app.route('/api/tv/metadata/<title>', methods=['GET'])
|
184 |
+
def get_tv_metadata_api(title):
|
185 |
"""Endpoint to get the TV show metadata by title."""
|
|
|
186 |
if not title:
|
187 |
return jsonify({'error': 'No title provided'}), 400
|
188 |
|