本文整理汇总了Python中resources.lib.libraries.control.item函数的典型用法代码示例。如果您正苦于以下问题:Python item函数的具体用法?Python item怎么用?Python item使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了item函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
def run(self, content, name, url, year, imdb, tvdb, meta):
if control.window.getProperty('PseudoTVRunning') == 'True':
return control.player.play(url, control.item(path=url))
self.getVideoInfo(content, name, year, imdb, tvdb)
if self.folderPath.startswith('plugin://') and not meta == None:
poster, thumb, meta = self.getMeta(meta)
else:
poster, thumb, meta = self.getLibraryMeta()
item = control.item(path=url, iconImage='DefaultVideo.png', thumbnailImage=thumb)
item.setInfo(type='Video', infoLabels = meta)
try: item.setArt({'poster': poster, 'tvshow.poster': poster, 'season.poster': poster})
except: pass
item.setProperty('Video', 'true')
item.setProperty('IsPlayable', 'true')
control.player.play(url, item)
for i in range(0, 240):
if self.isPlayingVideo(): break
xbmc.sleep(1000)
while self.isPlayingVideo():
try: self.totalTime = self.getTotalTime()
except: pass
try: self.currentTime = self.getTime()
except: pass
xbmc.sleep(1000)
control.window.clearProperty('script.trakt.ids')
time.sleep(5)
示例2: run
def run(self, url, selectGame ,side):
if selectGame == None or side == None:
return control.resolve(int(sys.argv[1]), True, control.item(path=url))
command = ['java','-jar',jarFile,selectGame,side]
startupinfo = None
if os.name == 'nt':
startupinfo = subprocess.STARTUPINFO()
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
self.process = subprocess.Popen(command,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
startupinfo=startupinfo)
if os.name == 'posix':
success = False
success, output = FuckNeulionClient.request_proxy_hack(selectGame,side)
control.sleep(1000)
control.resolve(int(sys.argv[1]), True, control.item(path=url))
for i in range(0, 240):
if self.isPlayingVideo(): break
control.sleep(1000)
while self.isPlayingVideo():
control.sleep(1000)
control.sleep(5000)
示例3: listShows
def listShows(self, catid, page):
limatch = []
url = self.shows_link % (catid)
try: result = client.request(url)
except: pass
pageContent = ''.join(result.splitlines()).replace('\'','"')
pages = re.compile('id="a_page_(.+?)" href').findall(pageContent)
if str(page) in pages:
pageUrl = self.shows_ajax_link % (catid, str(page))
result = client.request(pageUrl)
limatch+=re.compile('<figure>(.+?)</a></li>').findall(result)
for li_content in limatch:
show = re.compile('<a href=".+?id=(.+?)"><img src="(.+?)" alt="(.+?)" w').findall(li_content)
#print show
title = show[0][2].decode('iso-8859-11')
showid = show[0][0]
image = show[0][1]
self.list.append({'name': title, 'showid': showid, 'image': image})
for show in self.list:
name = show['name'].encode('utf-8')
showid = show['showid']
image = show['image']
action = 'listEpisodes'
query = '?action=%s&name=%s&catid=%s&showid=%s&image=%s' % (action, name, catid, showid, image)
url = '%s%s' % (sysaddon, query)
item = control.item(name, iconImage=image, thumbnailImage=image)
if not addonFanart == None: item.setProperty('Fanart_Image', addonFanart)
item.setInfo(type="Video", infoLabels={"Title": name, "OriginalTitle": name})
control.addItem(handle=int(sys.argv[1]), url=url, listitem=item, isFolder=True)
nextPage = int(page) + 1
if nextPage <= len(pages):
if 'first' in pages:
pages.remove('first')
if 'pre' in pages:
pages.remove('pre')
if 'next' in pages:
pages.remove('next')
if 'last' in pages:
pages.remove('last')
for page in pages:
action = 'listShows'
pageNumber = int(page) + 1
query = '?action=%s&page=%d&name=%s&catid=%s' % (action, int(page), 'Page ' + str(pageNumber), catid)
url = '%s%s' % (sysaddon, query)
item = control.item('Page ' + str(pageNumber), iconImage='', thumbnailImage='')
if not addonFanart == None: item.setProperty('Fanart_Image', addonFanart)
item.setInfo(type="Video", infoLabels={"Title": 'Page ' + str(pageNumber), "OriginalTitle": 'Page ' + str(pageNumber)})
control.addItem(handle=int(sys.argv[1]), url=url, listitem=item, isFolder=True)
control.content(int(sys.argv[1]), 'movies')
if control.skin == 'skin.confluence': control.execute('Container.SetViewMode(500)')
control.directory(int(sys.argv[1]), cacheToDisc=True)
示例4: listEpisodes
def listEpisodes(self, catid, showid, page, image):
url = self.episodes_link % (page, showid)
try: result = client.request(url)
except: pass
link = ''.join(result.splitlines()).replace('\'','"')
link = ''.join(link.splitlines()).replace('<i class="icon-new"></i>','')
episodematch = re.compile('<table class="program-archive">(.+?)</table>').findall(link)
episodes = re.compile('<a href="(.+?)" >(.+?)</a>.+?</td>\t\t\t\t\t\t\t<td> \t\t\t\t\t\t\t\t<a href="(.+?)" ><img').findall(episodematch[0])
programMeta = re.compile('<div class="program-meta">(.+?)</div>').findall(link)
image = re.compile('<img src="(.+?)" alt').findall(programMeta[0])[0]
# episodes per page
for episode in episodes:
name = episode[1].decode('iso-8859-11')
u = 'http://www.seesantv.com/seesantv_2014/' + episode[0] + '&bitrate=high'
self.list.append({'name': name, 'url': urllib.quote_plus(u), 'image': image})
for episode in self.list:
name = episode['name'].encode('utf-8')
url = episode['url']
image = episode['image']
action = 'sourcePage'
query = '?action=%s&image=%s&url=%s&name=%s' % (action, image, url, urllib.quote_plus(name))
url = '%s%s' % (sysaddon, query)
item = control.item(name, iconImage=image, thumbnailImage=image)
if not addonFanart == None: item.setProperty('Fanart_Image', addonFanart)
item.setInfo(type="Video", infoLabels={"Title": name, "OriginalTitle": name})
control.addItem(handle=int(sys.argv[1]), url=url, listitem=item, isFolder=False)
# Pagination
paginator = re.compile('<div class="page_list" align="center">(.+?)</ul>').findall(link)[0]
pages = re.compile('>(\d+)</a>').findall(paginator)
nextPage = int(page) + 1
if nextPage < len(pages):
action = 'listEpisodes'
query = '?action=%s&page=%d&name=%s&catid=%s&showid=%s&image=%s' % (action, nextPage, 'Next Page', catid, showid, image)
url = '%s%s' % (sysaddon, query)
item = control.item('Next Page', iconImage=image, thumbnailImage=image)
if not addonFanart == None: item.setProperty('Fanart_Image', addonFanart)
item.setInfo(type="Video", infoLabels={"Title": 'Next Page', "OriginalTitle": 'Next Page'})
control.addItem(handle=int(sys.argv[1]), url=url, listitem=item, isFolder=True)
control.content(int(sys.argv[1]), 'movies')
if control.skin == 'skin.confluence': control.execute('Container.SetViewMode(50)')
control.directory(int(sys.argv[1]), cacheToDisc=True)
示例5: listEpisodes
def listEpisodes(self, showid, page, image):
url = self.episodes_link % (showid)
try: result = client.request(url)
except: pass
result = re.compile('(.+?)]').findall(result)[0] + ']'
shows = json.loads(result)
self.list.append({'name': '[UPPERCASE][COLOR orange]Try again if a show does not play![/COLOR][/UPPERCASE]', 'url': '', 'image': ''})
# episodes per page
for show in shows:
if 'Not Show' == show['item_title']:
continue
name = show['date_added'] + ' ' + show['item_title']
u = self.player_link % (show['media_id'], show['media_item_id'])
self.list.append({'name': name, 'url': urllib.quote_plus(u), 'image': image})
for episode in self.list:
name = episode['name']
url = episode['url']
image = episode['image']
action = 'sourcePage2'
query = '?action=%s&image=%s&url=%s&name=%s' % (action, image, url, name)
url = '%s%s' % (sysaddon, query)
item = control.item(name, iconImage=image, thumbnailImage=image)
if not addonFanart == None: item.setProperty('Fanart_Image', addonFanart)
item.setInfo(type="Video", infoLabels={"Title": name, "OriginalTitle": name})
control.addItem(handle=int(sys.argv[1]), url=url, listitem=item, isFolder=False)
control.content(int(sys.argv[1]), 'movies')
if control.skin == 'skin.confluence': control.execute('Container.SetViewMode(50)')
control.directory(int(sys.argv[1]), cacheToDisc=True)
示例6: addDirectoryItem
def addDirectoryItem(name, action, thumb, image, fanart, url='0'):
if thumb == '0': thumb = image
u = '%s?action=%s&url=%s&image=%s&fanart=%s' % (sys.argv[0], str(action), urllib.quote_plus(url), urllib.quote_plus(thumb), urllib.quote_plus(fanart))
item = control.item(name, iconImage=thumb, thumbnailImage=thumb)
item.addContextMenuItems([], replaceItems=False)
item.setProperty('Fanart_Image', fanart)
control.addItem(handle=int(sys.argv[1]),url=u,listitem=item,isFolder=True)
示例7: addDirectory
def addDirectory(self, items):
if items == None or len(items) == 0: return
sysaddon = sys.argv[0]
addonFanart = control.addonFanart()
addonThumb = control.addonThumb()
artPath = control.artPath()
for i in items:
try:
try: name = control.lang(i['name']).encode('utf-8')
except: name = i['name']
if not artPath == None: thumb = os.path.join(artPath, i['image'])
else: thumb = addonThumb
url = '%s?action=%s' % (sysaddon, i['action'])
try: url += '&url=%s' % urllib.quote_plus(i['url'])
except: pass
item = control.item(label=name, iconImage=thumb, thumbnailImage=thumb)
item.addContextMenuItems([], replaceItems=False)
if not addonFanart == None: item.setProperty('Fanart_Image', addonFanart)
control.addItem(handle=int(sys.argv[1]), url=url, listitem=item, isFolder=True)
except:
pass
control.directory(int(sys.argv[1]), cacheToDisc=True)
示例8: alterSources
def alterSources(self, url, meta):
try:
setting = control.setting('autoplay')
if setting == 'false': url += '&url=direct://'
else: url += '&url=dialog://'
meta = json.loads(meta)
poster = meta['poster'] if 'poster' in meta else '0'
banner = meta['banner'] if 'banner' in meta else '0'
thumb = meta['thumb'] if 'thumb' in meta else poster
fanart = meta['fanart'] if 'fanart' in meta else '0'
if poster == '0': poster = control.addonPoster()
if banner == '0' and poster == '0': banner = control.addonBanner()
elif banner == '0': banner = poster
if thumb == '0' and fanart == '0': thumb = control.addonFanart()
elif thumb == '0': thumb = fanart
playlist = control.playlist
playlist.clear()
item = control.item(label='', iconImage=thumb, thumbnailImage=thumb)
try: item.setArt({'poster': poster, 'tvshow.poster': poster, 'season.poster': poster, 'banner': banner, 'tvshow.banner': banner, 'season.banner': banner})
except: pass
item.setInfo(type='Video', infoLabels = meta)
item.setProperty('Video', 'true')
item.setProperty('IsPlayable', 'true')
control.player.play(url, item)
except:
pass
示例9: addCategoryItem
def addCategoryItem(name, action, image, isFolder=True):
u = sys.argv[0]+"?action="+str(action)
image = control.addonInfo('path') + '/art/' + image
item = control.item(name, iconImage=image, thumbnailImage=image)
item.addContextMenuItems([], replaceItems=False)
item.setProperty('Fanart_Image', control.addonInfo('fanart'))
control.addItem(handle=int(sys.argv[1]),url=u,listitem=item,isFolder=isFolder)
示例10: sourcePage
def sourcePage(self, url, name, image):
cookie = 'view_server_name=%s; member_id=%d' % (self.view_server_name, self.member_id)
try: result = client.request(url, cookie=cookie)
except: pass
videoUrl = re.compile('file: "(.+?)"').findall(result)[0]
videoUrl = videoUrl.replace('us88', self.replace_server)
videoUrl = videoUrl.replace('http://.', 'http://' + self.replace_server + '.seesantv.com')
item = control.item(path=url, iconImage=image, thumbnailImage=image)
item.setInfo(type='Video', infoLabels={'title': name})
item.setProperty('Video', 'true')
item.setProperty('IsPlayable', 'true')
control.playlist.clear()
try:
connection = urllib2.urlopen(videoUrl)
connection.close()
except urllib2.HTTPError, e:
videoUrl = videoUrl.replace('gm99', 'uk88')
try:
connection = urllib2.urlopen(videoUrl)
connection.close()
except urllib2.HTTPError, e:
videoUrl = videoUrl.replace('uk88', 'as88')
示例11: addDirectory
def addDirectory(self, items):
if items == None or len(items) == 0: return
sysaddon = sys.argv[0]
addonFanart = control.addonFanart()
addonThumb = control.addonThumb()
artPath = control.artPath()
for i in items:
try:
try: name = control.lang(i['name']).encode('utf-8')
except: name = i['name']
if i['image'].startswith('http://'): thumb = i['image']
elif not artPath == None: thumb = os.path.join(artPath, i['image'])
else: thumb = addonThumb
url = '%s?action=%s' % (sysaddon, i['action'])
try: url += '&url=%s' % urllib.quote_plus(i['url'])
except: pass
cm = []
#try: cm.append((control.lang(30239).encode('utf-8'), 'RunPlugin(%s?action=tvshowsToLibrary&url=%s)' % (sysaddon, urllib.quote_plus(i['context']))))
#except: pass
item = control.item(label=name, iconImage=thumb, thumbnailImage=thumb)
item.addContextMenuItems(cm, replaceItems=False)
if not addonFanart == None: item.setProperty('Fanart_Image', addonFanart)
control.addItem(handle=int(sys.argv[1]), url=url, listitem=item, isFolder=True)
except:
pass
views.setView('tvshows', {'skin.confluence': control.viewMode['mediainfo1']})
control.directory(int(sys.argv[1]), cacheToDisc=True)
示例12: playLiveStream
def playLiveStream(self, name, url, thumb):
try:
from resources.lib.libraries.player import player
item = control.item(label=name, iconImage=thumb, thumbnailImage=thumb)
player().play(url, item)
except:
pass
示例13: run
def run(self, content, name, url, year, imdb, tvdb, meta):
if control.window.getProperty('PseudoTVRunning') == 'True':
return control.player.play(url, control.item(path=url))
self.getVideoInfo(content, name, year, imdb, tvdb)
if self.folderPath.startswith('plugin://') and not meta == None:
poster, thumb, meta = self.getMeta(meta)
else:
poster, thumb, meta = self.getLibraryMeta(meta)
logger.debug(' meta %s' % (meta))
if not type(url) == list:
url = [url]
playlist = control.playlist
playlist.clear()
for i in range(0,len(url)):
if len(url) > 1:
meta['title'] = '%s Part # %s' % (name, str(i+1))
try:
iconImage = meta['iconImage']
except:
iconImage = 'DefaultVideo.png'
item = control.item(name, path=url[i], iconImage=iconImage, thumbnailImage=thumb)
item.setInfo(type='Video', infoLabels = meta)
try: item.setArt({'poster': poster, 'tvshow.poster': poster, 'season.poster': poster})
except: pass
item.setProperty('Video', 'true')
item.setProperty('IsPlayable', 'true')
playlist.add(url[i], item)
control.player.play(playlist)
for i in range(0, 240):
if self.isPlayingVideo(): break
xbmc.sleep(1000)
while self.isPlayingVideo():
try: self.totalTime = self.getTotalTime()
except: pass
try: self.currentTime = self.getTime()
except: pass
xbmc.sleep(1000)
control.window.clearProperty('script.trakt.ids')
time.sleep(5)
示例14: addDirectoryItem
def addDirectoryItem(name, url, action, image, image2, fanart, content, data, tvshow='0', totalItems=0, isFolder=True):
if not str(image).lower().startswith('http'): image = control.addonInfo('icon')
if not str(image2).lower().startswith('http'): image2 = control.addonInfo('icon')
if not str(fanart).lower().startswith('http'): fanart = control.addonInfo('fanart')
if content in ['movies', 'episodes']: playable = 'true'
else: playable = 'false'
sysaddon = sys.argv[0]
if url.startswith('$base64'):
import base64 ; url = base64.b64decode(re.compile('\$base64\[(.+?)\]$').findall(url)[0])
u = '%s?name=%s&url=%s&tvdb=&imdb=&source=GVideo&provider=Mpie&content=%s&action=playItem' % (sysaddon, urllib.quote_plus(name), urllib.quote_plus(url), str(content))
cm = []
if content == 'movies':
cm.append((control.lang(30708).encode('utf-8'), 'XBMC.Action(Info)'))
elif content in ['tvshows', 'seasons']:
cm.append((control.lang(30709).encode('utf-8'), 'XBMC.Action(Info)'))
elif content == 'episodes':
cm.append((control.lang(30710).encode('utf-8'), 'XBMC.Action(Info)'))
if content == 'movies' and not isFolder == True:
downloadFile = name
try: downloadFile = '%s (%s)' % (data['title'], data['year'])
except: pass
cm.append((control.lang(30722).encode('utf-8'), 'RunPlugin(%s?action=addDownload&name=%s&url=%s&image=%s)' % (sysaddon, urllib.quote_plus(downloadFile), urllib.quote_plus(url), urllib.quote_plus(image))))
elif content == 'episodes' and not isFolder == True:
downloadFile = name
try: downloadFile = '%s S%02dE%02d' % (data['tvshowtitle'], int(data['season']), int(data['episode']))
except: pass
cm.append((control.lang(30722).encode('utf-8'), 'RunPlugin(%s?action=addDownload&name=%s&url=%s&image=%s)' % (sysaddon, urllib.quote_plus(downloadFile), urllib.quote_plus(url), urllib.quote_plus(image))))
if content == 'movies':
cm.append((control.lang(30711).encode('utf-8'), 'RunPlugin(%s?action=addView&content=movies)' % sysaddon))
elif content == 'tvshows':
cm.append((control.lang(30712).encode('utf-8'), 'RunPlugin(%s?action=addView&content=tvshows)' % sysaddon))
elif content == 'seasons':
cm.append((control.lang(30713).encode('utf-8'), 'RunPlugin(%s?action=addView&content=seasons)' % sysaddon))
elif content == 'episodes':
cm.append((control.lang(30714).encode('utf-8'), 'RunPlugin(%s?action=addView&content=episodes)' % sysaddon))
item = control.item(name, iconImage='DefaultFolder.png', thumbnailImage=image)
try: item.setArt({'poster': image2, 'tvshow.poster': image2, 'season.poster': image2, 'banner': image, 'tvshow.banner': image, 'season.banner': image})
except: pass
item.addContextMenuItems(cm, replaceItems=False)
item.setProperty('Fanart_Image', fanart)
if playable == 'true': item.setProperty('IsPlayable', 'true')
item.setInfo(type='Video', infoLabels=data)
control.addItem(handle=int(sys.argv[1]),url=u,listitem=item,totalItems=totalItems,isFolder=isFolder)
示例15: downloader
def downloader():
thumb = control.addonThumb() ; fanart = control.addonFanart()
status = control.window.getProperty(property + '.status')
if not downloadPath == '':
item = control.item('[COLOR FF00b8ff]Downloads[/COLOR]', iconImage=thumb, thumbnailImage=thumb)
item.addContextMenuItems([], replaceItems=True)
item.setProperty('fanart_image', fanart)
control.addItem(handle=int(sys.argv[1]), url=downloadPath, listitem=item, isFolder=True)
if status == 'downloading':
item = control.item('[COLOR red]Stop Downloads[/COLOR]', iconImage=thumb, thumbnailImage=thumb)
item.addContextMenuItems([], replaceItems=True)
item.setProperty('fanart_image', fanart)
control.addItem(handle=int(sys.argv[1]), url=sys.argv[0]+'?mode=stopDownload', listitem=item, isFolder=True)
else:
item = control.item('[COLOR FF00b8ff]Start Downloads[/COLOR]', iconImage=thumb, thumbnailImage=thumb)
item.addContextMenuItems([], replaceItems=True)
item.setProperty('fanart_image', fanart)
control.addItem(handle=int(sys.argv[1]), url=sys.argv[0]+'?mode=startDownload', listitem=item, isFolder=True)
if status == 'downloading':
item = control.item('[COLOR gold]Download Status[/COLOR]', iconImage=thumb, thumbnailImage=thumb)
item.addContextMenuItems([], replaceItems=True)
item.setProperty('Fanart_Image', fanart)
control.addItem(handle=int(sys.argv[1]), url=sys.argv[0]+'?mode=statusDownload', listitem=item, isFolder=True)
def download(): return []
result = cache.get(download, 600000000, table='rel_dl')
for i in result:
try:
cm = []
cm.append(('Remove from Queue', 'RunPlugin(%s?mode=removeDownload&url=%s)' % (sys.argv[0], urllib.quote_plus(i['url']))))
item = control.item(i['name'], iconImage=i['image'], thumbnailImage=i['image'])
item.addContextMenuItems(cm, replaceItems=True)
item.setProperty('fanart_image', fanart)
item.setProperty('Video', 'true')
item.setProperty('IsPlayable', 'true')
control.addItem(handle=int(sys.argv[1]), url=i['url'], listitem=item)
except:
pass
control.directory(int(sys.argv[1]), cacheToDisc=True)