Karan Adhikari commited on
Fix TMDb fallback issue in case of IMDb None
Browse files
Backend/helper/metadata.py
CHANGED
|
@@ -258,7 +258,9 @@ async def fetch_tv_metadata(title, season, episode, encoded_string, year=None, q
|
|
| 258 |
use_tmdb = True
|
| 259 |
|
| 260 |
# TMDb fallback
|
| 261 |
-
|
|
|
|
|
|
|
| 262 |
if not tmdb_id:
|
| 263 |
tmdb_result = await safe_tmdb_search(title, "tv")
|
| 264 |
if not tmdb_result:
|
|
@@ -364,7 +366,9 @@ async def fetch_movie_metadata(title, encoded_string, year=None, quality=None, d
|
|
| 364 |
LOGGER.warning(f"IMDb movie fetch failed [{title}]: {e}")
|
| 365 |
use_tmdb = True
|
| 366 |
|
| 367 |
-
|
|
|
|
|
|
|
| 368 |
if not tmdb_id:
|
| 369 |
tmdb_result = await safe_tmdb_search(title, "movie", year)
|
| 370 |
if not tmdb_result:
|
|
|
|
| 258 |
use_tmdb = True
|
| 259 |
|
| 260 |
# TMDb fallback
|
| 261 |
+
must_use_tmdb = use_tmdb or tv_details is None
|
| 262 |
+
if must_use_tmdb:
|
| 263 |
+
LOGGER.info(f"No IMDb result for '{title}' switch to TMDb")
|
| 264 |
if not tmdb_id:
|
| 265 |
tmdb_result = await safe_tmdb_search(title, "tv")
|
| 266 |
if not tmdb_result:
|
|
|
|
| 366 |
LOGGER.warning(f"IMDb movie fetch failed [{title}]: {e}")
|
| 367 |
use_tmdb = True
|
| 368 |
|
| 369 |
+
must_use_tmdb = use_tmdb or movie_details is None
|
| 370 |
+
if must_use_tmdb:
|
| 371 |
+
LOGGER.info(f"No IMDb movie found for '{title}' switch to TMDb")
|
| 372 |
if not tmdb_id:
|
| 373 |
tmdb_result = await safe_tmdb_search(title, "movie", year)
|
| 374 |
if not tmdb_result:
|