0

Error handling, removed deprecated 'storageDir'

This commit is contained in:
Kaimi
2020-09-02 17:36:59 +03:00
committed by GitHub
parent 9e1a85d49b
commit b17cca5526

View File

@@ -424,17 +424,11 @@ if($opt{album} || ($opt{playlist} && $opt{kind}))
next; next;
} }
if(!$track_info_ref->{title}) if(!$track_info_ref->{title})
{ {
info(ERROR, 'Track with non-existent title. Skipping...'); info(ERROR, 'Track with non-existent title. Skipping...');
next; next;
} }
if(!$track_info_ref->{dir})
{
info(ERROR, 'Track with non-existent path (deleted?). Skipping...');
next;
}
if($opt{link}) if($opt{link})
{ {
@@ -558,9 +552,7 @@ sub get_track_url
{ {
my $track_info_ref = shift; my $track_info_ref = shift;
my $storage_dir = $track_info_ref->{dir};
my $album_id = $track_info_ref->{album_id}; my $album_id = $track_info_ref->{album_id};
my $track_id = $track_info_ref->{track_id}; my $track_id = $track_info_ref->{track_id};
my $is_hq = ($opt{bitrate} && ($opt{bitrate} eq HQ_BITRATE)) ? 1 : 0; my $is_hq = ($opt{bitrate} && ($opt{bitrate} eq HQ_BITRATE)) ? 1 : 0;
# Get track path information # Get track path information
@@ -712,10 +704,13 @@ sub get_album_tracks_info
for my $vol(@{$json->{volumes}}) for my $vol(@{$json->{volumes}})
{ {
for my $track(@{$vol}) for my $track(@{$vol})
{
if(!$track->{error})
{ {
push @tracks, create_track_entry($track, 0); push @tracks, create_track_entry($track, 0);
} }
} }
}
return @tracks; return @tracks;
} }
@@ -823,7 +818,7 @@ sub get_playlist_tracks_info
map map
{ {
create_track_entry($_, $track_number++) create_track_entry($_, $track_number++)
} @{ $json }; } grep { !$_->{error} } @{ $json };
} }
} }
else else
@@ -838,7 +833,9 @@ sub get_playlist_tracks_info
$_ $_
, $track_number++ , $track_number++
) )
} @ }
grep { !$_->{error} }
@
{ {
$opt{mobile} ? $opt{mobile} ?
$json->{result}->{tracks} $json->{result}->{tracks}
@@ -925,8 +922,6 @@ sub create_track_entry
return return
{ {
# Download path part
dir => $track_info->{storageDir},
# Album id # Album id
album_id => $track_info->{albums}->[0]->{id}, album_id => $track_info->{albums}->[0]->{id},
# Track id # Track id