This commit is contained in:
+12
-3
@@ -699,11 +699,14 @@ class NFOManager:
|
|||||||
# Dates at the end
|
# Dates at the end
|
||||||
if aired:
|
if aired:
|
||||||
aired_elem = ET.SubElement(episode, "aired")
|
aired_elem = ET.SubElement(episode, "aired")
|
||||||
aired_elem.text = aired[:10] if len(aired) >= 10 else aired
|
# Convert datetime objects to strings
|
||||||
|
aired_str = str(aired)
|
||||||
|
aired_elem.text = aired_str[:10] if len(aired_str) >= 10 else aired_str
|
||||||
|
|
||||||
if dateadded:
|
if dateadded:
|
||||||
dateadded_elem = ET.SubElement(episode, "dateadded")
|
dateadded_elem = ET.SubElement(episode, "dateadded")
|
||||||
dateadded_elem.text = dateadded
|
# Convert datetime objects to strings
|
||||||
|
dateadded_elem.text = str(dateadded)
|
||||||
|
|
||||||
# Add lockdata at the very end
|
# Add lockdata at the very end
|
||||||
if lock_metadata:
|
if lock_metadata:
|
||||||
@@ -735,9 +738,15 @@ class NFOManager:
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"❌ Error creating/updating episode NFO {nfo_path}: {e}")
|
print(f"❌ Error creating/updating episode NFO {nfo_path}: {e}")
|
||||||
|
|
||||||
def set_file_mtime(self, file_path: Path, iso_timestamp: str) -> None:
|
def set_file_mtime(self, file_path: Path, iso_timestamp) -> None:
|
||||||
"""Set file modification time to match import date"""
|
"""Set file modification time to match import date"""
|
||||||
try:
|
try:
|
||||||
|
# Convert datetime objects to strings first
|
||||||
|
if hasattr(iso_timestamp, 'isoformat'):
|
||||||
|
iso_timestamp = iso_timestamp.isoformat()
|
||||||
|
elif not isinstance(iso_timestamp, str):
|
||||||
|
iso_timestamp = str(iso_timestamp)
|
||||||
|
|
||||||
# Parse ISO timestamp
|
# Parse ISO timestamp
|
||||||
if iso_timestamp.endswith('Z'):
|
if iso_timestamp.endswith('Z'):
|
||||||
dt = datetime.fromisoformat(iso_timestamp.replace('Z', '+00:00'))
|
dt = datetime.fromisoformat(iso_timestamp.replace('Z', '+00:00'))
|
||||||
|
|||||||
Reference in New Issue
Block a user