So, I’m trying to make a channel that will read playlists and allow them to be seen from DLNA clients. I’m not a programmer by trade, so I’m mucking around from bundle examples. I was able to extract the url from plex, but the VideoObject creation is confusing and fails with the no serviceinfo error. I dont understand the serviceinfo portion and I was curious if I could make it work without one since the urls are local to my plex server. Anyone have suggestions or can explain what I’m missing?
SHOW_LIST = 'http://192.168.1.70:32400/playlists'
EPISODE_LIST = 'http://192.168.1.70:32400/playlists/%s/items'
BASE_URL = 'http://192.168.1.70:32400'
PREFIX = '/video/dlnaplaylist/'
def Start():
ObjectContainer.title1 = 'DLNA Playlist'
####################################################################################################
@handler(PREFIX, 'DLNA Playlist')
def MainMenu():
oc = ObjectContainer()
xmlobj = XML.ElementFromURL(SHOW_LIST)
Log.Debug("Enumberating Objects")
for playlist in xmlobj.xpath("//Playlist"):
id = playlist.xpath("@ratingKey")[0]
title = playlist.xpath("@title")[0]
Log.Debug(title)
oc.add(DirectoryObject(
key = Callback(Episodes, id=id, title=title),
title = title
))
return oc
@route(PREFIX + 'episodes')
def Episodes(id, title):
oc = ObjectContainer(title2=title)
xmlobj = XML.ElementFromURL(SHOW_LIST + "/" + id + "/items")
Log.Debug(SHOW_LIST + "/" + id + "/items")
for episode in xmlobj.xpath("//Video"):
title = title + " " + episode.xpath("@title")[0]
for media in episode.xpath("//Media"):
for part in media.xpath("//Part"):
url = BASE_URL + part.xpath("@key")[0]
oc.add(VideoObject(
url = url,
title = title
))
return oc