Another request about scripts : pick items from folder

Hello all !

Tonight, I’m trying to do something : in scripts, I’m trying to get random item from mairlistDB folder.
I read a lot of thread and also the scripting documentation. And all I read in this forum is out-of-dated. The “GetBackend” seems to not exist anymore, as the “GetFolderContent” … The IDBConnection interface … how to get a IDBBackend from the database to make the request ?

I can’t manage to make it work. I found a script from Torben here (his “jukebox” script) which can help me a lot, but as the other topic I found, it doesn’t work anymore in v7.

Could you give me on the right way ? How can I read (in order to random into it) the folder content ?

Regards,

Sylvain

No idea ? Quite anoying… I will make some new tries tonight : I hope it still possible…

If it’s not possible anymore, I will do it with an old way (not very handy and dynamic) : creating playlists (one by mairlist DB folder) which contains all items, and use in my scripts this playlist to random pick some items into them… I think I could allow that playlists are not totally up-to-date when I need them.

I think it will do the job… but not in a very fancy (and mainly not dynamic at all) way.

Regards,

Sylvain

Hi Sylvain!
Are you using templates and generate playlist in your database? If yes, you can make the template pick random songs from a specific folder in your Database.

Or is there a reason why this needs to be part of a script? :blush:

Thomas

1 Like

Hello !

Yes, I use templates for generating my hourly playlist.
But, for some weekly time slots, I have specific playlists: They are pre-built playlists actually : they contain fixed playlist items where I have customized the segue in detail. And, they contain some ‘generic’ playlist item slots (I use dummy items with specific title and artist values). When those specific playlists will be loaded, my script should only replace those ´generic’ playlist items with a real playable playlist item (jingle or music). My script have to do the job (and he already does !) on each ´generic’ items. This is not a problem if random picking with script doesn’t respect the separation rules. Here, in my case, they can be broken.

At the moment, all works but I created special playlists that are the mirror of my mairlistDB folder. And I pick a random item into them.

It would be great if it were more dynamic and if it picks random folder item instead.

Regards,

Sylvain