Commit
·
0102c69
1
Parent(s):
6e5685b
0.0.2.4 V Beta fix tvdb
Browse files- LoadBalancer.py +1 -1
- tvdb.py +14 -3
LoadBalancer.py
CHANGED
@@ -19,7 +19,7 @@ download_progress = {}
|
|
19 |
|
20 |
class LoadBalancer:
|
21 |
def __init__(self, cache_dir, index_file, token, repo, polling_interval=10, max_retries=3, initial_delay=1):
|
22 |
-
self.version = "0.0.2.
|
23 |
self.instances = []
|
24 |
self.instances_health = {}
|
25 |
self.polling_interval = polling_interval
|
|
|
19 |
|
20 |
class LoadBalancer:
|
21 |
def __init__(self, cache_dir, index_file, token, repo, polling_interval=10, max_retries=3, initial_delay=1):
|
22 |
+
self.version = "0.0.2.4 V Beta"
|
23 |
self.instances = []
|
24 |
self.instances_health = {}
|
25 |
self.polling_interval = polling_interval
|
tvdb.py
CHANGED
@@ -63,14 +63,25 @@ def fetch_and_cache_json(original_title, title, media_type, year=None):
|
|
63 |
data = response.json()
|
64 |
|
65 |
if 'data' in data and data['data']:
|
66 |
-
# Extract the TVDB ID from the first result
|
67 |
-
|
|
|
|
|
|
|
68 |
if not tvdb_id:
|
69 |
print("TVDB ID not found in the search results")
|
70 |
return
|
71 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
# Request the extended information using the TVDB ID
|
73 |
-
extended_url = f"{THETVDB_API_URL}/movies/{tvdb_id}/extended?meta=translations"
|
74 |
response = requests.get(extended_url, headers=headers, proxies=proxies)
|
75 |
response.raise_for_status()
|
76 |
extended_data = response.json()
|
|
|
63 |
data = response.json()
|
64 |
|
65 |
if 'data' in data and data['data']:
|
66 |
+
# Extract the TVDB ID and type from the first result
|
67 |
+
first_result = data['data'][0]
|
68 |
+
tvdb_id = first_result.get('tvdb_id')
|
69 |
+
media_type = first_result.get('type')
|
70 |
+
|
71 |
if not tvdb_id:
|
72 |
print("TVDB ID not found in the search results")
|
73 |
return
|
74 |
|
75 |
+
# Determine the correct extended URL based on media type
|
76 |
+
if media_type == 'movie':
|
77 |
+
extended_url = f"{THETVDB_API_URL}/movies/{tvdb_id}/extended?meta=translations"
|
78 |
+
elif media_type == 'series':
|
79 |
+
extended_url = f"{THETVDB_API_URL}/series/{tvdb_id}/extended?meta=translations"
|
80 |
+
else:
|
81 |
+
print(f"Unsupported media type: {media_type}")
|
82 |
+
return
|
83 |
+
|
84 |
# Request the extended information using the TVDB ID
|
|
|
85 |
response = requests.get(extended_url, headers=headers, proxies=proxies)
|
86 |
response.raise_for_status()
|
87 |
extended_data = response.json()
|