Skip to content

Commit

Permalink
fix download failure with --versions=default
Browse files Browse the repository at this point in the history
Regression introduced in v3.32

Closes #446
  • Loading branch information
notnac committed Oct 27, 2023
1 parent 390bc09 commit 0f70bd8
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions get_iplayer
Original file line number Diff line number Diff line change
Expand Up @@ -5031,6 +5031,7 @@ sub get_verpids_json {
my ( $prog, $ua ) = @_;
my $pid = $prog->{pid};
my $url = "https://www.bbc.co.uk/programmes/$pid/playlist.json";
my $version_map = { "default" => "", "audiodescribed" => "ad", "signed" => "sign", "combined" => "" };
main::logger "INFO: iPlayer metadata URL (JSON) = $url\n" if $opt->{verbose};
my $json = main::request_url_retry( $ua, $url, 3, undef, undef, undef, undef, 1 );
if ( $json ) {
Expand Down Expand Up @@ -5071,7 +5072,6 @@ sub get_verpids_json {
main::logger "WARNING: Could not download version PID metadata from $url\n";
}
$prog->{versions} = join ',', keys %{ $prog->{verpids} };
my $version_map = { "default" => "", "audiodescribed" => "ad", "signed" => "sign", "combined" => "" };
my $version_list = $opt->{versionlist} || $prog->{versions};
for ( split /,/, $version_list ) {
if ( $prog->{verpids}->{$_} ) {
Expand All @@ -5087,11 +5087,7 @@ sub get_verpids_json {
}
}
}
my $found;
for ( keys %{ $prog->{verpids} } ) {
$found = 1 if $version_list =~ /$_/ && $prog->{verpids}->{$_};
last if $found;
}
my $found = keys %{ $prog->{verpids} } > 0;
return 1 if ! $found;
return 0;
}
Expand Down Expand Up @@ -5119,7 +5115,6 @@ sub get_verpids_html_radio {
sub get_verpids_html {
my ( $prog, $ua ) = @_;
my $pid = $prog->{pid};
my $version_list = $opt->{versionlist} || 'default';
my $version_map = { "default" => "", "audiodescribed" => "ad", "signed" => "sign", "combined" => "" };
for my $version ( "default", "audiodescribed", "signed", "combined" ) {
next if $prog->{verpids}->{$version};
Expand Down Expand Up @@ -5189,6 +5184,7 @@ sub get_verpids_html {
$prog->{durations}->{$version} = $1 if $config =~ /"duration":(\d+)/;
}
$prog->{versions} = join ',', keys %{ $prog->{verpids} };
my $version_list = $opt->{versionlist} || $prog->{versions};
for ( split /,/, $version_list ) {
if ( $prog->{verpids}->{$_} ) {
my $episode_url;
Expand All @@ -5203,11 +5199,7 @@ sub get_verpids_html {
}
}
}
my $found;
for ( keys %{ $prog->{verpids} } ) {
$found = 1 if $version_list =~ /$_/ && $prog->{verpids}->{$_};
last if $found;
}
my $found = keys %{ $prog->{verpids} } > 0;
return 1 if ! $found;
return 0;
}
Expand Down

0 comments on commit 0f70bd8

Please sign in to comment.