Spaces:
Paused
Paused
Commit
·
cf01f88
1
Parent(s):
c67e373
fix
Browse files
app.py
CHANGED
@@ -2,7 +2,7 @@ from flask import Flask, jsonify, request, send_from_directory
|
|
2 |
from flask_cors import CORS
|
3 |
import os
|
4 |
import json
|
5 |
-
import
|
6 |
import urllib.parse
|
7 |
from Instance import Instance
|
8 |
|
@@ -50,7 +50,7 @@ def get_movie_api():
|
|
50 |
|
51 |
# Start the download in a separate thread if not already downloading
|
52 |
if film_id not in instance.download_threads or not instance.download_threads[film_id].is_alive():
|
53 |
-
thread =
|
54 |
instance.download_threads[film_id] = thread
|
55 |
thread.start()
|
56 |
|
@@ -105,7 +105,7 @@ def get_tv_show_api():
|
|
105 |
|
106 |
# Start the download in a separate thread if not already downloading
|
107 |
if episode_id not in instance.download_threads or not instance.download_threads[episode_id].is_alive():
|
108 |
-
thread =
|
109 |
instance.download_threads[episode_id] = thread
|
110 |
thread.start()
|
111 |
|
@@ -204,7 +204,7 @@ def get_tv_metadata_api():
|
|
204 |
data = json.load(f)
|
205 |
|
206 |
# Add the file structure to the metadata
|
207 |
-
tv_structure_data = instance.get_tv_structure(
|
208 |
if tv_structure_data:
|
209 |
data['file_structure'] = tv_structure_data
|
210 |
|
@@ -215,11 +215,11 @@ def get_tv_metadata_api():
|
|
215 |
|
216 |
@app.route("/api/film/all")
|
217 |
def get_all_films_api():
|
218 |
-
return instance.get_all_films(
|
219 |
|
220 |
@app.route("/api/tv/all")
|
221 |
def get_all_tvshows_api():
|
222 |
-
return instance.get_all_tv_shows(
|
223 |
|
224 |
|
225 |
# Routes
|
|
|
2 |
from flask_cors import CORS
|
3 |
import os
|
4 |
import json
|
5 |
+
from threading import Thread
|
6 |
import urllib.parse
|
7 |
from Instance import Instance
|
8 |
|
|
|
50 |
|
51 |
# Start the download in a separate thread if not already downloading
|
52 |
if film_id not in instance.download_threads or not instance.download_threads[film_id].is_alive():
|
53 |
+
thread = Thread(target=instance.download_film, args=(file_url, TOKEN, cache_path, proxies, film_id, title))
|
54 |
instance.download_threads[film_id] = thread
|
55 |
thread.start()
|
56 |
|
|
|
105 |
|
106 |
# Start the download in a separate thread if not already downloading
|
107 |
if episode_id not in instance.download_threads or not instance.download_threads[episode_id].is_alive():
|
108 |
+
thread = Thread(target=instance.download_episode, args=(file_url, TOKEN, cache_path, proxies, episode_id, title))
|
109 |
instance.download_threads[episode_id] = thread
|
110 |
thread.start()
|
111 |
|
|
|
204 |
data = json.load(f)
|
205 |
|
206 |
# Add the file structure to the metadata
|
207 |
+
tv_structure_data = instance.get_tv_structure(title)
|
208 |
if tv_structure_data:
|
209 |
data['file_structure'] = tv_structure_data
|
210 |
|
|
|
215 |
|
216 |
@app.route("/api/film/all")
|
217 |
def get_all_films_api():
|
218 |
+
return instance.get_all_films()
|
219 |
|
220 |
@app.route("/api/tv/all")
|
221 |
def get_all_tvshows_api():
|
222 |
+
return instance.get_all_tv_shows()
|
223 |
|
224 |
|
225 |
# Routes
|