Don't panic on local files (#846)

Skip tracks whose Spotify ID can't be found
This commit is contained in:
Matias 2021-09-20 14:20:44 -03:00 committed by GitHub
parent e27992a754
commit 7401d6a96e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View file

@ -49,6 +49,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [playback] `alsa`, `gstreamer`, `pulseaudio`: always output in native endianness
- [playback] `alsa`: revert buffer size to ~500 ms
- [playback] `alsa`, `pipe`, `pulseaudio`: better error handling
- [metadata] Skip tracks whose Spotify ID's can't be found (e.g. local files, which aren't supported)
## [0.2.0] - 2021-05-04

View file

@ -291,10 +291,10 @@ impl Metadata for Playlist {
.get_contents()
.get_items()
.iter()
.map(|item| {
.filter_map(|item| {
let uri_split = item.get_uri().split(':');
let uri_parts: Vec<&str> = uri_split.collect();
SpotifyId::from_base62(uri_parts[2]).unwrap()
SpotifyId::from_base62(uri_parts[2]).ok()
})
.collect::<Vec<_>>();