updates
This commit is contained in:
+16
-4
@@ -310,21 +310,33 @@ class NFOManager:
|
||||
except Exception as e:
|
||||
_log("WARNING", f"Could not write season.nfo in {season_dir}: {e}")
|
||||
|
||||
def create_tvshow_nfo(self, series_dir: Path, imdb_id: str):
|
||||
def create_tvshow_nfo(self, series_dir: Path, imdb_id: str, tvdb_id: str = None):
|
||||
"""Create tvshow.nfo if it doesn't exist"""
|
||||
tvshow_nfo = series_dir / "tvshow.nfo"
|
||||
if tvshow_nfo.exists():
|
||||
return
|
||||
|
||||
# Build uniqueid elements - prioritize TVDB for Emby compatibility
|
||||
uniqueid_elements = []
|
||||
if tvdb_id:
|
||||
uniqueid_elements.append(f' <uniqueid type="tvdb" default="true">{tvdb_id}</uniqueid>')
|
||||
if imdb_id:
|
||||
uniqueid_elements.append(f' <uniqueid type="imdb"{"" if tvdb_id else " default=\"true\"""}>{imdb_id}</uniqueid>')
|
||||
|
||||
# Fallback to IMDB if no TVDB ID available
|
||||
main_id = tvdb_id if tvdb_id else imdb_id
|
||||
|
||||
xml_content = f"""<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<tvshow>
|
||||
<id>{imdb_id}</id>
|
||||
<uniqueid type="imdb" default="true">{imdb_id}</uniqueid>
|
||||
<id>{main_id}</id>
|
||||
{chr(10).join(uniqueid_elements)}
|
||||
<!-- NFOGuard: TVDB ID required for proper Emby metadata loading -->
|
||||
<!-- If missing TVDB ID, use: Dashboard > Series > Edit Metadata > External IDs -->
|
||||
</tvshow>
|
||||
"""
|
||||
try:
|
||||
tvshow_nfo.write_text(xml_content, encoding="utf-8")
|
||||
_log("DEBUG", f"Created tvshow NFO: {tvshow_nfo}")
|
||||
_log("DEBUG", f"Created tvshow NFO: {tvshow_nfo} (TVDB: {tvdb_id}, IMDB: {imdb_id})")
|
||||
except Exception as e:
|
||||
_log("WARNING", f"Could not create tvshow.nfo in {series_dir}: {e}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user