diff options
author | learningit <scottyroscoe13@gmail.com> | 2017-03-06 17:41:34 -0500 |
---|---|---|
committer | enen92 <enen92@users.noreply.github.com> | 2017-03-06 22:41:34 +0000 |
commit | 2dc38610cf27c560611005f29101ce88042a7404 (patch) | |
tree | 0eacf7b956160627daddde85dbfe7d145f60251b /plugin.video.charge/resources/lib | |
parent | e57c445d948a15db790027324bf7d28430dfe9b8 (diff) |
[plugin.video.charge] 3.0.1 (#1024)
[plugin.video.charge] 3.0.1
Diffstat (limited to 'plugin.video.charge/resources/lib')
-rw-r--r-- | plugin.video.charge/resources/lib/__init__.py | 1 | ||||
-rw-r--r-- | plugin.video.charge/resources/lib/scraper.py | 55 |
2 files changed, 56 insertions, 0 deletions
diff --git a/plugin.video.charge/resources/lib/__init__.py b/plugin.video.charge/resources/lib/__init__.py new file mode 100644 index 0000000..7986681 --- /dev/null +++ b/plugin.video.charge/resources/lib/__init__.py @@ -0,0 +1 @@ +__author__ = 't1m' diff --git a/plugin.video.charge/resources/lib/scraper.py b/plugin.video.charge/resources/lib/scraper.py new file mode 100644 index 0000000..b3e1116 --- /dev/null +++ b/plugin.video.charge/resources/lib/scraper.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +# KodiAddon (Charge! TV Live) +# +from t1mlib import t1mAddon +import json +import re +import urllib +import xbmcplugin +import xbmcgui +import calendar +import datetime +import sys + +UTF8 = 'utf-8' + +class myAddon(t1mAddon): + + def getAddonMenu(self,url,ilist): + xbmcplugin.setContent(int(sys.argv[1]), 'episodes') + html = self.getRequest('http://watchcharge.com/watch-live/') + print "html = "+str(html) + url = re.compile('file: "(.+?)"', re.DOTALL).search(html).group(1) + thumb = self.addonIcon + fanart = self.addonFanart + d = datetime.datetime.utcnow() + now = calendar.timegm(d.utctimetuple()) + html = self.getRequest('http://mobilelistings.tvguide.com/Listingsweb/ws/rest/airings/20517/start/'+str(now)+'/duration/20160?channelsourceids=34067%7C43.2&formattype=json') + a = json.loads(html) + for b in a[:10]: + infoList = {} + b = b['ProgramSchedule'] + st = datetime.datetime.fromtimestamp(float(b['StartTime'])).strftime('%H:%M') + et = datetime.datetime.fromtimestamp(float(b['EndTime'])).strftime('%H:%M') + infoList['duration'] = int(float(b['EndTime']) - float(b['StartTime'])) + name = b['Title'] + if b['EpisodeTitle'] != '': + infoList['TVShowTitle'] = name + season = b['TVObject'].get('SeasonNumber') + if season is not None: + infoList['Season'] = int(season) + episode = b['TVObject']['EpisodeNumber'] + if episode is not None: + infoList['Episode'] = int(episode) + plot = '%s - %s %s min.[CR][COLOR blue]%s[/COLOR][CR]%s' % (st, et, infoList['duration'] / 60, b['EpisodeTitle'], b['CopyText']) + infoList['Plot'] = plot + infoList['MPAA'] = b.get('Rating') + infoList['mediatype'] = 'episode' + ilist = self.addMenuItem(name,'GV', ilist, url, thumb, fanart, infoList, isFolder=False) + return(ilist) + + def getAddonVideo(self,url): + liz = xbmcgui.ListItem(path = url) + xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, liz) + + |