From 9da03b433cedb8ac7c803ff535268a1d79864e9c Mon Sep 17 00:00:00 2001 From: Rafael Moraes <50295204+glomatico@users.noreply.github.com> Date: Mon, 9 Mar 2026 07:54:53 -0300 Subject: [PATCH] Handle missing releaseDate in interfaces --- votify/interface/episode.py | 8 ++++++-- votify/interface/song.py | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/votify/interface/episode.py b/votify/interface/episode.py index e07ff5d..af623e8 100644 --- a/votify/interface/episode.py +++ b/votify/interface/episode.py @@ -76,10 +76,14 @@ class SpotifyEpisodeInterface(SpotifyAudioInterface): show_items: list[dict], is_video: bool = False, ) -> MediaTags: + release_date = episode_data["releaseDate"] + tags = MediaTags( album=episode_data["podcastV2"]["data"]["name"], - date=SpotifyAudioInterface.parse_date( - episode_data["releaseDate"]["isoString"] + date=( + SpotifyAudioInterface.parse_date(release_date["isoString"]) + if release_date + else None ), description=episode_data.get("description"), media_id=episode_data["uri"].split(":")[-1], diff --git a/votify/interface/song.py b/votify/interface/song.py index 26635ab..d2d0e91 100644 --- a/votify/interface/song.py +++ b/votify/interface/song.py @@ -105,7 +105,7 @@ class SpotifySongInterface(SpotifyAudioInterface): album_items: list[dict], lyrics: str | None = None, ) -> MediaTags: - iso_date = album_data["date"]["isoString"] + release_date = album_data["date"] (composer, producer), (album_artist, artist, isrc, label) = ( await asyncio.gather( @@ -130,7 +130,7 @@ class SpotifySongInterface(SpotifyAudioInterface): compilation=compilation, composer=composer, copyright=copyright, - date=self.parse_date(iso_date), + date=self.parse_date(release_date["isoString"]) if release_date else None, disc=disc, disc_total=disc_total, isrc=isrc,