Well I went and looked at the gnmidi set of utilities, and there is a way to do it, with the free utility mididir.exe.
It runs under wine like this:
wine -- mididir.exe -length
That will give a print out like this for each midi file in
the directory:
Y:\ZLIG~MY.MID: (33 kb, format 1, 11 tracks, GS, 3:00)
Where the MM::SS is at the end after GS,
Now you have 2 problems, working out a way to translate the crappy 8.3 notation output for the filename to the real filename, and extracting the MM::SS info and probably throwing it in a hash for saving in a database.
Heres an UPDATE: If you go to the free utilities section of gnmidi.com, there is the miditime utility. You can run it on an individual file like this:
#!/usr/bin/perl
my $midifile = shift;
system("wine -- midifade -songtime $midifile");
and you will get output like this
song: units 0 - 34475 time 0:00.000000 - 2:59.545800
So run it with backticks, and grab the last set of digits.
I'm not really a human, but I play one on earth.
flash japh
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.