suggestions and pointers needed please

Hi,

 

I have attempted to write a few plex channels, some are successfully while some are not.  I have a few plugins in wrote for XBMC and would like to port it over to plex.  However, I am running into this one peculiar issue for one of the channel.  Whenever I click Play Video from the Roku app to play a video from the channel, it would load and 2-3 seconds later, return me to the Roku's menu (where you select play video) again, clicking on play video again causes it to wait there and will fail shortly there after.  The log doesn't indicate show any errors or issues.

 

Pseudo code of how I am adding in the content

@route(PREFIX + “/CreateContentObject”)
def CreateContentObject(id, name, desc, image, banner, include_container = False):
v = VideoClipObject(
key = Callback(CreateContentObject, id= id, name = name, desc = desc, image = image, banner = banner, include_container=True),
rating_key = url,
title = name,
summary = desc,
thumb = Resource.ContentsOfURLWithFallback(url=image, fallback=ICON),
banner = banner,
items = [MediaObject(parts = [PartObject(key=Callback(PlayVideo, id= id))])]
)
if include_container:
return ObjectContainer(objects=[v])
return v

@indirect
@route(PREFIX + “/PlayVideo”)
def PlayVideo(id):
#make xml request here and pass in id
#get response which contains a link to a m3u8 file
url = …
return IndirectResponse(VideoClipObject, key=HTTPLiveStreamURL(url))

@handler(PREFIX, NAME, ICON)
def MainMenu():
channels = XML.ElementFromURL(CHANNELS_URL, cacheTime = CACHE_1DAY)
oc = ObjectContainer()
for c in channels.iter(“channel”):
if c.attrib[‘view_count’] > 0:
id = c.attrib[‘id’]
name = c.find(‘name’).text
desc = c.find(‘short_description’).text
image = c.find(‘image’).text
banner = c.find(‘banner’).text
oc.add(CreateContentObject(id, name, desc, image, banner, False))
if len(oc) < 1:
return ObjectContainer(header=“Empty”, message=“No channels available.”)
return oc 

Can you guys spot anything wrong with what I am doing?  It is kind of frustrating because the same idea with PlayVideo method that I have for other channels seems to work fine.  Are there anything that I can do better?  When I get the URL to the m3u8, i have a few links for various bitrate, how does one add the different bitrates so that it is selectable?

 

BONUS Question --- is it possible to do have python add directly to the Plex Library via plex api?  I am thinking

1. write python service that runs every now and then

2. grab data from server

3. import data into Plex Library - for example, Movie, desc, thumb, url to the movie (well, up to the id part)

4. create URL service that looks for some pattern of the url in step 3

5. URL service will take the ID and look up the final url to the m3u8

6. Plex play the video

 

this way, I can just goto the Library section and see all the movies in there...

 

I don't see any specific issues with the code you're using. I would suggest:

  1. Checking the Roku client logs to see why it's failing playback (don't ask me how to get them, not my area of expertise  B) ).
  2. Try testing with a different client and compare behaviour/logs. I would suggest testing with PHT as a good baseline. The /Web client is also convenient although not generally the best choice for primary test candidate.
  3. If 1 & 2 fail to illuminate the issue, post a link to your code for more eyes to review it.

Regarding the "bonus" question:

I believe it is possible to write a python script (or even Plex plugin) to add content to the Plex library. That being said, the library is not currently set up to handle online/channel content. As such, attempting to add online content would, at best, not work or, at worst, cause any manner of unpredictable nastiness. If the m3u8 files are hosted locally, just like other local content (be they mkv, mp4, or other) then it could conceivably work but the URL Service would be irrelevant.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.