Исправление ошибки скачивания треков у которых отсутствует поле 'year' (#10)

This commit is contained in:
Lev Plyusnin 2023-04-05 19:49:52 +07:00
parent 42a2440726
commit d96a288f9c
No known key found for this signature in database
GPG key ID: 21C6C2C9C0A4460D

View file

@ -62,7 +62,7 @@ class BasicAlbumInfo:
id: str
title: str
release_date: Optional[dt.datetime]
year: int
year: Optional[int]
artists: list[str]
@staticmethod
@ -75,7 +75,7 @@ class BasicAlbumInfo:
release_date = json.get('releaseDate')
if release_date is not None:
release_date = dt.datetime.fromisoformat(release_date)
return BasicAlbumInfo(id=json['id'], title=title, year=json['year'],
return BasicAlbumInfo(id=json['id'], title=title, year=json.get('year'),
artists=artists, release_date=release_date)