fix: ValueError: year 0 is out of range

This commit is contained in:
mungai-njoroge 2023-12-21 00:23:11 +03:00
parent d8bb31e4a8
commit 622c297bef

View File

@ -203,7 +203,10 @@ class Album:
return
dates = (int(t.date) for t in tracks if t.date)
self.date = datetime.datetime.fromtimestamp(min(dates)).year
try:
self.date = datetime.datetime.fromtimestamp(min(dates)).year
except ValueError:
self.date = datetime.datetime.now().year
def set_count(self, count: int):
self.count = count