From 32185e177496185ac15830e93d295a2f2e596bdf Mon Sep 17 00:00:00 2001 From: Eric Date: Wed, 27 Dec 2017 08:54:29 -0500 Subject: [plugin.video.crackle] 2017.3.24 --- plugin.video.crackle/resources/__init__.py | 1 + .../language/resource.language.en_gb/strings.po | 53 ++++++ plugin.video.crackle/resources/lib/__init__.py | 1 + plugin.video.crackle/resources/lib/globals.py | 199 +++++++++++++++++++++ plugin.video.crackle/resources/media/fanart.jpg | Bin 0 -> 59584 bytes plugin.video.crackle/resources/media/icon.png | Bin 0 -> 72923 bytes plugin.video.crackle/resources/settings.xml | 9 + 7 files changed, 263 insertions(+) create mode 100644 plugin.video.crackle/resources/__init__.py create mode 100644 plugin.video.crackle/resources/language/resource.language.en_gb/strings.po create mode 100644 plugin.video.crackle/resources/lib/__init__.py create mode 100644 plugin.video.crackle/resources/lib/globals.py create mode 100644 plugin.video.crackle/resources/media/fanart.jpg create mode 100644 plugin.video.crackle/resources/media/icon.png create mode 100644 plugin.video.crackle/resources/settings.xml (limited to 'plugin.video.crackle/resources') diff --git a/plugin.video.crackle/resources/__init__.py b/plugin.video.crackle/resources/__init__.py new file mode 100644 index 0000000..2b620f6 --- /dev/null +++ b/plugin.video.crackle/resources/__init__.py @@ -0,0 +1 @@ +# dummy file to init directory \ No newline at end of file diff --git a/plugin.video.crackle/resources/language/resource.language.en_gb/strings.po b/plugin.video.crackle/resources/language/resource.language.en_gb/strings.po new file mode 100644 index 0000000..894481f --- /dev/null +++ b/plugin.video.crackle/resources/language/resource.language.en_gb/strings.po @@ -0,0 +1,53 @@ +# Kodi Media Center language file +# Addon Name: Simpsons World +# Addon id: plugin.video.simpsonsworld +# Addon Provider: eracknaphobia +msgid "" +msgstr "" +"Project-Id-Version: Kodi Addons\n" +"Report-Msgid-Bugs-To: alanwww1@xbmc.org\n" +"POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: Kodi Translation Team\n" +"Language-Team: English (http://www.transifex.com/projects/p/xbmc-addons/language/en/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: en\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +msgctxt "#30000" +msgid "The Simpsons" +msgstr "" + +msgctxt "#30001" +msgid "General" +msgstr "" + +msgctxt "#30002" +msgid "Comedy" +msgstr "" + +msgctxt "#30010" +msgid "Screen Ratio" +msgstr "" + +msgctxt "#30020" +msgid "Audio Commentary" +msgstr "" + +msgctxt "#30900" +msgid "Deauthorizie Device" +msgstr "" + +msgctxt "#30901" +msgid "This device has been succesfully deauthorized." +msgstr "" + +msgctxt "#30910" +msgid "Your device is not currently authorized to view the selected content.\n Would you like to authorize this device now?" +msgstr "" + +msgctxt "#30911" +msgid "Device Not Authorized" +msgstr "" \ No newline at end of file diff --git a/plugin.video.crackle/resources/lib/__init__.py b/plugin.video.crackle/resources/lib/__init__.py new file mode 100644 index 0000000..2b620f6 --- /dev/null +++ b/plugin.video.crackle/resources/lib/__init__.py @@ -0,0 +1 @@ +# dummy file to init directory \ No newline at end of file diff --git a/plugin.video.crackle/resources/lib/globals.py b/plugin.video.crackle/resources/lib/globals.py new file mode 100644 index 0000000..db70140 --- /dev/null +++ b/plugin.video.crackle/resources/lib/globals.py @@ -0,0 +1,199 @@ +import sys, os +import xbmc, xbmcplugin, xbmcgui, xbmcaddon +import urllib, urllib2 +import json +import base64, hmac, hashlib +from datetime import datetime + +addon_handle = int(sys.argv[1]) +ADDON = xbmcaddon.Addon() +ROOTDIR = ADDON.getAddonInfo('path') +FANART = ROOTDIR+"/resources/media/fanart.jpg" +ICON = os.path.join(ROOTDIR,"/resources/media/icon.png") + + +#Addon Settings +LOCAL_STRING = ADDON.getLocalizedString +UA_CRACKLE = 'Crackle/7.60 CFNetwork/808.3 Darwin/16.3.0' +UA_WEB = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.110 Safari/537.36' +UA_ANDROID = 'Android 4.1.1; E270BSA; Crackle 4.4.5.0' +PRIVATE_KEY = 'MIRNPSEZYDAQASLX' +VENDOR_ID = '25' +BASE_URL = 'http://android-tv-api-us.crackle.com/Service.svc' + + +def mainMenu(): + addDir('Movies','/movies',101,ICON) + addDir('TV','/tv',100,ICON) + + +def listMovies(): + url = '/browse/movies/full/all/alpha-asc/US' + url += '?pageSize=500' + url += '&pageNumber=1' + url += '&format=json' + json_source = jsonRequest(url) + + + for movie in json_source['Entries']: + title = movie['Title'] + url = str(movie['ID']) + icon = movie['ChannelArtTileLarge'] + fanart = movie['Images']['Img_1920x1080'] + info = None + info = {'plot':movie['Description'], + 'genre':movie['Genre'], + 'year':movie['ReleaseYear'], + 'mpaa':movie['Rating'], + 'title':title, + 'originaltitle':title, + 'duration':movie['DurationInSeconds'] + } + + addStream(title,url,'movies',icon,fanart,info) + + + +def listShows(): + url = '/browse/shows/full/all/alpha-asc/US' + url += '?pageSize=500' + url += '&pageNumber=1' + url += '&format=json' + json_source = jsonRequest(url) + + for show in json_source['Entries']: + title = show['Title'] + url = str(show['ID']) + icon = show['ChannelArtTileLarge'] + fanart = show['Images']['Img_1920x1080'] + info = None + info = {'plot':show['Description'], + 'genre':show['Genre'], + 'year':show['ReleaseYear'], + 'mpaa':show['Rating'], + 'title':title, + 'originaltitle':title, + 'duration':show['DurationInSeconds'] + } + + addDir(title,url,102,icon,fanart,info) + + +def getEpisodes(channel): + url = '/channel/'+channel+'/playlists/all/US?format=json' + json_source = jsonRequest(url) + + for episode in json_source['Playlists'][0]['Items']: + episode = episode['MediaInfo'] + title = episode['Title'] + id = str(episode['Id']) + icon = episode['Images']['Img_460x460'] + fanart = episode['Images']['Img_1920x1080'] + info = None + info = {'plot':episode['Description'], + #'genre':episode['Genre'], + 'year':episode['ReleaseYear'], + 'mpaa':episode['Rating'], + 'title':title, + 'originaltitle':title, + 'duration':episode['Duration'], + 'season':episode['Season'], + 'episode':episode['Episode'] + } + + addStream(title,id,'tvshows',icon,fanart,info) + + +def getMovieID(channel): + url = '/channel/'+str(channel)+'/playlists/all/US?format=json' + json_source = jsonRequest(url) + + return str(json_source['Playlists'][0]['Items'][0]['MediaInfo']['Id']) + + +def getStream(id): + url = '/details/media/'+id+'/US?format=json' + json_source = jsonRequest(url) + + + for stream in json_source['MediaURLs']: + if 'AppleTV' in stream['Type']: + stream_url = stream['Path'] + stream_url = stream_url[0:stream_url.index('.m3u8')]+'.m3u8' + break + + stream_url += '|User-Agent='+UA_CRACKLE + listitem = xbmcgui.ListItem(path=stream_url) + xbmcplugin.setResolvedUrl(addon_handle, True, listitem) + + +def jsonRequest(url): + url = BASE_URL + url + req = urllib2.Request(url) + req.add_header("Connection", "keep-alive") + req.add_header("User-Agent", UA_ANDROID) + req.add_header("Authorization", getAuth(url)) + + response = urllib2.urlopen(req) + json_source = json.load(response) + response.close() + + return json_source + + +def calcHmac(src): + return hmac.new(PRIVATE_KEY, src, hashlib.md5).hexdigest() + + +def getAuth(url): + timestamp = datetime.utcnow().strftime('%Y%m%d%H%M') + encoded_url = str(calcHmac(url+"|"+timestamp)).upper() + "|" + timestamp + "|" + VENDOR_ID + xbmc.log(encoded_url) + + return encoded_url + + +def addStream(name, id, stream_type, icon,fanart,info=None): + ok=True + u=sys.argv[0]+"?id="+urllib.quote_plus(id)+"&mode="+str(103)+"&type="+urllib.quote_plus(stream_type) + liz=xbmcgui.ListItem(name) + liz.setArt({'icon': ICON, 'thumb': icon, 'fanart': fanart}) + liz.setProperty("IsPlayable", "true") + liz.setInfo( type="Video", infoLabels={ "Title": name } ) + if info != None: + liz.setInfo( type="Video", infoLabels=info) + ok=xbmcplugin.addDirectoryItem(handle=addon_handle,url=u,listitem=liz,isFolder=False) + xbmcplugin.setContent(addon_handle, stream_type) + return ok + + +def addDir(name,id,mode,iconimage,fanart=None,info=None): + params = get_params() + ok=True + u=sys.argv[0]+"?id="+urllib.quote_plus(id)+"&mode="+str(mode) + liz=xbmcgui.ListItem(name) + liz.setArt({'icon': ICON, 'thumb': iconimage, 'fanart': fanart}) + if info != None: + liz.setInfo( type="Video", infoLabels=info) + ok=xbmcplugin.addDirectoryItem(handle=addon_handle,url=u,listitem=liz,isFolder=True) + xbmcplugin.setContent(addon_handle, 'tvshows') + return ok + + +def get_params(): + param=[] + paramstring=sys.argv[2] + if len(paramstring)>=2: + params=sys.argv[2] + cleanedparams=params.replace('?','') + if (params[len(params)-1]=='/'): + params=params[0:len(params)-2] + pairsofparams=cleanedparams.split('&') + param={} + for i in range(len(pairsofparams)): + splitparams={} + splitparams=pairsofparams[i].split('=') + if (len(splitparams))==2: + param[splitparams[0]]=splitparams[1] + + return param \ No newline at end of file diff --git a/plugin.video.crackle/resources/media/fanart.jpg b/plugin.video.crackle/resources/media/fanart.jpg new file mode 100644 index 0000000..5218a0b Binary files /dev/null and b/plugin.video.crackle/resources/media/fanart.jpg differ diff --git a/plugin.video.crackle/resources/media/icon.png b/plugin.video.crackle/resources/media/icon.png new file mode 100644 index 0000000..451f07f Binary files /dev/null and b/plugin.video.crackle/resources/media/icon.png differ diff --git a/plugin.video.crackle/resources/settings.xml b/plugin.video.crackle/resources/settings.xml new file mode 100644 index 0000000..cf86ce6 --- /dev/null +++ b/plugin.video.crackle/resources/settings.xml @@ -0,0 +1,9 @@ + + + + + + + + + -- cgit v1.2.3