Page 1 of 1

getArtist ID error

PostPosted: Fri Apr 14, 2017 10:55 pm
by rauco
I'm having trouble with the API. What I'm trying to do it this:

-Find the artist, return the ID
-Use the ID to list albums

So I do this
- search2 by artist name
- use that result in getArtist

However, that id is different than if I just run getArtists. Is there a reasoning to this?

Re: getArtist ID error

PostPosted: Sat Apr 15, 2017 3:18 am
by acroyear
Get artists gets you the "indexes" - the list of artists grouped by first letter (give or take what your site's indexes are set to). You can use that to create a browsing page.

There are two sets of 'ID's for the layers that get you to songs (which have the same ID in both modes)

ID3 - getArtists, getAlbums,search3 - these ignore your physical layout of your folders and strictly uses the tags within the files to sort by.

musicDirectory - getIndexes, getMusicDirectory, search2 - these follow the physical directory structure of your files. Though the UI presumes that it is artist->album, it doesn't have to be. Albums split into "CD1" and "CD2" stay that way (the ID3 version will combine them if they have the same album name and artist name).

For many, these may be the same, esp if you have your folders pointing to your iTunes folder or something similar.

So if you're using search2, you need to use getMusicDirectory on the results, not getArtist, in order to get the artists album directories, inside which you again call getMusicDirectory to get the songs.

If you are using search3, then you can use getArtist against the artist ID or getAlbum against the albumID.

yeah, a little confusing, but there we are. The ID3 endpoints were added to support clients that wanted it, but the official Web UI and Android App ignore them.

Re: getArtist ID error

PostPosted: Sat Apr 15, 2017 3:23 am
by acroyear
To clarify with a complex example.

King Crimson has 7 line-ups (give or take). 69, 71, 73, 81, 94, 2000, 2016. I have them all tagged as King Crimson, but sorted them separately in my folders.

KC69/In the Court/songs

If I use search2, I can search for "KC69", then use that ID to getMusicDirectory, which returns In the Court. getMusicDirectory on In the Court's ID returns the songs. I can find all the KC## directories under K in getIndexes.

Now if I use getArtists, under K I would only find King Crimson. None of the KC folders. That King Crimson ID passed to getArtist would return ALL of the albums. getAlbum on each Id returns the songs for each. search3 would never find "KC". It would only match up "King Crimson", and that Id I would pass to getArtist to get all the albums.

Re: getArtist ID error

PostPosted: Sat Apr 15, 2017 3:29 am
by acroyear
The ID3 mode is surprisingly smart, and able to cut across directories to assemble an album.

E.g., I have a Jefferson Starship greatest hits CD. I split it up, putting some (the Marty Balin material) in 70s Classic Rock. I put the rest (the Mickey Thomas hits) in 80s Pop-Rock. Using the musicDirectory stuff, each one is totally separate. Using the ID3 getArtist/getAlbum, I get one album of Greatest Hits, putting all the tracks from the two folders back in order in a single return value.

Re: getArtist ID error

PostPosted: Sat Apr 15, 2017 12:01 pm
by rauco
Thanks Joe,

That clarifies it a bit. I think for my purpose, which is building an Alexa skill, I'll stick with getArtists, but I think search2 will definitely have some usefulness.