A friendly hint. You should not use direct access to the database, we have a API that you can use to create the playlists. You can either 1) watch network traffic from Plex/Web when modifying the playlist to get a sense of it. 2) Look at PHT's source code when it starts supporting playlists (it currently only supports playQueues, which are tied to playlists).
Aha! Exactly the kind of information that I was hoping for by posting the first few fumbling steps.
Using the Chrome web tools to watch network traffic while manipulating a playlist, it seems to be fairly straightforward.
In the interests of sharing, here's an example of adding an item to a playlist:
items?uri=library%3A%2F%2FPRIVATE%2Fitem%2F%252Flibrary%252Fmetadata%252F5297
192.168.0.100/playlists/5848
?X-Plex-Client-Identifier=PRIVATE&X-Plex-Product=Plex+Web&X-Plex-Device=OSX&X-Plex-Platform=Chrome&X-Plex-Platform-Version=39.0&X-Plex-Version=2.2.4&X-Plex-Device-Name=Plex+Web+(Chrome)&X-Plex-Token=PRIVATE&X-Plex-Username=jackandjohn
162.243.67.114
3 requests ❘ 1.1 KB transferred
HeadersPreviewResponseTiming
Remote Address:192.168.0.100:32400
Request URL:http://192.168.0.100:32400/playlists/5848/items?uri=library%3A%2F%2FPRIVATE%2Fitem%2F%252Flibrary%252Fmetadata%252F5297
Request Method:PUT
Status Code:200 OK
Request Headersview source
Accept:text/plain, /; q=0.01
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8
Connection:keep-alive
Content-Length:0
Host:192.168.0.100:32400
Origin:http://plex.tv
Referer:http://plex.tv/web/app
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2138.3 Safari/537.36
X-Plex-Client-Identifier:PRIVATE
X-Plex-Device:OSX
X-Plex-Device-Name:Plex Web (Chrome)
X-Plex-Platform:Chrome
X-Plex-Platform-Version:39.0
X-Plex-Product:Plex Web
X-Plex-Token:PRIVATE
X-Plex-Username:jackandjohn
X-Plex-Version:2.2.4
Query String Parametersview sourceview URL encoded
uri:library://PRIVATE/item/%2Flibrary%2Fmetadata%2F5297
Response Headersview source
Access-Control-Allow-Origin:*
Access-Control-Expose-Headers:Location
Cache-Control:no-cache
Connection:close
Content-Encoding:gzip
Content-Length:320
Content-Type:text/xml;charset=utf-8
X-Plex-Content-Compressed-Length:320
X-Plex-Content-Original-Length:489
X-Plex-Protocol:1.0
And here's removing an item from the same playlist:
Remote Address:192.168.0.100:32400
Request URL:http://192.168.0.100:32400/playlists/5848/items/194
Request Method:DELETE
Status Code:200 OK
Request Headersview source
Accept:text/plain, */*; q=0.01
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8
Connection:keep-alive
Host:192.168.0.100:32400
Origin:http://plex.tv
Referer:http://plex.tv/web/app
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2138.3 Safari/537.36
X-Plex-Client-Identifier:PRIVATE
X-Plex-Device:OSX
X-Plex-Device-Name:Plex Web (Chrome)
X-Plex-Platform:Chrome
X-Plex-Platform-Version:39.0
X-Plex-Product:Plex Web
X-Plex-Token:PRIVATE
X-Plex-Username:jackandjohn
X-Plex-Version:2.2.4
Response Headersview source
Access-Control-Allow-Origin:*
Access-Control-Expose-Headers:Location
Cache-Control:no-cache
Connection:close
Content-Encoding:gzip
Content-Length:301
Content-Type:text/xml;charset=utf-8
X-Plex-Content-Compressed-Length:301
X-Plex-Content-Original-Length:441
X-Plex-Protocol:1.0
And here's deleting a whole playlist:
5848
192.168.0.100/playlists
?X-Plex-Client-Identifier=PRIVATE&X-Plex-Product=Plex+Web&X-Plex-Device=OSX&X-Plex-Platform=Chrome&X-Plex-Platform-Version=39.0&X-Plex-Version=2.2.4&X-Plex-Device-Name=Plex+Web+(Chrome)&X-Plex-Token=PRIVATE&X-Plex-Username=jackandjohn
162.243.67.114
2 requests ❘ 202 B transferred
HeadersPreviewResponseTiming
Remote Address:192.168.0.100:32400
Request URL:http://192.168.0.100:32400/playlists/5848
Request Method:DELETE
Status Code:200 OK
Request Headersview source
Accept:text/plain, */*; q=0.01
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8
Connection:keep-alive
Host:192.168.0.100:32400
Origin:http://plex.tv
Referer:http://plex.tv/web/app
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2138.3 Safari/537.36
X-Plex-Client-Identifier:PRIVATE
X-Plex-Device:OSX
X-Plex-Device-Name:Plex Web (Chrome)
X-Plex-Platform:Chrome
X-Plex-Platform-Version:39.0
X-Plex-Product:Plex Web
X-Plex-Token:PRIVATE
X-Plex-Username:jackandjohn
X-Plex-Version:2.2.4
Response Headersview source
Access-Control-Allow-Origin:*
Access-Control-Expose-Headers:Location
Cache-Control:no-cache
Connection:close
Content-Length:0
Content-Type:text/html
X-Plex-Protocol:1.0
It looks like the basics for PseudoTV would be:
- Grab a list of items that are going to be in the playlist, keeping track of the ID of each item
- Wipe the current Playlist, since it would contain an old schedule ( http://server:32400/playlists/PseudoTVPlaylistID , Request method DELETE )
- Recreate the playlist, and populate it with the current schedule ( http://server:32400/playlists/PseudoTVPlaylistID/items?uri=library%3A%2F%2FPRIVATE%2Fitem%2F%252Flibrary%252Fmetadata%252FItemID , Request method PUT )