Audio library vs. music library

Oct 14, 2009 at 10:39 AM

Hi,

what exactly is the difference between the audio library commands and the music library commands? The audio lib commands take much longer to complete. I spotted one difference: the music library commands return the song artists where the music library returns the album artists. I want to use the album artists only. Is there a command to list them using the music library commands?

M.

Coordinator
Oct 14, 2009 at 6:59 PM
Edited Oct 14, 2009 at 7:01 PM

The audio library commands were written first and are somewhat brute force. Getting any kind of performance out of them required track indexes to be used which got confusing.

The Music library commands are new (as of the "alpha 3" release) and use database queries and are(mostly)  __much__ faster. I wrote new commands (instead of just refactoring the audio library commands) because there is less information returned by the faster commands, so I felt like I had to continue to support the older commands. My plan is to consider the "audio library" commands depricated. If you are not already using them don't - use the music-* commands instead. If you are already using the audio library commandsyou should move over to the faster commands when you can.

The music commands are also cached so that repetitive commands (without changes to the music library) are seved very quickly. 

Music Commands:

  • music-list-artists - Fast! lists artists (output is artist name only. can be custom formated with a template)
  • music-list-albums - Fast. lists album names (can be filtered by artist. can be custmusic-list-artists - Fast! lists artists (output is artist name only. can be custom formated with a template)
  • music-list-albums - Fast. lists album names (can be filtered by artist. can be custom formated with a template)
  • music-list-songs - Fast. lists song titles (can be filtered by artist and / or album. can be custom formated with a template)
  • music-list-details - Returns more detail than just names (can be custom formated with a template - this command can be made to do anything the audio library commands could do)
  • music-play - plays specified search results (based on provided filters, and or indexes into the results)
  • music-queue - same as music-play, except is added to the now playing List
  • music-cover - serves the first matching cover image
  • music-clear-cache - forces the cache files to be deleted (normally only deleted when the number of audio items in the collection changes)

Audio Commands (Depricated - shouldn't be used for new work):

  • list-artists: returns a list of artists in the library (very slow - my 1K artists takes 1 minute to return)
  • list-artist-songs: returns a list of songs by a given artist (using the index returned by #1 makes this fast)
  • list-artist-albums: returns a list of albums by a given artist (using the index returned by #1 makes this fast)
  • list-albums: returns a list of all albums (can be slow)
  • list-album-songs: returns a list of songs on the specified album (using the index returned by #1 or #3 makes this fast)
  • list-all-custom: returns everything using the specified custom format (see artist.template to define formats)
  • list-artist-custom: returns everything by a specified artist using the specified custom format (see artist.template to define formats)
  • list-album-custom: returns everything on a specified album using the specified custom format (see artist.template to define formats)
  • list-song-custom: returns information on a specific track using the specified custom format (see artist.template to define formats)
  • play-audio-artist: Starts playing everything by the specified artist (using the index returned by #1 makes this fast)
  • play-audio-album: Starts playing everything on the specified album (using the index returned by #1 makes this fast)
  • play-audio-song: Starts playing the specified track (using the index returned by #1-#4 makes this fast)
  • queueaudio-artist: Adds everything by the specified artist to the now playing queue (using the index returned by #1 makes this fast)
  • queueaudio-album: Adds everything on the specified albumto the now playing queue (using the index returned by #1 makes this fast)
  • queueaudio-song : Adds the specified track (using the index returned by #1-#4 makes this fast)

 

Oct 14, 2009 at 7:11 PM

Hi,

thanks for the info. What about the artists problem? When I use the list-* commands I get my "normal" MCE artists (which I want). The new (really fast) commands return much more artists which seem not to be the album artists. Could this be fixed - it´s very important for me.

Thanks!

M.

Coordinator
Oct 15, 2009 at 12:46 AM

It's the difference between looking at the "Artist" and "WM/AlbumArtist" attributes. I made a quick fix that just added a new command "music-list-album-artists" and that works, I'm just not sure about how to apply the filtering to it...

With the current release I display "Artist" and all filtering is done by the "Artist" attribute for all commands, except "music-list-details" where the filtering is done by "Artist", but each track is displayed with "WM/AlbumArtist" (unless that's not present, in which case it tries to fall back to "Author"). So this is inconsistent right now.

The reason I'd moved to "Artist" instead of AlbumArtist was because most tracks have an Artist, but not all tracks have AlbumArtist. For example, almost any live track that you download (e.g. from KEXP.org) does not have an AlbumArtist.

So the question is what should I do. Options are:

  1. Add "music-list-album-artists" command, but no change to logic - Filtering will still be by "Artist"
    • Pro: Easy to implement (pretty much already done)
    • Cons: may lead to inconsistent results, e.g. filter by "Madona" could return an album artist of "Various Artists"
  2. Add "music-list-album-artists" command, and change logic to match what is displayed - Filtering by Artist for "music-list-artists" and "music-list-songs"; filter by AlbumArtist for "music-list-album-artists", "music-list-albums", and "music-list-details" 
    • Pro: Filtering is consistent with command type
    • Cons: Messes up my current caching scheme; is confusing for music-play / queue commands where it's not clear whcih search result type should be used
  3. Don't add any new commands and add a new parameter flag to all commands which says something like "use albumArtist" 
    • Pro: caching scheme continues to  work; filter is consistent with what is displayed; most flexible
    • Con: most work

Anyone have opinions? Off the top of my head I think #3 is the correct way to go, but also the most work.

@Maltic: Is it enough for you to know it's going to be fixed, or do you need it fixed now? If you're building at home you can get music-list-artists to do what you want (with inconsistent filtering) by changing the attribute from "Artist" to "WM/AlbumArtist" in both spots in the LIST_ARTISTS case inside of musicCmd.Execute() :

 

                    case LIST_ARTISTS:
                        cache_body = get_cached(cache_fn, cache_ver);
                        if (cache_body.Length == 0)
                        {
                            WMPLib.IWMPStringCollection artists = collection.getStringCollectionByQuery("WM/AlbumArtist", query, "Audio", "WM/AlbumArtist", true);
                            result_count = artists.count;
                            opResult.AppendFormat("{0}", basic_replacer(getTemplate(template + ".H", ""), "", "", result_count, -1)); // Header
                            for (int j = 0; j < artists.count; j++)
                            {
                                //opResult.AppendFormat("artist={0}", artists.Item(j));
                                opResult.AppendFormat("{0}", basic_replacer(getTemplate(template + ".H", "artist=%artist%"), "artist", artists.Item(j), result_count, -1)); // Header
                            }
                        }
                        else
                        {
                            is_cached = true;
                            opResult.ContentText = cache_body;
                        }
                        break;

 

 

 

                    case LIST_ALBUM_ARTISTS:
                        cache_body = get_cached(cache_fn, cache_ver);
                        if (cache_body.Length == 0)
                        {
                            WMPLib.IWMPStringCollection artists = collection.getStringCollectionByQuery("WM/AlbumArtist", query, "Audio", "WM/AlbumArtist", true);
                            result_count = artists.count;
                            opResult.AppendFormat("{0}", basic_replacer(getTemplate(template + ".H", ""), "", "", result_count, -1)); // Header
                            for (int j = 0; j < artists.count; j++)
                            {
                                //opResult.AppendFormat("artist={0}", artists.Item(j));
                                opResult.AppendFormat("{0}", basic_replacer(getTemplate(template + ".H", "artist=%artist%"), "artist", artists.Item(j), result_count, -1)); // Header
                            }
                        }
                        else
                        {
                            is_cached = true;
                            opResult.ContentText = cache_body;
                        }
                        break;

 

 

Oct 15, 2009 at 1:04 PM

What do I need for building? c# 2008 express or the pro version?

Developer
Oct 15, 2009 at 1:33 PM

Express should be fine. but you'll run into trouble with the existing code. can you remember? Win7 installer? ;) my code isn't in the repository yet.

in general i agree in option 3 with Tony. and i think implementing these flags it's a good way to get familiar with the code for me. ;)
cons at this point for you: you have to wait a while until i added the flags. ;)

i need to keep an eye on getting off to far away of the code base too.  at the moment priority for me is to clean up the installers
and try to make the code compatible for Vista and Win7. i'll take a closer look at option 3 then.

option 4 for you at the moment would be to take my modified code and try to compile it by yourself. but that leads to a solution
splintered you only for you. another update could break everything. not the best way.

Oct 15, 2009 at 6:45 PM

Sure - I´ll need your changes first ;) Could you send me yource source-tree or put it in the repository? I think changing Artist to WM/Albumartist should not break anythink, because the old commands were using it, too ... well - I can live with that ;) Maybe it is possible for you to change it in the official repository as well so that future builds will also return Albumartists - IMHO this should be the default. Returning Artist could be an option, so I would stay with option 3 as well.

 

Coordinator
Oct 19, 2009 at 5:11 PM

Actually I think that AlbumArtist is not the right default - especially on the track (song) level as many tracks do not have this attribute (almost 10% in my collection).

AlbumArtists makes sense when you are looking at things from an album perspective, otherwise it does not - for example when you ask for all the songs by a given artist any compilation tracks would be excluded (since the albumArtist on these are probably "Varius Artists")

I don't have the Win7 code, so I can't send it to you. C# Express is what I'm using... so it should be fine :-)

Developer
Oct 19, 2009 at 7:50 PM

The code is in the repository. but be aware it#s still experimental at some point. so don't be afraid if something isn't working as expected. ;)

For me album artist is for use from album perspective too. i nearly have no album artists. a few in compilations.

Oct 20, 2009 at 12:35 PM

Hi,

I want to write some kind of remote browser for the Blackberry (which is actually in a very early state - but working!) and want to use the same browsing functionality as in the MCE UI itself:

Artist -> Album -> Song

This means that I want to get the same artists back from the HTTP interface as in the MCE UI. Maybe you can implement it as an option. Pantarhei: thanks for the code update. Is there any new command for the album artist, what should I use?

Developer
Oct 21, 2009 at 9:56 AM

nothing changed with the commands in my version. so if you like or need something different you have advices from Tony where to go. i'm still working on x64/Win 7 support.
so i can't tell you much about the artists problem.