0

Multiple volume albums and https proxy support fix

This commit is contained in:
Kaimi
2015-03-19 19:40:41 +03:00
parent aa041b612e
commit b89fc5a78c

View File

@@ -73,11 +73,11 @@ my ($opt, $usage) = Getopt::Long::Descriptive::describe_options
['kind|k:s', 'playlist kind (eg. ya-playlist, music-blog, music-partners, etc.)'], ['kind|k:s', 'playlist kind (eg. ya-playlist, music-blog, music-partners, etc.)'],
['album|a:i', 'album to download'], ['album|a:i', 'album to download'],
['track|t:i', 'track to download (album id must be specified)'], ['track|t:i', 'track to download (album id must be specified)'],
['dir|d:s', 'download path (current direcotry will be used by default)', {default => '.'}], ['dir|d:s', 'download path (current direcotry will be used by default)', {default => '.'}],
['proxy=s', 'HTTP-proxy (format: 1.2.3.4:8888)'], ['proxy=s', 'HTTP-proxy (format: 1.2.3.4:8888)'],
[], [],
['debug', 'print debug info during work'], ['debug', 'print debug info during work'],
['help', 'print usage'], ['help', 'print usage'],
[], [],
['Example: '], ['Example: '],
["\t".basename(__FILE__).' -p 123 -k ya-playlist'], ["\t".basename(__FILE__).' -p 123 -k ya-playlist'],
@@ -104,7 +104,7 @@ $json_decoder->allow_singlequote(1);
if($opt->proxy) if($opt->proxy)
{ {
$ua->proxy(['http'], 'http://'.$opt->proxy.'/'); $ua->proxy(['http', 'https'], 'http://'.$opt->proxy.'/');
} }
if($opt->album || ($opt->playlist && $opt->kind)) if($opt->album || ($opt->playlist && $opt->kind))
@@ -311,13 +311,19 @@ sub get_album_tracks_info
info(INFO, 'Album title: '.$title); info(INFO, 'Album title: '.$title);
info(INFO, 'Tracks total: '. $json->{pageData}->{trackCount}); info(INFO, 'Tracks total: '. $json->{pageData}->{trackCount});
my @volumes = ();
for my $vol(@{$json->{pageData}->{volumes}})
{
push @volumes, @{$vol};
}
return map return map
{ {
{ {
dir => $_->{storageDir}, dir => $_->{storageDir},
title=> $_->{artists}->[0]->{name} . ARTIST_TITLE_DELIM . $_->{title} title=> $_->{artists}->[0]->{name} . ARTIST_TITLE_DELIM . $_->{title}
} }
} @{ $json->{pageData}->{volumes}->[0] }; } @volumes;
} }
sub get_playlist_tracks_info sub get_playlist_tracks_info