Skip to content

Commit

Permalink
Fix: format exception if release_date.year < 1900
Browse files Browse the repository at this point in the history
  • Loading branch information
xjasonlyu committed Mar 2, 2024
1 parent 9298ebe commit 8c1c230
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions MetaTube.bundle/Contents/Code/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
)

Expand All @@ -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

Expand Down

0 comments on commit 8c1c230

Please sign in to comment.