D
David Warren
Hi,
Okay, I was wondering if anybody has any better ideas on how to
implement this....
This is for updating a progress bar. (As far as I've tried this is
working) I'm taking the output from:
"
ID3v2 found. Be aware that the ID3 tag is currently lost when transcoding.
input: 13 - Mrs. Robinson.mp3 (44.1 kHz, 2 channels, MPEG-1 Layer III)
output: 13 - Mrs. Robinson.mp3.wav (16 bit, Microsoft WAVE)
skipping initial 1105 samples (encoder+decoder delay)
Frame# 8575/8575 192 kbps L R
"
The only line I really care about is the last line with Frame#.
By the way, this is my first program I'm writing with perl, only have a
little background in shell scripting. Just don't know if this is the
most efficient way of doing this.
<code>
my ( @nums , $num );
local $/ = "\r";
open PIPE, "lame $args \"$song_source\" \"$song_destin\" 2>&1 |";
my $y = $e->gauge_start( text => "Converting: $song_source", percentage
=> 1 );
my $line_count = 1;
then I'm using a while loop:
while ( <PIPE> ) {
if ( /Frame/ && /kbps/ && /$line_count/ ) {
$line_count++;
unless ( defined($num) ) {
@nums = m/(\/\d+\.?\d*|\.\d+)/g;
$num = "@nums";
$num =~ s/\///;
}
else {
$y = $e->gauge_set( $line_count/$num * 100 );
chomp($y);
}
</code - snip >
(this should all be that is relevant (yes the code could probably be
cleaned up ... ;-)
I'm not too certain about the @nums = m/(\/\d+\.?\d*|\.\d+)/g .
That is extracting the latter half of the numbers in: 8575/8575
Any suggestions? I'm just doing this too familiarize myself with perl.
Thanks a lot for the help.
David
Okay, I was wondering if anybody has any better ideas on how to
implement this....
This is for updating a progress bar. (As far as I've tried this is
working) I'm taking the output from:
"
ID3v2 found. Be aware that the ID3 tag is currently lost when transcoding.
input: 13 - Mrs. Robinson.mp3 (44.1 kHz, 2 channels, MPEG-1 Layer III)
output: 13 - Mrs. Robinson.mp3.wav (16 bit, Microsoft WAVE)
skipping initial 1105 samples (encoder+decoder delay)
Frame# 8575/8575 192 kbps L R
"
The only line I really care about is the last line with Frame#.
By the way, this is my first program I'm writing with perl, only have a
little background in shell scripting. Just don't know if this is the
most efficient way of doing this.
<code>
my ( @nums , $num );
local $/ = "\r";
open PIPE, "lame $args \"$song_source\" \"$song_destin\" 2>&1 |";
my $y = $e->gauge_start( text => "Converting: $song_source", percentage
=> 1 );
my $line_count = 1;
then I'm using a while loop:
while ( <PIPE> ) {
if ( /Frame/ && /kbps/ && /$line_count/ ) {
$line_count++;
unless ( defined($num) ) {
@nums = m/(\/\d+\.?\d*|\.\d+)/g;
$num = "@nums";
$num =~ s/\///;
}
else {
$y = $e->gauge_set( $line_count/$num * 100 );
chomp($y);
}
</code - snip >
(this should all be that is relevant (yes the code could probably be
cleaned up ... ;-)
I'm not too certain about the @nums = m/(\/\d+\.?\d*|\.\d+)/g .
That is extracting the latter half of the numbers in: 8575/8575
Any suggestions? I'm just doing this too familiarize myself with perl.
Thanks a lot for the help.
David