From cb18c358c6487bb49705fed04840d6a2dbc18703 Mon Sep 17 00:00:00 2001 From: sbcrumb Date: Sat, 18 Oct 2025 09:27:15 -0400 Subject: [PATCH] db: more sb improvments --- VERSION | 2 +- core/nfo_manager.py | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/VERSION b/VERSION index 00355e2..bc4abe8 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.3.7 +2.3.8 diff --git a/core/nfo_manager.py b/core/nfo_manager.py index 868cd5b..462c805 100644 --- a/core/nfo_manager.py +++ b/core/nfo_manager.py @@ -699,11 +699,14 @@ class NFOManager: # Dates at the end if 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: 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 if lock_metadata: @@ -735,9 +738,15 @@ class NFOManager: except Exception as 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""" 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 if iso_timestamp.endswith('Z'): dt = datetime.fromisoformat(iso_timestamp.replace('Z', '+00:00'))