Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Does anybody have a prewritten Perl script to read WMA tags, such as the title, genre, and track of a file? I know a bunch of ID3 tag reading/writing scripts exist, but as of yet, I'm unable to find a perl script for WMA. Even Audio::WMA doesn't seem able to read the track number, title, year, etc. of a WMA track.

Replies are listed 'Best First'.
Re: WMA Music Tags
by tilly (Archbishop) on Jan 02, 2004 at 03:42 UTC
    I certainly don't have one, and I'd suspect that you are going to have to work for this.

    The problem is that WMA is a proprietary format, and Microsoft has little interest in cooperating with others on it. Quite the opposite in fact, they are integrating DRM (Digital Rights Management) into it, and DRM will fail badly if third parties are able to write their own decoders which are free to ignore Microsoft's DRM rules.

    My first suggestion is to contact the author of Audio::WMA and ask him what he found. My second is to hope that you can get the music in a different format. My third is to go to Microsoft's documentation for things like the Windows Media Player SDK and see if you can script their official COM interface using Win32::OLE.

      After investigating a bit, the truth is that the data is stored in the object's 'comment' parameter. Try  print keys %{$wma->comment};, and you'll see that the keys are the parameters being looked for.

      Although WMA is a proprietary format, with DRM being able to encrypt files, the tagging on WMA files isn't encrypted. AFAIK, WMA feeds everything _after_ the tags into the the player, which in turn decrypts and plays the raw file. As you said, it's doubtful that intigration into the open source world will be possible, but who knows (at some point somebody may crack the encryption and although it's illegal, what will Microsoft's response be?)

      WMA files at the least provide diversity with liscensing, and I personally think they could be one of Microsoft's more sucessful developments.

      Gyan Kapur
Re: WMA Music Tags
by Popcorn Dave (Abbot) on Jan 02, 2004 at 05:39 UTC
    Another option is to cheat. Check this link here for a WMA to MP3 converter and then use the ID3 tag modules that are available.

    Alternatively, the fellow that wrote Media Tagger seems to have cracked it. I just checked a couple of WMA's that I have. His website is here.

    Good luck!

    UPDATE: Check this link on SourceForge. Granted it's PHP code, but it may provide a jumping point for you.

    There is no emoticon for what I'm feeling now.