1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
# -*- coding: utf-8 -*-
import xbmc
import xbmcgui
import xbmcplugin
class Items:
def __init__(self, plugin):
self.cache = True
self.video = False
self.plugin = plugin
def list_items(self, focus=False, upd=False):
if self.video:
xbmcplugin.setContent(self.plugin.addon_handle, self.plugin.content)
xbmcplugin.endOfDirectory(self.plugin.addon_handle, cacheToDisc=self.cache, updateListing=upd)
if self.plugin.force_view:
xbmc.executebuiltin('Container.SetViewMode({0})'.format(self.plugin.view_id))
if focus:
try:
wnd = xbmcgui.Window(xbmcgui.getCurrentWindowId())
wnd.getControl(wnd.getFocusId()).selectItem(focus)
except:
pass
def add_item(self, item):
data = {
'mode': item['mode'],
'title': item['title'],
'id': item.get('id', ''),
'params': item.get('params','')
}
art = {
'thumb': item.get('thumb', self.plugin.addon_icon),
'poster': item.get('thumb', self.plugin.addon_icon),
'fanart': item.get('fanart', self.plugin.addon_fanart)
}
labels = {
'title': item['title'],
'plot': item.get('plot', item['title']),
'premiered': item.get('date', ''),
'episode': item.get('episode', 0)
}
listitem = xbmcgui.ListItem(item['title'])
listitem.setArt(art)
listitem.setInfo(type='Video', infoLabels=labels)
if 'play' in item['mode']:
self.cache = False
self.video = True
folder = False
listitem.addStreamInfo('video', {'duration':item.get('duration', 0)})
listitem.setProperty('IsPlayable', 'true')
else:
folder = True
if item.get('cm', None):
listitem.addContextMenuItems( item['cm'] )
xbmcplugin.addDirectoryItem(self.plugin.addon_handle, self.plugin.build_url(data), listitem, folder)
def play_item(self, item, name, context):
path = item.ManifestUrl
listitem = xbmcgui.ListItem()
listitem.setContentLookup(False)
listitem.setMimeType('application/dash+xml')
listitem.setProperty('inputstreamaddon', 'inputstream.adaptive')
listitem.setProperty('inputstream.adaptive.manifest_type', 'mpd')
listitem.setProperty('inputstream.adaptive.license_type', 'com.widevine.alpha')
listitem.setProperty('inputstream.adaptive.license_key', item.LaUrl+'&_widevineChallenge=B{SSM}|||JBlicense')
if context:
listitem.setInfo('video', {'Title': name})
xbmc.Player().play(path, listitem)
else:
listitem.setPath(path)
xbmcplugin.setResolvedUrl(self.plugin.addon_handle, True, listitem)
|