Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/kaimi-io/yandex-music-download.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaimi <kaimi-@users.noreply.github.com>2020-09-02 17:36:59 +0300
committerGitHub <noreply@github.com>2020-09-02 17:36:59 +0300
commitb17cca552616c289e1e63afad6d2fb3580a4bd90 (patch)
treee1f545a212aa262978fcaf55ab34deb66008d997
parent9e1a85d49b7b3d0aaae734d46953ebd3b1ee83ab (diff)
Error handling, removed deprecated 'storageDir'
-rwxr-xr-xsrc/ya.pl21
1 files changed, 8 insertions, 13 deletions
diff --git a/src/ya.pl b/src/ya.pl
index 5cebdee..08b8341 100755
--- a/src/ya.pl
+++ b/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
@@ -713,7 +705,10 @@ sub get_album_tracks_info
{
for my $track(@{$vol})
{
- push @tracks, create_track_entry($track, 0);
+ if(!$track->{error})
+ {
+ push @tracks, create_track_entry($track, 0);
+ }
}
}
@@ -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