From 7003e98c1b671755bd7b6c2f6ef1668c0223da52 Mon Sep 17 00:00:00 2001 From: eladyn <59307989+eladyn@users.noreply.github.com> Date: Mon, 30 Dec 2024 17:27:34 +0100 Subject: [PATCH] metadata: handle empty trailer_uri for shows (#1432) * metadata: handle empty trailer_uri for shows * chore: update changelog --- CHANGELOG.md | 1 + metadata/src/show.rs | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 146b6fe16..1edce464a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 client ID on Android platform. - [connect] Fix "play" command not handled if missing "offset" property - [discovery] Fix libmdns zerconf setup errors not propagating to the main task. +- [metadata] `Show::trailer_uri` is now optional since it isn't always present (breaking) ### Removed diff --git a/metadata/src/show.rs b/metadata/src/show.rs index 62faa107d..8f57b18ca 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,12 @@ 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: show + .trailer_uri + .as_deref() + .filter(|s| !s.is_empty()) + .map(SpotifyId::from_uri) + .transpose()?, has_music_and_talk: show.music_and_talk(), is_audiobook: show.is_audiobook(), })