web: nfo refresh debug
Local Docker Build (Dev) / build-dev (push) Successful in 5s

This commit is contained in:
2025-10-26 13:04:55 -04:00
parent d4f4bcf722
commit 6b9e0b43f8
+22 -19
View File
@@ -2300,10 +2300,11 @@ def register_routes(app, dependencies: dict):
# Scan episodes
print("📺 Scanning episodes for missing dateadded elements")
episode_query = """
SELECT DISTINCT imdb_id, season, episode, series_name, episode_name, dateadded
FROM episodes
WHERE dateadded IS NOT NULL
ORDER BY imdb_id, season, episode
SELECT DISTINCT e.imdb_id, e.season, e.episode, s.path as series_path, e.dateadded
FROM episodes e
JOIN series s ON e.imdb_id = s.imdb_id
WHERE e.dateadded IS NOT NULL
ORDER BY e.imdb_id, e.season, e.episode
"""
with db.get_connection() as conn:
@@ -2314,10 +2315,10 @@ def register_routes(app, dependencies: dict):
print(f"📊 Found {len(episodes)} episodes in database")
for episode in episodes:
# Build NFO path
# Build NFO path using series path
series_name = os.path.basename(episode["series_path"])
nfo_path = os.path.join(
config.tv_library_path,
episode["series_name"],
episode["series_path"],
f"Season {episode['season']:02d}",
f"S{episode['season']:02d}E{episode['episode']:02d}.nfo"
)
@@ -2334,8 +2335,8 @@ def register_routes(app, dependencies: dict):
"imdb_id": episode["imdb_id"],
"season": episode["season"],
"episode": episode["episode"],
"series_name": episode["series_name"],
"episode_name": episode["episode_name"],
"series_name": series_name,
"series_path": episode["series_path"],
"dateadded": episode["dateadded"],
"nfo_path": nfo_path
})
@@ -2345,8 +2346,8 @@ def register_routes(app, dependencies: dict):
"imdb_id": episode["imdb_id"],
"season": episode["season"],
"episode": episode["episode"],
"series_name": episode["series_name"],
"episode_name": episode["episode_name"],
"series_name": series_name,
"series_path": episode["series_path"],
"dateadded": episode["dateadded"],
"nfo_path": nfo_path,
"error": f"Parse error: {str(e)}"
@@ -2355,10 +2356,10 @@ def register_routes(app, dependencies: dict):
# Scan movies
print("🎬 Scanning movies for missing dateadded elements")
movie_query = """
SELECT DISTINCT imdb_id, title, dateadded
SELECT DISTINCT imdb_id, path, dateadded
FROM movies
WHERE dateadded IS NOT NULL
ORDER BY title
ORDER BY path
"""
with db.get_connection() as conn:
@@ -2369,11 +2370,11 @@ def register_routes(app, dependencies: dict):
print(f"📊 Found {len(movies)} movies in database")
for movie in movies:
# Build NFO path
# Build NFO path using movie path
movie_title = os.path.basename(movie["path"])
nfo_path = os.path.join(
config.movie_library_path,
movie["title"],
f"{movie['title']}.nfo"
movie["path"],
f"{movie_title}.nfo"
)
# Check if NFO file exists and has dateadded
@@ -2386,7 +2387,8 @@ def register_routes(app, dependencies: dict):
if dateadded_elem is None or not dateadded_elem.text:
missing_items["movies"].append({
"imdb_id": movie["imdb_id"],
"title": movie["title"],
"title": movie_title,
"path": movie["path"],
"dateadded": movie["dateadded"],
"nfo_path": nfo_path
})
@@ -2394,7 +2396,8 @@ def register_routes(app, dependencies: dict):
print(f"⚠️ Could not parse NFO file {nfo_path}: {e}")
missing_items["movies"].append({
"imdb_id": movie["imdb_id"],
"title": movie["title"],
"title": movie_title,
"path": movie["path"],
"dateadded": movie["dateadded"],
"nfo_path": nfo_path,
"error": f"Parse error: {str(e)}"