Skip to content

Commit 7401d6a

Browse files
Don't panic on local files (#846)
Skip tracks whose Spotify ID can't be found
1 parent e27992a commit 7401d6a

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4949
- [playback] `alsa`, `gstreamer`, `pulseaudio`: always output in native endianness
5050
- [playback] `alsa`: revert buffer size to ~500 ms
5151
- [playback] `alsa`, `pipe`, `pulseaudio`: better error handling
52+
- [metadata] Skip tracks whose Spotify ID's can't be found (e.g. local files, which aren't supported)
5253

5354
## [0.2.0] - 2021-05-04
5455

metadata/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,10 +291,10 @@ impl Metadata for Playlist {
291291
.get_contents()
292292
.get_items()
293293
.iter()
294-
.map(|item| {
294+
.filter_map(|item| {
295295
let uri_split = item.get_uri().split(':');
296296
let uri_parts: Vec<&str> = uri_split.collect();
297-
SpotifyId::from_base62(uri_parts[2]).unwrap()
297+
SpotifyId::from_base62(uri_parts[2]).ok()
298298
})
299299
.collect::<Vec<_>>();
300300

0 commit comments

Comments
 (0)