本文整理汇总了Python中favouritesManager.FavouritesManager.addItem方法的典型用法代码示例。如果您正苦于以下问题:Python FavouritesManager.addItem方法的具体用法?Python FavouritesManager.addItem怎么用?Python FavouritesManager.addItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类favouritesManager.FavouritesManager
的用法示例。
在下文中一共展示了FavouritesManager.addItem方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from favouritesManager import FavouritesManager [as 别名]
# 或者: from favouritesManager.FavouritesManager import addItem [as 别名]
#.........这里部分代码省略.........
self.base = base
self.handle = handle
paramstring = urllib.unquote_plus(parameter)
try:
# if addon is started
listItemPath = xbmcUtils.getListItemPath()
if not listItemPath.startswith(self.base):
if not('mode=' in paramstring and not 'mode=1&' in paramstring):
xbmcplugin.setPluginFanart(self.handle, common.Paths.pluginFanart)
self.clearCache()
#if common.getSetting('autoupdate') == 'true':
# self.update()
# Main Menu
if len(paramstring) <= 2:
mainMenu = ListItem.create()
mainMenu['url'] = self.MAIN_MENU_FILE
tmpList = self.parseView(mainMenu)
if tmpList:
self.currentlist = tmpList
else:
[mode, item] = self._parseParameters()
# switch(mode)
if mode == Mode.VIEW:
tmpList = self.parseView(item)
if tmpList:
self.currentlist = tmpList
count = len(self.currentlist.items)
if count == 1:
# Autoplay single video
autoplayEnabled = common.getSetting('autoplay') == 'true'
if autoplayEnabled:
videos = self.currentlist.getVideos()
if len(videos) == 1:
self.playVideo(videos[0], True)
elif mode == Mode.ADDITEM:
tmp = os.path.normpath(paramstring.split('url=')[1])
if tmp:
suffix = tmp.split(os.path.sep)[-1]
tmp = tmp.replace(suffix,'') + urllib.quote_plus(suffix)
if self.favouritesManager.add(tmp):
xbmc.executebuiltin('Container.Refresh()')
elif mode in [Mode.ADDTOFAVOURITES, Mode.REMOVEFROMFAVOURITES, Mode.EDITITEM]:
if mode == Mode.ADDTOFAVOURITES:
self.favouritesManager.addItem(item)
elif mode == Mode.REMOVEFROMFAVOURITES:
self.favouritesManager.removeItem(item)
xbmc.executebuiltin('Container.Refresh()')
elif mode == Mode.EDITITEM:
if self.favouritesManager.editItem(item):
xbmc.executebuiltin('Container.Refresh()')
elif mode == Mode.EXECUTE:
self.executeItem(item)
elif mode == Mode.PLAY:
self.playVideo(item)
elif mode == Mode.QUEUE:
self.queueAllVideos(item)
elif mode == Mode.DOWNLOAD:
url = urllib.unquote(item['url'])
title = item['title']
self.downloadVideo(url, title)
elif mode == Mode.REMOVEFROMCUSTOMMODULES:
self.removeCustomModule(item)
#elif mode == Mode.UPDATE:
# self.update()
elif mode == Mode.DOWNLOADCUSTOMMODULE:
self.downloadCustomModule()
elif mode == Mode.INSTALLADDON:
success = install(item['url'])
if success:
xbmc.sleep(100)
if xbmcUtils.getCurrentWindowXmlFile() == 'DialogAddonSettings.xml':
# workaround to update settings dialog
common.setSetting('', '')
except Exception, e:
common.showError('Error running SportsDevil')
common.log('Error running SportsDevil. Reason:' + str(e))
示例2: __init__
# 需要导入模块: from favouritesManager import FavouritesManager [as 别名]
# 或者: from favouritesManager.FavouritesManager import addItem [as 别名]
#.........这里部分代码省略.........
self.addon = Addon('plugin.video.SportsDevilNL', argv)
common.log('SportsDevilNL running')
base = argv[0]
handle = int(argv[1])
parameter = argv[2]
self.base = base
self.handle = handle
paramstring = urllib.unquote_plus(parameter)
common.log(paramstring)
try:
# if addon is started
listItemPath = xbmcUtils.getListItemPath()
if not listItemPath.startswith(self.base):
if not('mode=' in paramstring and not 'mode=1&' in paramstring):
xbmcplugin.setPluginFanart(self.handle, common.Paths.pluginFanart)
self.clearCache()
# Main Menu
if len(paramstring) <= 2:
mainMenu = ListItem.create()
mainMenu['url'] = self.MAIN_MENU_FILE
tmpList = self.parseView(mainMenu)
if tmpList:
self.currentlist = tmpList
else:
[mode, item] = self._parseParameters()
# switch(mode)
if mode == Mode.VIEW:
tmpList = self.parseView(item)
if tmpList:
self.currentlist = tmpList
count = len(self.currentlist.items)
if count == 1:
# Autoplay single video
autoplayEnabled = common.getSetting('autoplay') == 'true'
if autoplayEnabled:
videos = self.currentlist.getVideos()
if len(videos) == 1:
self.playVideo(videos[0], True)
elif mode == Mode.ADDITEM:
tmp = os.path.normpath(paramstring.split('url=')[1])
if tmp:
suffix = tmp.split(os.path.sep)[-1]
tmp = tmp.replace(suffix,'') + urllib.quote_plus(suffix)
if self.favouritesManager.add(tmp):
xbmc.executebuiltin('Container.Refresh()')
elif mode in [Mode.ADDTOFAVOURITES, Mode.REMOVEFROMFAVOURITES, Mode.EDITITEM]:
if mode == Mode.ADDTOFAVOURITES:
self.favouritesManager.addItem(item)
elif mode == Mode.REMOVEFROMFAVOURITES:
self.favouritesManager.removeItem(item)
xbmc.executebuiltin('Container.Refresh()')
elif mode == Mode.EDITITEM:
if self.favouritesManager.editItem(item):
xbmc.executebuiltin('Container.Refresh()')
elif mode == Mode.EXECUTE:
self.executeItem(item)
elif mode == Mode.PLAY:
self.playVideo(item)
elif mode == Mode.WEBDRIVER:
url = urllib.quote(item['url'])
title = item['title']
self.playWebDriver(url, title)
elif mode == Mode.QUEUE:
self.queueAllVideos(item)
elif mode == Mode.CHROME:
url = urllib.quote(item['url'])
title = item['title']
self.launchChrome(url, title)
elif mode == Mode.INSTALLADDON:
success = install(item['url'])
if success:
xbmc.sleep(100)
if xbmcUtils.getCurrentWindowXmlFile() == 'DialogAddonSettings.xml':
# workaround to update settings dialog
common.setSetting('', '')
except Exception, e:
common.showError('Error running SportsDevilNL')
common.log('Error running SportsDevilNL. Reason:' + str(e))
示例3: __init__
# 需要导入模块: from favouritesManager import FavouritesManager [as 别名]
# 或者: from favouritesManager.FavouritesManager import addItem [as 别名]
#.........这里部分代码省略.........
try:
# if addon is started
listItemPath = xbmcUtils.getListItemPath()
if not listItemPath.startswith(self.base):
if not ("mode=" in paramstring and not "mode=1&" in paramstring):
xbmcplugin.setPluginFanart(self.handle, common.Paths.pluginFanart)
self.clearCache()
# if common.getSetting('autoupdate') == 'true':
# self.update()
# Main Menu
if len(paramstring) <= 2:
mainMenu = ListItem.create()
mainMenu["url"] = self.MAIN_MENU_FILE
tmpList = self.parseView(mainMenu)
if tmpList:
self.currentlist = tmpList
else:
[mode, item] = self._parseParameters()
# switch(mode)
if mode == Mode.VIEW:
tmpList = self.parseView(item)
if tmpList:
self.currentlist = tmpList
count = len(self.currentlist.items)
if count == 1:
# Autoplay single video
autoplayEnabled = common.getSetting("autoplay") == "true"
if autoplayEnabled:
videos = self.currentlist.getVideos()
if len(videos) == 1:
self.playVideo(videos[0], True)
elif mode == Mode.ADDITEM:
tmp = os.path.normpath(paramstring.split("url=")[1])
if tmp:
suffix = tmp.split(os.path.sep)[-1]
tmp = tmp.replace(suffix, "") + urllib.quote_plus(suffix)
if self.favouritesManager.add(tmp):
xbmc.executebuiltin("Container.Refresh()")
elif mode in [Mode.ADDTOFAVOURITES, Mode.REMOVEFROMFAVOURITES, Mode.EDITITEM]:
if mode == Mode.ADDTOFAVOURITES:
self.favouritesManager.addItem(item)
elif mode == Mode.REMOVEFROMFAVOURITES:
self.favouritesManager.removeItem(item)
xbmc.executebuiltin("Container.Refresh()")
elif mode == Mode.EDITITEM:
if self.favouritesManager.editItem(item):
xbmc.executebuiltin("Container.Refresh()")
elif mode == Mode.EXECUTE:
self.executeItem(item)
elif mode == Mode.PLAY:
self.playVideo(item)
elif mode == Mode.WEBDRIVER:
url = urllib.quote(item["url"])
title = item["title"]
self.playWebDriver(url, title)
elif mode == Mode.QUEUE:
self.queueAllVideos(item)
elif mode == Mode.DOWNLOAD:
url = urllib.unquote(item["url"])
title = item["title"]
self.downloadVideo(url, title)
elif mode == Mode.CHROME:
url = urllib.quote(item["url"])
title = item["title"]
self.launchChrome(url, title)
elif mode == Mode.REMOVEFROMCUSTOMMODULES:
self.removeCustomModule(item)
# elif mode == Mode.UPDATE:
# self.update()
elif mode == Mode.DOWNLOADCUSTOMMODULE:
self.downloadCustomModule()
elif mode == Mode.INSTALLADDON:
success = install(item["url"])
if success:
xbmc.sleep(100)
if xbmcUtils.getCurrentWindowXmlFile() == "DialogAddonSettings.xml":
# workaround to update settings dialog
common.setSetting("", "")
except Exception, e:
common.showError("Error running SportsDevil")
common.log("Error running SportsDevil. Reason:" + str(e))
示例4: __init__
# 需要导入模块: from favouritesManager import FavouritesManager [as 别名]
# 或者: from favouritesManager.FavouritesManager import addItem [as 别名]
#.........这里部分代码省略.........
#self.log.info('Base: '+ base)
#self.log.info('Handle: '+ str(handle))
#self.log.info('Parameter: '+ parameter)
#self.log.info('LEN: ' + str(len(paramstring)))
#self.log.info('mode: ' + str(mode))
if mode == None and name == None and service == None:
self.log.info('Wyświetlam kategorie')
self.CATEGORIES()
#self.LIST(MENU_TABLE)
elif mode == 1:
self.LIST(TV_ONLINE_TABLE)
elif mode == 4:
self.LIST(FUN_ONLINE_TABLE)
elif mode == 19:
self.LIST(SPORT_ONLINE_TABLE)
elif mode == 2:
self.LIST(FILM_ONLINE_TABLE)
elif mode == 3:
self.LIST(SERIALE_ONLINE_TABLE)
elif mode == 20:
self.log.info('Wyświetlam ustawienia')
self.settings.showSettings()
elif mode == 30:
self.LIBRTMP()
#elif mode == 30 and category=='update':
# self.DLLIBRTMP(name,murl)
elif mode in mymodes:
try:
# if addon is started
listItemPath = xbmcUtils.getListItemPath()
if not listItemPath.startswith(self.base):
if not('mode=' in paramstring and not 'mode=110&' in paramstring):
xbmcplugin.setPluginFanart(self.handle, common.Paths.pluginFanart)
#if common.getSetting('autoupdate') == 'true':
# self.update()
# Main Menu
if len(paramstring) <= 9:
mainMenu = ListItem.create()
mainMenu['url'] = self.MAIN_MENU_FILE
tmpList = self.parseView(mainMenu)
if tmpList:
self.currentlist = tmpList
else:
[mode, item] = self._parseParameters()
print("MMMMMMMM",mode,mydump(item))
# switch(mode)
if mode == common.Mode2.VIEW:
tmpList = self.parseView(item)
print("MMMMMMMM",item,vars(item))
if tmpList:
self.currentlist = tmpList
count = len(self.currentlist.items)
if count == 1:
# Autoplay single video
autoplayEnabled = ptv.getSetting('autoplay') == 'true'
if autoplayEnabled:
videos = self.currentlist.getVideos()
if len(videos) == 1:
self.playVideo(videos[0], True)
elif mode == common.Mode2.ADDITEM:
tmp = os.path.normpath(paramstring.split('url=')[1])
if tmp:
suffix = tmp.split(os.path.sep)[-1]
tmp = tmp.replace(suffix,'') + urllib.quote_plus(suffix)
if self.favouritesManager.add(tmp):
xbmc.executebuiltin('Container.Refresh()')
elif mode in [common.Mode2.ADDTOFAVOURITES, common.Mode2.REMOVEFROMFAVOURITES, common.Mode2.EDITITEM]:
if mode == common.Mode2.ADDTOFAVOURITES:
self.favouritesManager.addItem(item)
elif mode == common.Mode2.REMOVEFROMFAVOURITES:
self.favouritesManager.removeItem(item)
xbmc.executebuiltin('Container.Refresh()')
elif mode == common.Mode2.EDITITEM:
if self.favouritesManager.editItem(item):
xbmc.executebuiltin('Container.Refresh()')
elif mode == common.Mode2.PLAY:
self.playVideo(item)
except Exception, e:
common.showError('Error running Mrknow')
self.log.info('Error running Mrknow. Reason:' + str(e))
elif mode == 8000 or service == 'kinoliveseriale':
tv = kinoliveseriale.kinoliveseriale()
tv.handleService()
示例5: __init__
# 需要导入模块: from favouritesManager import FavouritesManager [as 别名]
# 或者: from favouritesManager.FavouritesManager import addItem [as 别名]
#.........这里部分代码省略.........
# Show Main Menu
tmpList = self.parseView(self.MAIN_MENU_FILE)
if tmpList:
self.currentlist = tmpList
self.curr_file = tmpList.cfg
else:
params = paramstring
mode, codedItem = params.split('&',1)
mode = int(mode.split('=')[1])
codedItem = codedItem[4:]
item = decodeUrl(codedItem)
# switch(mode)
if mode == Mode.VIEW:
tmpList = self.parseView(codedItem)
if tmpList:
self.currentlist = tmpList
self.curr_file = tmpList.cfg
count = len(self.currentlist.items)
if count == 0:
common.showInfo('No stream available')
elif count == 1:
# Autoplay single video
autoplayEnabled = common.getSetting('autoplay') == 'true'
if autoplayEnabled:
videos = self.currentlist.getVideos()
if len(videos) == 1:
self.playVideo(videos[0], True)
elif mode == Mode.ADDITEM:
if self.favouritesManager.addItem():
xbmc.executebuiltin('Container.Refresh()')
elif mode in [Mode.ADDTOFAVOURITES, Mode.REMOVEFROMFAVOURITES, Mode.EDITITEM]:
if mode == Mode.ADDTOFAVOURITES:
self.favouritesManager.addToFavourites(item)
elif mode == Mode.REMOVEFROMFAVOURITES:
self.favouritesManager.removeItem(item)
xbmc.executebuiltin('Container.Refresh()')
elif mode == Mode.EDITITEM:
if self.favouritesManager.editItem(item):
xbmc.executebuiltin('Container.Refresh()')
elif mode == Mode.EXECUTE:
url = item['url']
if url.find('(') > -1:
xbmcCommand = parseText(url,'([^\(]*).*')
if xbmcCommand.lower() in ['activatewindow', 'runscript', 'runplugin', 'playmedia']:
if xbmcCommand.lower() == 'activatewindow':
params = parseText(url, '.*\(\s*(.+?)\s*\).*').split(',')
for i in range(len(params)-1,-1,-1):
p = params[i]
if p == 'return':
params.remove(p)
path = enc.unescape(params[len(params)-1])
xbmc.executebuiltin('Container.Update(' + path + ')')
return
xbmc.executebuiltin(enc.unescape(url))
elif mode == Mode.PLAY:
self.playVideo(item)