From 8c1c230314d1b235cb77d1ced1e1783bdb307883 Mon Sep 17 00:00:00 2001 From: xjasonlyu Date: Sat, 2 Mar 2024 16:09:00 -0500 Subject: [PATCH] Fix: format exception if release_date.year < 1900 --- MetaTube.bundle/Contents/Code/__init__.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/MetaTube.bundle/Contents/Code/__init__.py b/MetaTube.bundle/Contents/Code/__init__.py index 40d6ad7..512e365 100644 --- a/MetaTube.bundle/Contents/Code/__init__.py +++ b/MetaTube.bundle/Contents/Code/__init__.py @@ -204,7 +204,7 @@ def search(self, results, media, lang, manual=False): id=pid, name=pid, year=(m.release_date.year - if m.release_date.year > 1900 else None), + if m.release_date.year >= 1900 else None), score=int(100 - i), lang=lang, # user preferred language thumb=api.get_primary_image_url( @@ -232,7 +232,8 @@ def update(self, metadata, media, lang, force=False): m = api.get_movie_info(provider=pid.provider, id=pid.id) original_title = m.title - release_date = m.release_date.strftime('%Y-%m-%d') + release_date = (m.release_date.strftime('%Y-%m-%d') + if m.release_date.year >= 1900 else None) # Detect Chinese Subtitles chinese_subtitle_on = False @@ -281,7 +282,7 @@ def update(self, metadata, media, lang, force=False): director=m.director, actors=(' '.join(m.actors)), first_actor=(m.actors[0] if m.actors else ''), - year=m.release_date.year, + year=(m.release_date.year if release_date else None), date=release_date, ) @@ -305,7 +306,7 @@ def update(self, metadata, media, lang, force=False): metadata.studio = m.maker # Release Date - if m.release_date.year > 1900: + if m.release_date.year >= 1900: metadata.originally_available_at = m.release_date metadata.year = m.release_date.year