in reply to CPAN module MP3::M3U::Parser question

How exactly are you calling MP3::M3U::Parser? Please show the relevant code, even better if it is a self-contained program.

I interpret the documentation that ->new expects to be called like:

my $parser = MP3::M3U::Parser->new( -seconds => 'mm:ss', );

... but I have no convenient way of testing things at this time.

Replies are listed 'Best First'.
Re^2: CPAN module MP3::M3U::Parser question
by rgammon51 (Initiate) on Apr 22, 2012 at 23:18 UTC
    #!/usr/bin/perl use strict; use warnings; use MP3::M3U::Parser; # use Data::Dumper; print "Read MP3 Test file \n"; my $parser = MP3::M3U::Parser->new(-seconds => 'mm:ss'); $parser->parse("/home/rgammon51/Documents/Playlist.m3u")->export (-ove +rwrite => 1); my $result = $parser->result; my %info = $parser->info; printf "Number of Songs in this list :: %s\n ", $info{songs}; printf "Total Time to play all songs :: %s\n ", $info{ttime}; printf "Average Time of all songs :: %s\n ", $info{average};

    This ending part does not generate mm:ss results The formatted time only appears in the html file.

    My goal, ultimately, is to use this module to generate a shell script to update the contents of my mp3 player that I carry around daily. it is a cheap player that does not implement shuffle, so I must update its contents periodically with new material, and most importantly in a different order.

    This code uses your hint as to how to proceed. however, the screen output from printf is just seconds, not hh:mm:ss.

    This appears to be a characteristic of the code in the CPAN module, and to change it, I must modify the source.