V3 Music-cover command

Developer
Nov 18, 2009 at 3:54 PM

I know the version is still in beta, but I when I send the music-cover command it prompt me to download the cover image instead of displaying it in the browser.

Coordinator
Nov 18, 2009 at 5:10 PM

It depends on your browser, but to get it to work in Opera I just appended "%20.jpg" to the URL - so the browser knows it's an image.

Developer
Nov 18, 2009 at 5:55 PM

Would it be possible to have the album cover show up in the browser when you issue the mediametadata command? The reason is I am working a AMX module to pull the current playing info and display it on the AMX touch panel.  It would be awesome if I only had to parse one html page instead of parsing a second to pull the dynamic album cover. I am also a c# programmer but I don’t have the full version on visual studio 2008 to properly open your source project.

Coordinator
Nov 18, 2009 at 9:30 PM
Edited Nov 18, 2009 at 9:32 PM

This is easy if you use a custom format - in fact if all you are looking for is display you can probably do all the work on the server side. If you need to actullay consume the information you could easily get all the informaiton you wnated in whatever format you wanted (XML, etc)

The format command uses regular expressions to parse out information and inserts them into your specified text. It's a little (ok, alot) more complicated that the individual command formatting options, but it's more powerfull in that it can be applied to a series of commands. For example take the nested commands:

http://server/mediametadata/playstate-get

This will run the mediametadata command followed by the playstate-get command and concatenate the output (did you know you could do that?) So, the same command using the format command

http://server/mediametadata/playstate-get/format%20MyPrettyMetaData

This will take the mediametadata output, concatenate the playstate-get output, then use that to fill the regular expression substitutions in the file specified by "MyPrettyMetaData"

To set this up:

  1. Create (or copy) a custom.template file to the ehome directory (Usually c:\windows\ehome\)
  2. Create a format entry in custom template (something like): "MyPrettyMetaData c:\mediametadata.txt" (tab between the name and file)
  3. Create the format file (in the example c:\mediametadata.txt) - something like
Now playing <u>%%(?<=Title: )[^\r\n]*%%</u><br>
Play State: [%%(?<=<HR>[\r\n ]*).*%%]<br>
Album art url: music-cover%20exact-artist:%34%%(?<=Artist: )[^\r\n]*%%%34%20exact-album:%34%%(?<=Album: )[^\r\n]*%%%34%20.jpg

Big Caveat: I am writting this without the code or a media center in front of me - my expected output may be wrong, or my regular expressions could be wrong.

So, assuming the output of the mediametadata command was something like:

Title: Who Are You

Artist: The Who

Album: Who Are You

And the output of the "play-state" command was:

Paused

Then the output of "http://server/mediametadata/playstate-get/format%20MyPrettyMetaData" Should look something like:

Now playing <u>Who Are You</u><br>

Play State: [Paused]<br>

Album art: music-cover%20artist:%34The Who%34%20album:%34Who Are You%34%20.jpg

Depending on how familiar you are with Regular Expressions this is probably a little or a lot confusing. Hopefully it's enough information to figure out what you want to do...

 

Other relevant notes:

  • You can nest any command as deep as you like
  • The format command is destructive - it replaces all the previous output
  • Format commands can be nested (though each is destructive)
  • Depending on your browser the spaces in the above "Album art" might need to be encoded (e.g. %20) before it can be used
Developer
Nov 19, 2009 at 2:02 PM

Thanks, this helps alot.