From 2d4d95aab2d893e9b3b6b86ea989455148eaba2e Mon Sep 17 00:00:00 2001 From: notnac <32044623+notnac@users.noreply.github.com> Date: Sat, 28 May 2022 17:32:29 +0100 Subject: [PATCH] iterate total file size in FHD download progress display --- get_iplayer | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/get_iplayer b/get_iplayer index a2602406..4cfb91e4 100755 --- a/get_iplayer +++ b/get_iplayer @@ -8204,6 +8204,16 @@ sub fetch { } $size = tell $fh; return if $opt->{quiet} || $opt->{silent}; + if ( $prog_mode =~ /fhd/ && $curr_sequence - $start_sequence > 0 ) { + my $sequence_size = int($size / ($curr_sequence - $start_sequence)); + if ( $stop_sequence - $start_sequence > 0 ) { + my $new_size = $sequence_size * ($stop_sequence - $start_sequence); + if ( abs($new_size - $file_size) > 0.05 * $file_size ) { + $file_size = $new_size; + $file_size_mb = $file_size / 1000000.0; + } + } + } $percent = $file_size ? 100.0 * $curr_size / $file_size : 0; # limit progress display to 99.9% if ( $percent > 99.9 ) {