Skip to content

Commit

Permalink
metadata: handle empty trailer_uri for episodes
Browse files Browse the repository at this point in the history
  • Loading branch information
eladyn committed Dec 29, 2024
1 parent 2a57426 commit fdc98e3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions metadata/src/show.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<SpotifyId>,
pub has_music_and_talk: bool,
pub is_audiobook: bool,
}
Expand Down Expand Up @@ -63,7 +63,10 @@ impl TryFrom<&<Self as Metadata>::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(),
})
Expand Down

0 comments on commit fdc98e3

Please sign in to comment.