updates: web scan
Local Docker Build (Dev) / build-dev (push) Successful in 5s

This commit is contained in:
2025-10-26 13:16:05 -04:00
parent 63ab35b24c
commit a68f7ee4bb
2 changed files with 105 additions and 76 deletions
+65 -37
View File
@@ -2317,14 +2317,42 @@ def register_routes(app, dependencies: dict):
for episode in episodes:
# Build NFO path using series path
series_name = os.path.basename(episode["series_path"])
nfo_path = os.path.join(
episode["series_path"],
f"Season {episode['season']:02d}",
f"S{episode['season']:02d}E{episode['episode']:02d}.nfo"
)
# Check if NFO file exists and has dateadded
if os.path.exists(nfo_path):
# Try multiple NFO file naming patterns that might exist
season_dir = os.path.join(episode["series_path"], f"Season {episode['season']:02d}")
# Handle Season 0 (Specials) naming
if episode['season'] == 0:
season_dir = os.path.join(episode["series_path"], "Specials")
nfo_patterns = [
f"S{episode['season']:02d}E{episode['episode']:02d}.nfo",
f"{series_name}-S{episode['season']:02d}E{episode['episode']:02d}*.nfo"
]
nfo_path = None
# Find the actual NFO file that exists
if os.path.exists(season_dir):
for pattern in nfo_patterns:
if '*' in pattern:
# Use glob for wildcard patterns
import glob
matches = glob.glob(os.path.join(season_dir, pattern))
if matches:
nfo_path = matches[0] # Use first match
break
else:
# Direct file check
test_path = os.path.join(season_dir, pattern)
if os.path.exists(test_path):
nfo_path = test_path
break
# Skip if no NFO file found (already checked above)
if not nfo_path:
continue
# Check if NFO file has dateadded element
try:
tree = ET.parse(nfo_path)
root = tree.getroot()
@@ -2354,19 +2382,6 @@ def register_routes(app, dependencies: dict):
"nfo_path": nfo_path,
"error": f"Parse error: {str(e)}"
})
else:
# NFO file doesn't exist at all
if episode["has_video_file"]:
missing_items["episodes"].append({
"imdb_id": episode["imdb_id"],
"season": episode["season"],
"episode": episode["episode"],
"series_name": series_name,
"series_path": episode["series_path"],
"dateadded": episode["dateadded"],
"nfo_path": nfo_path,
"reason": "NFO file does not exist"
})
# Scan movies
print("🎬 Scanning movies for missing dateadded elements")
@@ -2387,13 +2402,37 @@ def register_routes(app, dependencies: dict):
for movie in movies:
# Build NFO path using movie path
movie_title = os.path.basename(movie["path"])
nfo_path = os.path.join(
movie["path"],
f"{movie_title}.nfo"
)
# Check if NFO file exists and has dateadded
if os.path.exists(nfo_path):
# Try multiple NFO file naming patterns that might exist
nfo_patterns = [
f"{movie_title}.nfo",
"movie.nfo",
f"{movie_title}*.nfo"
]
nfo_path = None
# Find the actual NFO file that exists
if os.path.exists(movie["path"]):
for pattern in nfo_patterns:
if '*' in pattern:
# Use glob for wildcard patterns
import glob
matches = glob.glob(os.path.join(movie["path"], pattern))
if matches:
nfo_path = matches[0] # Use first match
break
else:
# Direct file check
test_path = os.path.join(movie["path"], pattern)
if os.path.exists(test_path):
nfo_path = test_path
break
# Skip if no NFO file found
if not nfo_path:
continue
# Check if NFO file has dateadded element
try:
tree = ET.parse(nfo_path)
root = tree.getroot()
@@ -2419,17 +2458,6 @@ def register_routes(app, dependencies: dict):
"nfo_path": nfo_path,
"error": f"Parse error: {str(e)}"
})
else:
# NFO file doesn't exist at all
if movie["has_video_file"]:
missing_items["movies"].append({
"imdb_id": movie["imdb_id"],
"title": movie_title,
"path": movie["path"],
"dateadded": movie["dateadded"],
"nfo_path": nfo_path,
"reason": "NFO file does not exist"
})
total_missing = len(missing_items["episodes"]) + len(missing_items["movies"])
print(f"✅ NFO repair scan complete: {total_missing} items missing dateadded elements")
+2 -1
View File
@@ -1570,9 +1570,10 @@ async def get_episodes_missing_nfo_dateadded(dependencies: dict):
"season": episode["season"],
"episode": episode["episode"],
"series_name": episode["series_name"],
"episode_name": episode["episode_name"],
"series_path": episode.get("series_path"),
"dateadded": episode["dateadded"],
"nfo_path": episode["nfo_path"],
"reason": episode.get("reason", "NFO missing dateadded element"),
"media_type": "episode",
"nfo_exists": True,
"dateadded_in_nfo": False,