Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

metadata: handle empty trailer_uri for shows #1432

Merged
merged 2 commits into from
Dec 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading