INTERACT FORUM

Windows => Plug-in Development => Topic started by: cncb on March 11, 2008, 08:59:28 am

Title: Enumerate Genres With SDK?
Post by: cncb on March 11, 2008, 08:59:28 am
Is there a way to enumerate Genres or any other field with the SDK?  That is, retrieve a list of all the used Genres in the library (like that shown in the Smartlist creation dialog, for example).
Title: Re: Enumerate Genres With SDK?
Post by: cncb on March 19, 2008, 08:08:22 am
Anyone?  Is this not possible with the automation API?
Title: Re: Enumerate Genres With SDK?
Post by: Doof on March 19, 2008, 09:12:31 am
You could do it the hard way... retrieve a  FilesAutomation object containing all of the files in the library, then look at them one by one and compile your own list.

What would be really nice is if the SDK implemented an Enumerate function that took the name of a field and a FilesAutomation object and returned a list of all the values of that field in that object. The you could get a list of all the Artists, Genres, Comments, etc.
Title: Re: Enumerate Genres With SDK?
Post by: Matt on March 19, 2008, 09:15:38 am
Media Center doesn't have genre, artist, etc. tables so direct enumeration isn't possible.

One approach is to a file search with a ~nodup specifier to let it filter the list for you.
Title: Re: Enumerate Genres With SDK?
Post by: Doof on March 19, 2008, 09:26:05 am
One approach is to a file search with a ~nodup specifier to let it filter the list for you.

Ah, I hadn't even thought of that. That would make it pretty simple really. All that would get returned is one file each of all the genres in your library. Then you just iterate through them and compile the list.

I wish I'd thought of that (or you'd mentioned it) sooner. That could have made life a little easier.

I guess that's why Matt gets paid to do this and for me it's just a sometimes hobby. ;)
Title: Re: Enumerate Genres With SDK?
Post by: cncb on March 19, 2008, 09:41:58 am
Media Center doesn't have genre, artist, etc. tables so direct enumeration isn't possible.

One approach is to a file search with a ~nodup specifier to let it filter the list for you.


Thanks, this works well.