Skip to content

Commit

Permalink
fix: non-uppercase isrc causes duplicate songs
Browse files Browse the repository at this point in the history
  • Loading branch information
SilentVoid13 committed Oct 13, 2024
1 parent 4eb17dc commit e19749a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/spotify/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ impl TryInto<Song> for SpotifySongResponse {
source: MusicApiType::Spotify,
id: self.id,
sid: None,
isrc: Some(self.external_ids.isrc),
isrc: Some(self.external_ids.isrc.to_uppercase()),
name: self.name,
album: Some(album),
artists,
Expand Down
5 changes: 3 additions & 2 deletions src/tidal/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,6 @@ impl MusicApi for TidalApi {
}

async fn get_playlist_songs(&self, id: &str) -> Result<Vec<Song>> {
dbg!("get_playlist_songs");
let url = format!("{}/v1/playlists/{}/items", Self::API_URL, id);
let params = json!({
"countryCode": "US",
Expand All @@ -262,7 +261,6 @@ impl MusicApi for TidalApi {
}

async fn add_songs_to_playlist(&self, playlist: &mut Playlist, songs: &[Song]) -> Result<()> {
dbg!("add_songs_to_playlist");
if songs.is_empty() {
return Ok(());
}
Expand Down Expand Up @@ -334,6 +332,9 @@ impl MusicApi for TidalApi {
if res.data.is_empty() {
return Ok(None);
}
dbg!(&res);
dbg!(&song);
todo!();
let res_song: Song = res.try_into()?;
return Ok(Some(res_song));
}
Expand Down
2 changes: 1 addition & 1 deletion src/tidal/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ impl TryInto<Song> for TidalSongResponse {
source: MusicApiType::Tidal,
id: self.id.to_string(),
sid: None,
isrc: Some(self.isrc),
isrc: Some(self.isrc.to_uppercase()),
name: self.title,
album: Some(album),
artists,
Expand Down

0 comments on commit e19749a

Please sign in to comment.