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