Quite useful if you want to find mp3 files from directory recursively. I used while developing CMS for my company. Getting Podcast libraries is important.
#!/usr/bin/perl -w
use strict;
use MP3::PodcastFetch::TagManager;
use File::Basename;
sub recurse($)
{
my($path) = @_;
my $duration=0;
my $ftype= "";
my $manager = MP3::PodcastFetch::TagManager->new();
my $filename="";
$path .= '/' if($path !~ /\/$/);
print $path,"\n";
## loop through the files contained in the directory
for my $eachFile (glob($path.'*')) {
## if the file is a directory
if( -d $eachFile)
{
recurse($eachFile);
}
else
{
($filename, undef, $ftype) = fileparse($eachFile,qr"\..*");
$filename =~ s/_+/ /g;
print "$ftype
\n";
if ($ftype eq ".mp3")
{
if($eachFile =~ m/GUID/)
{ ## print the file ... tabbed for readability
my $filesize = -s $eachFile;
$duration = $manager->get_duration($eachFile);
open (MYFILE, '>>datafulltracks.csv');
print MYFILE $filename,", Duration - ",$duration,", Size- ",$filesize,"\n";
}
}
}
}
close (MYFILE);
}
## initial call ... $ARGV[0] is the first command line argument
recurse($ARGV[0]);
Subscribe to:
Post Comments (Atom)
Efficient and Reliable UI automation without Selenium
I have been experiencing satisfaction over UI automation efforts after a half-decade of my work in automation. The reason is new age tools ...
-
So Now you don't wanna talk wid me, Is this the price that I paid For your walk wid me. Moments back, You said U wud be ma Friend, But U...
-
If someone wants to go through various OMA(Order Matching Algorithm), one can start with the basic one below from BSE. This is what I worked...
-
Financial Innovation being one of my favourite topics, I decided to pick on some popular technology standards in the Industry. FPML(Financia...
No comments:
Post a Comment