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
path: root/src
diff options
context:
space:
mode:
authorkaimi- <lg.kaimi+github@gmail.com>2016-10-04 21:43:50 +0300
committerkaimi- <lg.kaimi+github@gmail.com>2016-10-04 21:43:50 +0300
commit925ad75c26b3b5ab7a480aaa051312ebb3fb9fb2 (patch)
tree1af273b2cd99da30aa0f3d68136307339ef5d67b /src
parent3fc2bfce37340bc0657d2f894446e6fa183f7aea (diff)
check for album availability via mobile api. web api is not available for now
Diffstat (limited to 'src')
-rwxr-xr-xsrc/ya.pl9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/ya.pl b/src/ya.pl
index 1757aa8..2f81e5e 100755
--- a/src/ya.pl
+++ b/src/ya.pl
@@ -284,7 +284,7 @@ if($opt{album} || ($opt{playlist} && $opt{kind}))
@track_list_info = get_album_tracks_info($opt{album});
- if($opt{track})
+ if(scalar @track_list_info > 0 && $opt{track})
{
info(INFO, 'Filtering single track: ' . $opt{track} . ' [' . $opt{album} . ']');
@track_list_info = grep
@@ -431,6 +431,7 @@ sub download_track
$whole_file = '';
$total_size = $request->headers->content_length;
+
info(DEBUG, 'File size from header: ' . $total_size);
$request = $ua->get($url, ':content_cb' => \&progress);
@@ -601,6 +602,12 @@ sub get_album_tracks_info
info(INFO, 'Album title: ' . $title);
info(INFO, 'Tracks total: ' . $json->{$parent}->{trackCount});
+ if($opt{mobile} && !$json->{$parent}->{availableForMobile})
+ {
+ info(ERROR, 'Album is not available via Mobile API');
+ return;
+ }
+
my @tracks = ();
for my $vol(@{$json->{$parent}->{volumes}})
{