Have to hit enter 2 times before video plays using Callback()

Hi. I had my addon working under linux with what was obviously older verison of plexhometheater. Now with the latest version both windows or linux I am having this problem.

 

I select the video to be played like this.

 

![post-184624-0-51582300-1386721032.png|690x388](upload://gto4PE1NJhG4XFCO6rAJpo69pvp.png)

 

 

Then after hitting enter i get a screen like this.

 

![post-184624-0-74062300-1386721034.png|690x388](upload://jAbDhKyliDUycU3RLPlkcvYKp9g.png)

 

 

Then if i hit enter again the video will play. Does anyone have any idea what is happening here?

The relevant code i am using is as such.


oc.add(VideoClipObject(
key = Callback(GETSOURCE, url = url),
rating_key = url,
title = name +’ - ‘+ description +’ (’+date+’)’,
thumb = thumbnail,
items = [
MediaObject(
container = Container.MP4,
video_codec = VideoCodec.H264,
audio_codec = AudioCodec.AAC,
audio_channels = 2,
parts = [PartObject(key = Callback(GETSOURCE, url = url))]
)
]
))

################################################################################
@indirect
def GETSOURCE(url):
link=HTTP.Request(url).content
url=re.compile(’“is_source”:true,“file_size”:.+?,“audio_codec”:".+?",“video_codec”:".+?",“average_video_bitrate”:.+?,“stream_type”:“single”,“url”:"(.+?)"’).findall(link)
url = url[0]
url = url.replace(’\’, ‘’)
return IndirectResponse(VideoClipObject, key = url)

Also the addon does not work with Plex/Web. When i click play on a video i get "  :(  This channel is currently unavailable"

 

Any help would be greatly appreciated. Thank You.

The Callback used for the key of the PartObject should not be the same as the one used for the key of the VideoClipObject.

Take a look at how the Tagesschau channel implements the CreateVideoClipObject() Callback. In your case, the way you are using the GETSOURCE() function, it looks similar to what is commonly implemented as PlayVideo(). The name isn't really important but what I would suggest is keep that code as it is, and leave the callback in place for the key of the PartObject. Then rework the callback for the key of the VideoClipObject using the above link as an example.

Two other comments;

  1. Based on your code, it looks like using an URL Service would really simplify things for you, with the added benefit that the URL Service could then be used to support the myPlex PlexIt bookmarklet.
  2. There is no need to import re for regex manipulation. The plugin framework includes support for it. Define your pattern at the top of the code 
    RE_URL = Regex('my fancy long regex pattern to find the (url)')
    

    Then reference it later in the code

    url = RE_URL.findall(string_to_search)
    

    It also works with .match() and .search().

I've made a note to myself to add the Regex() details to the list of stuff missing from the official docs.

Thanks for your response. Using what you said i was able to get the web interface to play videos. But i am getting the same result in the desktop client. It appears that for whatever reason the interface before playing the video is not showing up, maybe I am not providing the proper info? This is the page that doesn't show up for me.

![post-184624-0-17236300-1387218583.png|690x388](upload://aCXNJ7CGnWP0HvrogDNFbglcZXu.png)

Obviously the client is on that page because if i hit enter, as i said before, the video will play. I installed a few other addons and I came across another with the same problem, the "Daily Seinfeld" addon does the exact same thing as mine. Possibly something wrong with the latest build?

Thanks for your response. Using what you said i was able to get the web interface to play videos. But i am getting the same result in the desktop client. It appears that for whatever reason the interface before playing the video is not showing up, maybe I am not providing the proper info? This is the page that doesn't show up for me.

{style_image_url}/attachicon.gif img3.png

Obviously the client is on that page because if i hit enter, as i said before, the video will play. I installed a few other addons and I came across another with the same problem, the "Daily Seinfeld" addon does the exact same thing as mine. Possibly something wrong with the latest build?

It could be a client issue. If you've implemented the code properly and it behaves properly in other client(s), it's reasonable to think that's the case.

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