Skip to content

Commit 2d4507d

Browse files
authored
fix: Playlist retrieval if list has podcasts (#1691)
* fix: Playlist retrieval if list has podcasts Fixes #1689 * fix: Gracefully handle unknown playable types
1 parent fdd05d4 commit 2d4507d

File tree

4 files changed

+33
-16
lines changed

4 files changed

+33
-16
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## Unreleased
9+
10+
### Fixed
11+
12+
- Playlist retrieval crashing when list contains podcast episodes
13+
814
## [1.3.1]
915

1016
### Fixed

Cargo.lock

Lines changed: 16 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/model/playable.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ impl From<&PlayableItem> for Playable {
144144
match item {
145145
PlayableItem::Episode(episode) => Self::Episode(episode.into()),
146146
PlayableItem::Track(track) => Self::Track(track.into()),
147+
PlayableItem::Unknown(value) => panic!("Unknown playable item {value:?}"),
147148
}
148149
}
149150
}

src/spotify_api.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,16 @@ impl WebApi {
431431
items: page
432432
.items
433433
.iter()
434+
.filter(|pt| {
435+
if let Some(t) = pt.track.as_ref()
436+
&& !t.is_unknown()
437+
{
438+
true
439+
} else {
440+
error!("Could not process item {pt:?}, ignoring");
441+
false
442+
}
443+
})
434444
.enumerate()
435445
.flat_map(|(index, pt)| {
436446
pt.track.as_ref().map(|t| {

0 commit comments

Comments
 (0)