|
| 1 | +import sys |
| 2 | +import xbmcgui |
| 3 | +import xbmcplugin |
| 4 | +import urlparse |
| 5 | +import resources.lib.liveTv as liveTv |
| 6 | +import resources.lib.common as common |
| 7 | +import resources.lib.vod as vod |
| 8 | +from skygo import SkyGo |
| 9 | + |
| 10 | + |
| 11 | +addon_handle = int(sys.argv[1]) |
| 12 | +plugin_base_url = sys.argv[0] |
| 13 | +params = dict(urlparse.parse_qsl(sys.argv[2][1:])) |
| 14 | + |
| 15 | + |
| 16 | +def landing(): |
| 17 | + skygo = SkyGo() |
| 18 | + landing_page = skygo.getLandingPage() |
| 19 | + |
| 20 | + keys = ['box_listing', 'listing'] |
| 21 | + |
| 22 | + for key in keys: |
| 23 | + if key in landing_page: |
| 24 | + for item in landing_page[key]['item']: |
| 25 | + url = common.build_url({'action': 'listing', 'path': item['path']}) |
| 26 | + |
| 27 | + # Skip Sport stuff for now |
| 28 | + if item['title'] == 'Sport': |
| 29 | + continue |
| 30 | + |
| 31 | + li = xbmcgui.ListItem(item['title']) |
| 32 | + xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, |
| 33 | + listitem=li, isFolder=True) |
| 34 | + |
| 35 | + url = common.build_url({'action': 'listLiveTvChannels'}) |
| 36 | + li = xbmcgui.ListItem('Live TV') |
| 37 | + li.setProperty('IsPlayable', 'false') |
| 38 | + xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, |
| 39 | + listitem=li, isFolder=True) |
| 40 | + xbmcplugin.endOfDirectory(addon_handle, cacheToDisc=True) |
| 41 | + |
| 42 | + |
| 43 | +# Router for all plugin actions |
| 44 | +if params: |
| 45 | + if params['action'] == 'playVod': |
| 46 | + vod.play_vod(params['vod_id']) |
| 47 | + |
| 48 | + elif params['action'] == 'listLiveTvChannels': |
| 49 | + liveTv.generate_channel_list() |
| 50 | + |
| 51 | + elif params['action'] == 'playLiveTvChannel': |
| 52 | + liveTv.play_live_tv(params['epg_channel_id']) |
| 53 | + |
| 54 | + elif params['action'] == 'listing': |
| 55 | + vod.list_dir(params['path']) |
| 56 | + |
| 57 | + elif params['action'] == 'listSeries': |
| 58 | + vod.list_series(params['series_id']) |
| 59 | +else: |
| 60 | + landing() |
0 commit comments