This commit is contained in:
+36
-9
@@ -2268,14 +2268,28 @@ async def lookup_episode(imdb_id: str, season: int, episode: int, dependencies:
|
||||
if nfo_manager and config:
|
||||
print(f"DEBUG: Auto-fixing NFO for episode {imdb_id} S{season:02d}E{episode:02d}")
|
||||
|
||||
# Find the series directory using the same logic NFOGuard uses
|
||||
# Find the series directory using filesystem search
|
||||
from pathlib import Path
|
||||
tv_library_path = Path(config.tv_library_path)
|
||||
|
||||
# Search common TV library paths based on the logs we see from Emby
|
||||
tv_search_paths = [
|
||||
Path("/media/TV"),
|
||||
Path("/mnt/unionfs/Media/TV"),
|
||||
Path("/media/tv"),
|
||||
Path("/mnt/unionfs/Media/TV/tv"),
|
||||
Path("/mnt/unionfs/Media/TV/tv6")
|
||||
]
|
||||
|
||||
# Look for series directory with IMDb ID pattern
|
||||
import glob
|
||||
pattern = f"*[imdb-{imdb_id}]*"
|
||||
series_matches = list(tv_library_path.glob(f"**/{pattern}"))
|
||||
series_matches = []
|
||||
|
||||
for search_path in tv_search_paths:
|
||||
if search_path.exists():
|
||||
matches = list(search_path.glob(f"**/{pattern}"))
|
||||
series_matches.extend(matches)
|
||||
if matches:
|
||||
break # Use first successful search path
|
||||
|
||||
if series_matches:
|
||||
series_dir = series_matches[0] # Take first match
|
||||
@@ -2298,7 +2312,7 @@ async def lookup_episode(imdb_id: str, season: int, episode: int, dependencies:
|
||||
else:
|
||||
print(f"WARNING: Season directory not found: {season_dir}")
|
||||
else:
|
||||
print(f"WARNING: Series directory not found for {imdb_id} in {tv_library_path}")
|
||||
print(f"WARNING: Series directory not found for {imdb_id} in any search paths: {[str(p) for p in tv_search_paths]}")
|
||||
else:
|
||||
print(f"DEBUG: Auto-fix skipped - nfo_manager: {nfo_manager is not None}, config: {config is not None}")
|
||||
except Exception as fix_error:
|
||||
@@ -2368,13 +2382,26 @@ async def lookup_movie(imdb_id: str, dependencies: dict):
|
||||
if nfo_manager and config:
|
||||
print(f"DEBUG: Auto-fixing NFO for movie {imdb_id}")
|
||||
|
||||
# Find the movie directory using the same logic NFOGuard uses
|
||||
# Find the movie directory using filesystem search
|
||||
from pathlib import Path
|
||||
movie_library_path = Path(config.movie_library_path)
|
||||
|
||||
# Search common movie library paths
|
||||
movie_search_paths = [
|
||||
Path("/media/Movies"),
|
||||
Path("/mnt/unionfs/Media/Movies"),
|
||||
Path("/media/movies")
|
||||
]
|
||||
|
||||
# Look for movie directory with IMDb ID pattern
|
||||
pattern = f"*[imdb-{imdb_id}]*"
|
||||
movie_matches = list(movie_library_path.glob(f"**/{pattern}"))
|
||||
movie_matches = []
|
||||
|
||||
for search_path in movie_search_paths:
|
||||
if search_path.exists():
|
||||
matches = list(search_path.glob(f"**/{pattern}"))
|
||||
movie_matches.extend(matches)
|
||||
if matches:
|
||||
break # Use first successful search path
|
||||
|
||||
if movie_matches:
|
||||
movie_dir = movie_matches[0] # Take first match
|
||||
@@ -2394,7 +2421,7 @@ async def lookup_movie(imdb_id: str, dependencies: dict):
|
||||
else:
|
||||
print(f"WARNING: Movie directory not found: {movie_dir}")
|
||||
else:
|
||||
print(f"WARNING: Movie directory not found for {imdb_id} in {movie_library_path}")
|
||||
print(f"WARNING: Movie directory not found for {imdb_id} in any search paths: {[str(p) for p in movie_search_paths]}")
|
||||
else:
|
||||
print(f"DEBUG: Auto-fix skipped - nfo_manager: {nfo_manager is not None}, config: {config is not None}")
|
||||
except Exception as fix_error:
|
||||
|
||||
Reference in New Issue
Block a user