From fdc98e3c818eb5236223e95948a3f02dae72bcc6 Mon Sep 17 00:00:00 2001 From: eladyn Date: Sun, 29 Dec 2024 21:26:30 +0100 Subject: [PATCH] metadata: handle empty trailer_uri for episodes --- metadata/src/show.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/metadata/src/show.rs b/metadata/src/show.rs index 62faa107d..5a917e8cd 100644 --- a/metadata/src/show.rs +++ b/metadata/src/show.rs @@ -27,7 +27,7 @@ pub struct Show { pub media_type: ShowMediaType, pub consumption_order: ShowConsumptionOrder, pub availability: Availabilities, - pub trailer_uri: SpotifyId, + pub trailer_uri: Option, pub has_music_and_talk: bool, pub is_audiobook: bool, } @@ -63,7 +63,10 @@ impl TryFrom<&::Message> for Show { media_type: show.media_type(), consumption_order: show.consumption_order(), availability: show.availability.as_slice().try_into()?, - trailer_uri: SpotifyId::from_uri(show.trailer_uri())?, + trailer_uri: Some(show.trailer_uri()) + .filter(|s| !s.is_empty()) + .map(SpotifyId::from_uri) + .transpose()?, has_music_and_talk: show.music_and_talk(), is_audiobook: show.is_audiobook(), })