From 622c297befc68182b700cccdf6ab5dbdc939ec18 Mon Sep 17 00:00:00 2001 From: mungai-njoroge Date: Thu, 21 Dec 2023 00:23:11 +0300 Subject: [PATCH] fix: ValueError: year 0 is out of range --- app/models/album.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/models/album.py b/app/models/album.py index d5846b9..0a64a9c 100644 --- a/app/models/album.py +++ b/app/models/album.py @@ -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