music-cover URL encoding

Nov 9, 2010 at 9:47 PM

Hello

I’m having a problem with the “music-cover” command and specifying a URL for some albums and artists.

I can successfully get the album art back from the following:

Aritist = Anonymous

Album = Z Album

URL = http://myserver/music-cover%20artist%3A%22Anonymous%22album%3A%22Z%20Album%22%20.jpg

 

However, using the same encoding with:

Aritist = Mr. Scruff

Album = Ninja Tuna

URL = music-cover%20artist%3A%22Mr.%20Scruff%22album%3A%22Ninja%20Tuna%22%20.jpg

I get the first album cover in the collection returned.

 

It would seem the problem is the period (.) or full stop between Mr and Scruff. I get the same problem with other artist or album names containing periods.

I have tried replacing the period with %2E but get the same result.

 

What am I doing wrong?

 

 

Coordinator
Nov 9, 2010 at 10:10 PM

It's been a while, but I believe I've seen similar issues - specifically with the & character (e.g. Bob Marley & the Wailers). I don't recall having issues with the album cover, but I do think there were issues with getting the music to play.

I'm sorry that I don't have time to look through the code and try to figure out what is going on. I'm guessing that it might have something to do with the query language being used - some character may have special meaning. If this is true then there should be a way to "escape" them.

Hope someone can figure it out!

Good luck, Tony

Nov 10, 2010 at 1:14 PM

I had a look through the source code and found:

   public void findAlbumCover(string url)
            {
                string s = "";
                if (albumImage.Length > 0) return;

                try
                {
                    s = Path.GetDirectoryName(url) + @"\Folder.jpg";
                    if (File.Exists(s)) albumImage = s;
                    else
                    {
                        s = Path.GetDirectoryName(url) + @"\AlbumArtSmall.jpg";
                        if (File.Exists(s)) albumImage = s;
                    }
                }
                finally { }
            }

The Folder.jpg is created by WMP and not by media center AFAIK. If a music folder contains various artists there will still only be one Folder.jpg. The Folder.jpg is not overwritten by mediacenter when a new track is played.

Using the Folder.jpg for album art requires that each arist and album must be in separate folders.



Using the mediametadata command the URI of the current track is given:

Uri=C:\Users\Public\Music\Sample Music\Kalimba.mp3

Is there any way to grab embedded album art using the URI info?

Coordinator
Nov 10, 2010 at 5:36 PM

I'm almost positive that media center uses WMP to play music - so playing music through the MC also causes the folder images to be created.

There aren't images embedded in most (any?) of my tracks so the above code was the only way I could find to get the image (I tried a number of tactics - including trying to get them off of the internet)

A quick search confirms that Media Center uses folder.jpb - http://www.codinghorror.com/blog/2007/02/windows-vista-media-center.html:

If ur using the x64 version of MediaCenter, you might want to use the x64 version of Media Player (the x64 ver of Vista has both the x32 and x64 Media Player).. That way what you see in Media Player matches what you see in Media Center..For album art, Media Center uses a file called folder.jpg that is located in the folder with the music files. Media Player creates this file (usually a hidden/system file). If this file is missing or if you want to use a diff pic just put a new file in that dir with the folder.jpg name

I don't have time to research it throughly, but a surface scan of the API doesn't seem to provide anyway to see an embedded album cover. Although I think explorer shows it, so it should be possible.

Nov 10, 2010 at 7:39 PM

Thanks for the reply.

I'm using Win 7 x64. Did a fair bit of searching and 7MC seems to create it's own cache for art. The cache is located in the folder:

C:\user\username\appdata\local\microsoft\ehome\art cache


The jpg files are named with guid's, e.g.:

AlbumArt_{1FB52B20-3483-43C0-B5E9-07CE7BEECFEF}_Large.jpg

If I can find a way to decode the guid's that might provide a solution.


Going back to WMP, when I play a music file in 7MC there doesn't seem to be any change to folder.jpg's. There also isn't any change in the folder:

C:\user\username\appdata\local\microsoft\media player\art cache

Maybe there are some differences between Vista and Win 7 when it comes to cover art.