Hello all,
I am creating a channel for http://saiyanwatch.com/
I have populated the menus in the __init__.py and that works
I am having issues with creating a URL service. For some reason I cannot test it using the URL
http://localhost:32400/system/services/url/lookup?url=INSERT_TEST_URL
The url i am using is
http://localhost:32400/system/services/url/lookup?url=http%3A%2F%2Fsaiyanwatch.com%2Fdragonball%2Fdb1%2F
I get a blank screen when doing so.
When i try
http://localhost:32400/:/plugins/com.plexapp.system/serviceTestURLs/com.plexapp.plugins.saiyanwatch
I get
This is my ServiceCode.pys
import redef MetadataObjectForURL(url):
pageContent = HTML.ElementFromURL(url)
title = pageContent.xpath("//meta[@property=‘og:title’]/@content")
return EpisodeObject(
title = title
)def MediaObjectsForURL(url):
return [
MediaObject(
audio_codec = AudioCodec.AAC,
video_codec = VideoCodec.H264,
container = ‘mp4’,
parts = [PartObject(key=Callback(PlayVideo, url=url))])]def NormalizeURL(url):
return url@indirect
def PlayVideo(url):
Log(url)
BASE_URL = "http://saiyanwatch.com/wp-admin/admin-ajax.php?"
URL_ACTION = “action=outofthebox-getplaylist&”
URL_SORT = “lastpath=%2F&sort=name%3Aasc&”tokenRegex = "data-token=\\'[a-z,0-9]*\\'" jsonRegex = "var\soutofthebox_vars\s=\s{.*}" pageContent = HTTP.Request(url).content token = re.search(tokenRegex, pageContent, re.IGNORECASE).group()[11:].replace("'", "").strip() jsonVar = re.search(jsonRegex, pageContent, re.IGNORECASE).group()[23:].strip() jsonObj = JSON.ObjectFromString(jsonVar) nonce = jsonObj["getplaylist_nonce"] fileUrl = BASE_URL + URL_ACTION + URL_SORT + "listtoken=" + token + "&_ajax_nonce=" + nonce videoObj = JSON.ObjectFromString(HTTP.Request(fileUrl).content[1:-1]) finalVidUrl = videoObj["m4v"] return IndirectResponse(VideoClipObject, key=finalVidUrl)def TestURLs():
test_urls =
test_urls.append(“http://saiyanwatch.com/dragonball/db1/”)
test_urls.append(“http://saiyanwatch.com/dragonball/db3/”)
return test_urls
This is my ServiceInfo.plist
<?xml version="1.0" encoding="UTF-8"?>
URL
SaiyanWatch
URLPatterns
http://([^.]+.)?saiyanwatch.com/.+
TestURLs
http://saiyanwatch.com/dragonball/db2/
My directories:
Contents > Services > ServiceInfo.plist
Contents > Services > URL > SaiyanWatch > ServiceCode.pys