This commit is contained in:
@@ -529,6 +529,43 @@ async def update_episode_date(dependencies: dict, imdb_id: str, season: int, epi
|
||||
has_video_file=episode_data.get('has_video_file', False)
|
||||
)
|
||||
|
||||
# Create/update NFO file with new data
|
||||
nfo_manager = dependencies["nfo_manager"]
|
||||
config = dependencies["config"]
|
||||
|
||||
if config.manage_nfo:
|
||||
try:
|
||||
# Find the series directory based on IMDb ID
|
||||
series_path = None
|
||||
for tv_path in config.tv_paths:
|
||||
for series_dir in Path(tv_path).iterdir():
|
||||
if series_dir.is_dir() and imdb_id.lower() in series_dir.name.lower():
|
||||
series_path = series_dir
|
||||
break
|
||||
if series_path:
|
||||
break
|
||||
|
||||
if series_path:
|
||||
season_dir = series_path / config.tv_season_dir_format.format(season=season)
|
||||
if season_dir.exists():
|
||||
nfo_manager.create_episode_nfo(
|
||||
season_dir=season_dir,
|
||||
season_num=season,
|
||||
episode_num=episode,
|
||||
aired=episode_data.get('aired'),
|
||||
dateadded=dateadded,
|
||||
source=source,
|
||||
lock_metadata=config.lock_metadata
|
||||
)
|
||||
print(f"✅ Updated NFO file for {imdb_id} S{season:02d}E{episode:02d}")
|
||||
else:
|
||||
print(f"⚠️ Season directory not found: {season_dir}")
|
||||
else:
|
||||
print(f"⚠️ Series directory not found for {imdb_id}")
|
||||
|
||||
except Exception as e:
|
||||
print(f"❌ Error updating NFO file for {imdb_id} S{season:02d}E{episode:02d}: {e}")
|
||||
|
||||
# Add to processing history
|
||||
db.add_processing_history(
|
||||
imdb_id=imdb_id,
|
||||
|
||||
Reference in New Issue
Block a user