diff options
author | kaimi- <lg.kaimi+github@gmail.com> | 2016-10-04 21:43:50 +0300 |
---|---|---|
committer | kaimi- <lg.kaimi+github@gmail.com> | 2016-10-04 21:43:50 +0300 |
commit | 925ad75c26b3b5ab7a480aaa051312ebb3fb9fb2 (patch) | |
tree | 1af273b2cd99da30aa0f3d68136307339ef5d67b /src | |
parent | 3fc2bfce37340bc0657d2f894446e6fa183f7aea (diff) |
check for album availability via mobile api. web api is not available for now
Diffstat (limited to 'src')
-rwxr-xr-x | src/ya.pl | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -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}})
{
|