Reviewed-on: #4 Co-authored-by: SBCrumb <sbcrumb@kickthetree.com> Co-committed-by: SBCrumb <sbcrumb@kickthetree.com>
This commit is contained in:
+44
-1
@@ -683,4 +683,47 @@ class NFOManager:
|
||||
if updated_files:
|
||||
print(f"✅ Updated {len(updated_files)} video file timestamps in {movie_dir.name}")
|
||||
else:
|
||||
print(f"⚠️ No video files found to update in {movie_dir.name}")
|
||||
print(f"⚠️ No video files found to update in {movie_dir.name}")
|
||||
|
||||
def find_existing_episode_nfo(self, season_dir: Path, season_num: int, episode_num: int) -> Optional[Path]:
|
||||
"""Find existing episode NFO file that matches season/episode but isn't standardized name"""
|
||||
if not season_dir.exists():
|
||||
return None
|
||||
|
||||
# Standard filename pattern we're looking to create
|
||||
standard_pattern = f"S{season_num:02d}E{episode_num:02d}.nfo"
|
||||
|
||||
# Look for NFO files in the season directory
|
||||
for nfo_file in season_dir.glob("*.nfo"):
|
||||
# Skip if it's already the standard format
|
||||
if nfo_file.name == standard_pattern:
|
||||
continue
|
||||
|
||||
# Check if this NFO contains the right season/episode
|
||||
try:
|
||||
tree = ET.parse(nfo_file)
|
||||
root = tree.getroot()
|
||||
|
||||
if root.tag == "episodedetails":
|
||||
# Check for season/episode elements
|
||||
season_elem = root.find("season")
|
||||
episode_elem = root.find("episode")
|
||||
|
||||
if season_elem is not None and episode_elem is not None:
|
||||
try:
|
||||
file_season = int(season_elem.text)
|
||||
file_episode = int(episode_elem.text)
|
||||
|
||||
# If this NFO matches our target season/episode, return it
|
||||
if file_season == season_num and file_episode == episode_num:
|
||||
print(f"🔍 Found existing long-named NFO for S{season_num:02d}E{episode_num:02d}: {nfo_file.name}")
|
||||
return nfo_file
|
||||
except (ValueError, TypeError):
|
||||
# Skip NFO files with invalid season/episode numbers
|
||||
continue
|
||||
|
||||
except ET.ParseError:
|
||||
# Skip malformed NFO files
|
||||
continue
|
||||
|
||||
return None
|
||||
@@ -697,6 +697,7 @@ class TVProcessor:
|
||||
|
||||
return None
|
||||
|
||||
|
||||
def _get_sonarr_series_metadata(self, imdb_id: str) -> Optional[Dict[str, Any]]:
|
||||
"""Get enhanced series metadata from Sonarr API"""
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user