Skip to content

Commit

Permalink
metadata: handle empty trailer_uri for shows (librespot-org#1432)
Browse files Browse the repository at this point in the history
* metadata: handle empty trailer_uri for shows

* chore: update changelog
  • Loading branch information
eladyn authored Dec 30, 2024
1 parent 2a57426 commit 7003e98
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
9 changes: 7 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,12 @@ 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: 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(),
})
Expand Down

0 comments on commit 7003e98

Please sign in to comment.