A long, long, time ago, I posted this in the forum: http://forums.plex.tv/discussion/31469/shuffle-by-whole-album-in-order
(A feature request to provide a shuffle-by-album, such as iTunes use to provide: pick random albums, but preserve the track order)
Recently, I was thinking about it again, and it occurred to me that I should be able accomplish this (more-or-less) by using the PMS REST API to auto-generate a playlist of random albums. I did a little research, and was able to put together a stand-alone python script to do just that.
Of course, now I needed a way to easily run the script. I was considering building a kivy (http://kivy.org) app for my phone, or maybe running a mini-server on the same machine as PMS. Then I realized that I might be able to create a Plex Channel bundle to do so. So, I did a bit of research, and yes, with a bit of re-working of the network calls, I was able to slap together a plug-in that talks back to the server via the REST API to get album lists, delete, and create playlists.
The final step is to tell the client that talking to the plugin to actually start the playlist. I did some research on that, and yes, it also seems possible, but, man it’s starting to feel silly, to have a plug-in hosted by a server, that has jump through all these hoops when there might be a direct functional API. So here are some questions to make sure I’m not going about this the wrong way:
- Is there a way for a plugin to access the the equivalent of the PMS REST API without having to go through the HTTP requestor object? As in, via direct function calls. Specific needs would be list albums and playlists, and create and delete playlists, and also playqueues, I think.
- If no to #1, is there a way, from inside the plug-in, that I can determine which port PMS is listening on? I can assume 32400, but that may be wrong.
- From a plug-in, can I jump out to a playlist? That would be ideal, to create the playlist, and then have the client jump to actual playlist page/screen.
- If no to #3, can I determine what is the IP, or some ID of the controlling client?
- Maybe there is a fundamentally easier way to do this. Any suggestions?
- If you’re a Plex dev, maybe save me the effort, and implement this as part of PMS?
Thanks!