@@ -56,7 +56,10 @@ impl TryInto<Songs> for TidalSearchResponse {
5656 match track. try_into ( ) {
5757 Ok ( s) => res. push ( s) ,
5858 Err ( e) => {
59- error ! ( "failed to parse song in response, skipping it: {}" , e) ;
59+ error ! (
60+ "failed to parse song in response, skipping it. error log: `{}`" ,
61+ e
62+ ) ;
6063 continue ;
6164 }
6265 }
@@ -81,9 +84,12 @@ impl TryInto<Playlist> for TidalPlaylistResponse {
8184impl TryInto < Song > for TidalSongResponse {
8285 type Error = Error ;
8386 fn try_into ( self ) -> Result < Song , Self :: Error > {
87+ let Some ( album) = self . album else {
88+ return Err ( eyre ! ( "{}: missing song album data" , self . title) ) ;
89+ } ;
8490 let album = Album {
85- id : Some ( self . album . id . to_string ( ) ) ,
86- name : self . album . title ,
91+ id : Some ( album. id . to_string ( ) ) ,
92+ name : album. title ,
8793 } ;
8894 let artists = self
8995 . artists
@@ -98,7 +104,7 @@ impl TryInto<Song> for TidalSongResponse {
98104 source : MusicApiType :: Tidal ,
99105 id : self . id . to_string ( ) ,
100106 sid : None ,
101- isrc : Some ( self . isrc . to_uppercase ( ) ) ,
107+ isrc : self . isrc . map ( |i| i . to_uppercase ( ) ) ,
102108 name : self . title ,
103109 album : Some ( album) ,
104110 artists,
@@ -175,7 +181,9 @@ fn media_data_to_song(data: TidalMediaData, included: &[TidalMediaData]) -> Resu
175181 if album_rel. len ( ) != 1 {
176182 return Err ( eyre ! ( "invalid song with multiple albums" ) ) ;
177183 }
178- let album_rel = album_rel. first ( ) . unwrap ( ) ;
184+ let Some ( album_rel) = album_rel. first ( ) else {
185+ return Err ( eyre ! ( "missing song album data" ) ) ;
186+ } ;
179187 let album_data = included
180188 . iter ( )
181189 . find ( |i| i. id == album_rel. id )
@@ -217,7 +225,7 @@ fn media_data_to_song(data: TidalMediaData, included: &[TidalMediaData]) -> Resu
217225 source : MusicApiType :: Tidal ,
218226 id : data. id ,
219227 sid : None ,
220- isrc : Some ( data. attributes . isrc . ok_or_eyre ( "missing song isrc" ) ? ) ,
228+ isrc : data. attributes . isrc . map ( |i| i . to_uppercase ( ) ) ,
221229 name : data. attributes . title . ok_or_eyre ( "missing song title" ) ?,
222230 album,
223231 artists,
0 commit comments