def getDownload(self): oGui = cGui() sPluginHandle = cPluginHandler().getPluginHandle() sPluginPath = cPluginHandler().getPluginPath() sItemUrl = '%s?site=%s&function=%s&title=%s' % (sPluginPath, SITE_IDENTIFIER, 'StartDownloadList', 'tittle') meta = {'title': 'Demarrer la liste'} item = xbmcgui.ListItem('Demarrer la liste', iconImage=cConfig().getRootArt()+'download.png') item.setProperty("Fanart_Image", cConfig().getSetting('images_downloads')) #item.setInfo(type="Video", infoLabels = meta) #item.setProperty("Video", "false") #item.setProperty("IsPlayable", "false") xbmcplugin.addDirectoryItem(sPluginHandle,sItemUrl,item,isFolder=False) oOutputParameterHandler = cOutputParameterHandler() oGui.addDir(SITE_IDENTIFIER, 'StopDownloadList', 'Arreter les Téléchargements', 'download.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oGui.addDir(SITE_IDENTIFIER, 'getDownloadList', 'Liste de Téléchargement', 'download.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oGui.addDir(SITE_IDENTIFIER, 'CleanDownloadList', 'Nettoyer la liste (Fichiers finis)', 'download.png', oOutputParameterHandler) oGui.setEndOfDirectory()
def searchGlobal(): import threading oGui = cGui() sSearchText = oGui.showKeyBoard() if not sSearchText: return True aPlugins = [] aPlugins = cPluginHandler().getAvailablePlugins() dialog = xbmcgui.DialogProgress() dialog.create('xStream', "Searching...") numPlugins = len(aPlugins) threads = [] for count, pluginEntry in enumerate(aPlugins): dialog.update((count + 1) * 100 / numPlugins, 'Searching: ' + str(pluginEntry['name']) + '...') logger.info('Searching for %s at %s' % (sSearchText, pluginEntry['id'])) t = threading.Thread(target=_pluginSearch, args=(pluginEntry, sSearchText, oGui)) threads += [t] t.start() for t in threads: t.join() dialog.close() oGui.setView() oGui.setEndOfDirectory() return True
def selectPage(self): sPluginPath = cPluginHandler().getPluginPath() oInputParameterHandler = cInputParameterHandler() # sParams = oInputParameterHandler.getAllParameter() sId = oInputParameterHandler.getValue('sId') sFunction = oInputParameterHandler.getValue('OldFunction') siteUrl = oInputParameterHandler.getValue('siteUrl') if siteUrl.endswith('/'): # for the url http.://www.1test.com/annee-2020/page-2/ urlSource = siteUrl.rsplit('/', 2)[0] endOfUrl = siteUrl.rsplit('/', 2)[1] + '/' else: # for the url http.://www.1test.com/annee-2020/page-2 or /page-2.html urlSource = siteUrl.rsplit('/', 1)[0] endOfUrl = siteUrl.rsplit('/', 1)[1] oParser = cParser() oldNum = oParser.getNumberFromString(endOfUrl) newNum = 0 if oldNum: newNum = self.showNumBoard() if newNum: try: siteUrl = urlSource + '/' + endOfUrl.replace(oldNum, newNum, 1) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', siteUrl) sParams = oOutputParameterHandler.getParameterAsUri() sTest = '%s?site=%s&function=%s&%s' % (sPluginPath, sId, sFunction, sParams) xbmc.executebuiltin('Container.Update(%s)' % sTest) except: return False return False
def viewSimil(self): sPluginPath = cPluginHandler().getPluginPath() oInputParameterHandler = cInputParameterHandler() sCleanTitle = oInputParameterHandler.getValue( 'sFileName') if oInputParameterHandler.exist( 'sFileName') else xbmc.getInfoLabel( 'ListItem.Property(sCleanTitle)') sCat = oInputParameterHandler.getValue( 'sCat') if oInputParameterHandler.exist( 'sCat') else xbmc.getInfoLabel('ListItem.Property(sCat)') oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('searchtext', sCleanTitle) oOutputParameterHandler.addParameter('sCat', sCat) oOutputParameterHandler.addParameter('readdb', 'False') sParams = oOutputParameterHandler.getParameterAsUri() sTest = '%s?site=%s&function=%s&%s' % (sPluginPath, 'globalSearch', 'globalSearch', sParams) # Si lancé depuis la page Home de Kodi, il faut d'abord en sortir pour lancer la recherche if xbmc.getCondVisibility('Window.IsVisible(home)'): xbmc.executebuiltin('ActivateWindow(%d)' % (10028)) xbmc.executebuiltin('Container.Update(%s)' % sTest) return False
def __createContextMenu(self, oGuiElement, oListItem): sPluginPath = cPluginHandler().getPluginPath() aContextMenus = [] #Menus classiques reglés a la base if (len(oGuiElement.getContextItems()) > 0): for oContextItem in oGuiElement.getContextItems(): oOutputParameterHandler = oContextItem.getOutputParameterHandler( ) sParams = oOutputParameterHandler.getParameterAsUri() sTest = '%s?site=%s&function=%s&%s' % ( sPluginPath, oContextItem.getFile(), oContextItem.getFunction(), sParams) aContextMenus += [( oContextItem.getTitle(), "XBMC.RunPlugin(%s)" % (sTest, ), )] oListItem.addContextMenuItems(aContextMenus, True) #Ajout de voir marque page oContextItem = cContextElement() oContextItem.setFile('cFav') oContextItem.setSiteName('cFav') oContextItem.setTitle('[COLOR teal]' + cConfig().getlanguage(30210) + '[/COLOR]') oContextItem.setFunction('getFavourites') oOutputParameterHandler = oContextItem.getOutputParameterHandler() sParams = oOutputParameterHandler.getParameterAsUri() sTest = '%s?site=%s&function=%s&contextFav=true&%s' % ( sPluginPath, oContextItem.getFile(), oContextItem.getFunction(), sParams) aContextMenus += [( oContextItem.getTitle(), "XBMC.Container.Update(%s)" % (sTest, ), )] oListItem.addContextMenuItems(aContextMenus) #Menu speciaux si metadata #supprimer depuis la recherche interne de bande annonce # if oGuiElement.getTrailerUrl(): # oOutputParameterHandler = cOutputParameterHandler() # oOutputParameterHandler.addParameter('sHosterIdentifier', 'youtube') # oOutputParameterHandler.addParameter('sMediaUrl', oGuiElement.getTrailerUrl()) # oOutputParameterHandler.addParameter('sFileName', oGuiElement.getTitle()) # oOutputParameterHandler.addParameter('sTitle', oGuiElement.getTitle()) # oContextItem = cContextElement() # oContextItem.setFile('cHosterGui') # oContextItem.setSiteName('cHosterGui') # oContextItem.setTitle('[COLOR azure]Bande Annonce[/COLOR]') # oContextItem.setFunction('play') # oContextItem.setOutputParameterHandler(oOutputParameterHandler) # oOutputParameterHandler = oContextItem.getOutputParameterHandler() # sParams = oOutputParameterHandler.getParameterAsUri() # sTest = '%s?site=%s&function=%s&%s' % (sPluginPath, oContextItem.getFile(), oContextItem.getFunction(), sParams) # aContextMenus+= [ ( oContextItem.getTitle(), "XBMC.RunPlugin(%s)" % (sTest,),)] # oListItem.addContextMenuItems(aContextMenus) return oListItem
def setEndOfDirectory(self, forceViewMode=False): iHandler = cPluginHandler().getPluginHandle() if not self.listing: self.addText('cGui') xbmcplugin.addDirectoryItems(iHandler, self.listing, len(self.listing)) xbmcplugin.setPluginCategory(iHandler, '') xbmcplugin.setContent(iHandler, cGui.CONTENT) xbmcplugin.addSortMethod(iHandler, xbmcplugin.SORT_METHOD_NONE) xbmcplugin.endOfDirectory(iHandler, succeeded=True, cacheToDisc=True) # reglage vue # 50 = liste / 51 grande liste / 500 icone / 501 gallerie / 508 fanart / if forceViewMode: xbmc.executebuiltin('Container.SetViewMode(' + str(forceViewMode) + ')') else: if self.ADDON.getSetting('active-view') == 'true': if cGui.CONTENT == 'movies' or cGui.CONTENT == 'artists': # xbmc.executebuiltin('Container.SetViewMode(507)') xbmc.executebuiltin('Container.SetViewMode(%s)' % self.ADDON.getSetting('movies-view')) elif cGui.CONTENT in ['tvshows', 'seasons', 'episodes']: xbmc.executebuiltin( 'Container.SetViewMode(%s)' % self.ADDON.getSetting(cGui.CONTENT + '-view')) elif cGui.CONTENT == 'files': xbmc.executebuiltin('Container.SetViewMode(%s)' % self.ADDON.getSetting('default-view')) del self.episodeListing[:] # Pour l'enchainement des episodes self.episodeListing.extend(self.listing) del self.listing[:]
def run(self, oGuiElement, sTitle, sUrl): sPluginHandle = cPluginHandler().getPluginHandle(); #meta = oGuiElement.getInfoLabel() meta = {'label': sTitle, 'title': sTitle} item = xbmcgui.ListItem(path=sUrl, iconImage="DefaultVideo.png", thumbnailImage=self.sThumbnail) item.setInfo( type="Video", infoLabels= meta ) if (cConfig().getSetting("playerPlay") == '0'): sPlayerType = self.__getPlayerType() xbmcPlayer = xbmc.Player(sPlayerType) xbmcPlayer.play( sUrl, item ) xbmcplugin.endOfDirectory(sPluginHandle, True, False, False) else: xbmcplugin.setResolvedUrl(sPluginHandle, True, item) timer = int(cConfig().getSetting('param_timeout')) xbmc.sleep(timer) while not xbmc.abortRequested: try: self.currentTime = self.getTime() self.totalTime = self.getTotalTime() except: break xbmc.sleep(1000)
def run(self, oGuiElement, sTitle, sUrl): sPluginHandle = cPluginHandler().getPluginHandle(); #meta = oGuiElement.getInfoLabel() meta = {'label': sTitle, 'title': sTitle} item = xbmcgui.ListItem(path=sUrl, iconImage="DefaultVideo.png", thumbnailImage=self.sThumbnail) item.setInfo( type="Video", infoLabels= meta ) if (cConfig().getSetting("playerPlay") == '0'): sPlayerType = self.__getPlayerType() xbmcPlayer = xbmc.Player(sPlayerType) xbmcPlayer.play( sUrl, item ) xbmcplugin.endOfDirectory(sPluginHandle, True, False, False) else: xbmcplugin.setResolvedUrl(sPluginHandle, True, item) timer = int(cConfig().getSetting('param_timeout')) xbmc.sleep(timer) while not xbmc.abortRequested: try: self.currentTime = self.getTime() self.totalTime = self.getTotalTime() except: break xbmc.sleep(1000)
def onInit(self): self.container = self.getControl(6) self.button = self.getControl(5) self.getControl(3).setVisible(False) self.getControl(1).setLabel(self.ADDON.VSlang(30094)) self.button.setLabel('OK') listitems = [] oPluginHandler = cPluginHandler() aPlugins = oPluginHandler.getAllPlugins() for aPlugin in aPlugins: #teste si deja dans le dsip sPluginSettingsName = 'plugin_' + aPlugin[1] bPlugin = self.ADDON.getSetting(sPluginSettingsName) #icon = os.path.join(unicode(cConfig().getRootArt(), 'utf-8'), 'sites', aPlugin[1] + '.png') icon = "special://home/addons/plugin.video.matrix/resources/art/sites/%s.png" % aPlugin[1] stitle = aPlugin[0].replace('[COLOR violet]', '').replace('[COLOR orange]', '').replace('[/COLOR]', '').replace('[COLOR dodgerblue]', '').replace('[COLOR coral]', '') if (bPlugin == 'true'): stitle = ('%s %s') % (stitle, valid) listitem = xbmcgui.ListItem(label = stitle, label2 = aPlugin[2]) listitem.setArt({'icon': icon, 'thumb': icon}) listitem.setProperty('Addon.Summary', aPlugin[2]) listitem.setProperty('sitename', aPlugin[1]) if (bPlugin == 'true'): listitem.select(True) listitems.append(listitem) self.container.addItems(listitems) self.setFocus(self.container)
def __createItemUrl(self, oGuiElement, bIsFolder, oOutputParameterHandler=''): if (oOutputParameterHandler == ''): #cOutputParameterHandler oOutputParameterHandler = ParameterHandler() if not bIsFolder: thumbnail = oGuiElement.getThumbnail() if thumbnail: oOutputParameterHandler.setParam('thumb',thumbnail) itemValues = oGuiElement.getItemValues() metaParams = {} if 'imdb_id' in itemValues and itemValues['imdb_id']: oOutputParameterHandler.setParam('imdbID',itemValues['imdb_id']) #if itemValues['title']: # metaParams['title'] = itemValues['title'] if 'mediaType' in itemValues and itemValues['mediaType']: oOutputParameterHandler.setParam('mediaType',itemValues['mediaType']) elif 'TVShowTitle' in itemValues and itemValues['TVShowTitle']: oOutputParameterHandler.setParam('mediaType','tvshow') if 'season' in itemValues and itemValues['season'] and int(itemValues['season'])>0: oOutputParameterHandler.setParam('season',itemValues['season']) oOutputParameterHandler.setParam('mediaType','season') if 'episode' in itemValues and itemValues['episode'] and int(itemValues['episode'])>0: oOutputParameterHandler.setParam('episode',itemValues['episode']) oOutputParameterHandler.setParam('mediaType','episode') oOutputParameterHandler.setParam('playMode','play') sParams = oOutputParameterHandler.getParameterAsUri() sPluginPath = cPluginHandler().getPluginPath() if len(oGuiElement.getFunction()) == 0: sItemUrl = "%s?site=%s&title=%s&%s" % (sPluginPath, oGuiElement.getSiteName(), urllib.quote_plus(oGuiElement.getTitle()), sParams) else: sItemUrl = "%s?site=%s&function=%s&title=%s&%s" % (sPluginPath, oGuiElement.getSiteName(), oGuiElement.getFunction(), urllib.quote_plus(oGuiElement.getTitle()), sParams) return sItemUrl
def selectpage(self): sPluginPath = cPluginHandler().getPluginPath() oInputParameterHandler = cInputParameterHandler() #sParams = oInputParameterHandler.getAllParameter() sId = oInputParameterHandler.getValue('sId') sFunction = oInputParameterHandler.getValue('OldFunction') siteUrl = oInputParameterHandler.getValue('siteUrl') oParser = cParser() oldNum = oParser.getNumberFromString(siteUrl) newNum = 0 if oldNum: newNum = self.showNumBoard() if newNum: try: siteUrl = siteUrl.replace(oldNum, newNum) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', siteUrl) sParams = oOutputParameterHandler.getParameterAsUri() sTest = '%s?site=%s&function=%s&%s' % (sPluginPath, sId, sFunction, sParams) xbmc.executebuiltin('XBMC.Container.Update(%s)' % sTest) except: return False return False
def __createContextMenu(self, oGuiElement, oListItem, bIsFolder, oOutputParams=''): sPluginPath = cPluginHandler().getPluginPath() aContextMenus = [] if len(oGuiElement.getContextItems()) > 0: for oContextItem in oGuiElement.getContextItems(): oOutputParameterHandler = oContextItem.getOutputParameterHandler() sParams = oOutputParameterHandler.getParameterAsUri() sTest = "%s?site=%s&function=%s&%s" % (sPluginPath, oContextItem.getFile(), oContextItem.getFunction(), sParams) aContextMenus += [(oContextItem.getTitle(), "XBMC.RunPlugin(%s)" % (sTest,),)] oContextItem = cContextElement() oContextItem.setTitle("Info") aContextMenus += [(oContextItem.getTitle(), "XBMC.Action(Info)",)] if not bIsFolder: oContextItem.setTitle("add to Playlist") aContextMenus += [(oContextItem.getTitle(), "XBMC.Action(Info)",)] oContextItem.setTitle("Download") aContextMenus += [(oContextItem.getTitle(), "XBMC.Action(Info)",)] oContextItem.setTitle("send to JDownloader") aContextMenus += [(oContextItem.getTitle(), "XBMC.Action(Info)",)] oListItem.addContextMenuItems(aContextMenus) return oListItem
def setEndOfDirectory(self, ForceViewMode=False): iHandler = cPluginHandler().getPluginHandle() #modif 22/06 if not self.listing: self.addText('cGui') xbmcplugin.addDirectoryItems(iHandler, self.listing, len(self.listing)) xbmcplugin.setPluginCategory(iHandler, "") xbmcplugin.setContent(iHandler, cGui.CONTENT) xbmcplugin.addSortMethod(iHandler, xbmcplugin.SORT_METHOD_NONE) xbmcplugin.endOfDirectory(iHandler, succeeded=True, cacheToDisc=True) #reglage vue #50 = liste / 51 grande liste / 500 icone / 501 gallerie / 508 fanart / if (ForceViewMode): xbmc.executebuiltin('Container.SetViewMode(' + str(ForceViewMode) + ')') else: if (self.ADDON.getSetting('active-view') == 'true'): if cGui.CONTENT == "movies": #xbmc.executebuiltin('Container.SetViewMode(507)') xbmc.executebuiltin('Container.SetViewMode(%s)' % self.ADDON.getSetting('movie-view')) elif cGui.CONTENT == "tvshows": xbmc.executebuiltin('Container.SetViewMode(%s)' % self.ADDON.getSetting('serie-view')) elif cGui.CONTENT == "files": xbmc.executebuiltin('Container.SetViewMode(%s)' % self.ADDON.getSetting('default-view')) #bug affichage Kodi 18 del self.listing[:]
def searchGlobal(): oGui = cGui() sSearchText = oGui.showKeyBoard() if (sSearchText != False and sSearchText != ''): aPlugins = [] aPlugins = cPluginHandler().getAvailablePlugins() for pluginEntry in aPlugins: pluginName = pluginEntry[0] pluginSiteName = pluginEntry[1] logger.info('Searching for "'+sSearchText+'" at '+pluginName) try: plugin = __import__(pluginSiteName, globals(), locals()) function = getattr(plugin, '_search') oGuiElement = cGuiElement('[B][COLOR yellow]----'+pluginName+'----[/COLOR][/B]',pluginSiteName,'spacer') if len(pluginEntry)>2: oGuiElement.setThumbnail(pluginEntry[2]) oGui.addFolder(oGuiElement) function(oGui, sSearchText) except: logger.info(str(pluginName)+': search failed') import traceback print traceback.format_exc() oGui.setView() oGui.setEndOfDirectory() return True
def setEndOfDirectory(self, ForceViewMode = False): iHandler = cPluginHandler().getPluginHandle() #modif 22/06 if not self.listing: self.addText('cGui') xbmcplugin.addDirectoryItems(iHandler, self.listing, len(self.listing)) xbmcplugin.setPluginCategory(iHandler, "") xbmcplugin.setContent(iHandler, cGui.CONTENT) xbmcplugin.addSortMethod(iHandler, xbmcplugin.SORT_METHOD_NONE) xbmcplugin.endOfDirectory(iHandler, succeeded=True, cacheToDisc=True) #reglage vue #50 = liste / 51 grande liste / 500 icone / 501 gallerie / 508 fanart / if (ForceViewMode): xbmc.executebuiltin('Container.SetViewMode(' + str(ForceViewMode) + ')') else: if (self.ADDON.getSetting('active-view') == 'true'): if cGui.CONTENT == "movies": #xbmc.executebuiltin('Container.SetViewMode(507)') xbmc.executebuiltin('Container.SetViewMode(%s)' % self.ADDON.getSetting('movie-view')) elif cGui.CONTENT == "tvshows": xbmc.executebuiltin('Container.SetViewMode(%s)' % self.ADDON.getSetting('serie-view')) elif cGui.CONTENT == "files": xbmc.executebuiltin('Container.SetViewMode(%s)' % self.ADDON.getSetting('default-view')) #bug affichage Kodi 18 del self.listing [:]
def __createItemUrl(self, oGuiElement, oOutputParameterHandler=''): if (oOutputParameterHandler == ''): oOutputParameterHandler = cOutputParameterHandler() # On descend l'id TMDB dans les saisons et les épisodes oOutputParameterHandler.addParameter('sTmdbId', oGuiElement.getTmdbId()) # Pour gérer l'enchainement des épisodes oOutputParameterHandler.addParameter('sSeason', oGuiElement.getSeason()) oOutputParameterHandler.addParameter('sEpisode', oGuiElement.getEpisode()) sParams = oOutputParameterHandler.getParameterAsUri() sPluginPath = cPluginHandler().getPluginPath() if (len(oGuiElement.getFunction()) == 0): sItemUrl = '%s?site=%s&title=%s&%s' % ( sPluginPath, oGuiElement.getSiteName(), QuotePlus(oGuiElement.getCleanTitle()), sParams) else: sItemUrl = '%s?site=%s&function=%s&title=%s&%s' % ( sPluginPath, oGuiElement.getSiteName(), oGuiElement.getFunction(), QuotePlus(oGuiElement.getCleanTitle()), sParams) return sItemUrl
def searchGlobal(): import threading oGui = cGui() sSearchText = oGui.showKeyBoard() if (sSearchText != False and sSearchText != ''): aPlugins = [] aPlugins = cPluginHandler().getAvailablePlugins() dialog = xbmcgui.DialogProgress() dialog.create('xStream',"Searching...") numPlugins = len(aPlugins) count = 0 threads = [] for pluginEntry in aPlugins: dialog.update(count*100/numPlugins,'Searching: '+str(pluginEntry['name'])+'...') count += 1 logger.info('Searching for %s at %s' % (sSearchText, pluginEntry['id'])) t = threading.Thread(target=_pluginSearch, args=(pluginEntry,sSearchText,oGui)) threads += [t] t.start() for t in threads: t.join() dialog.close() oGui.setView() oGui.setEndOfDirectory() return True
def searchAlter(params): searchText = params.getValue('searchTitle') searchImdbId = params.getValue('searchImdbID') import threading oGui = cGui() aPlugins = [] aPlugins = cPluginHandler().getAvailablePlugins() dialog = xbmcgui.DialogProgress() dialog.create('xStream',"Searching...") numPlugins = len(aPlugins) count = 0 threads = [] for pluginEntry in aPlugins: dialog.update(count*100/numPlugins,'Searching: '+str(pluginEntry['name'])+'...') count += 1 logger.info('Searching for "'+searchText+'" at '+pluginEntry['id']) t = threading.Thread(target=pluginSearch, args=(pluginEntry,searchText)) threads += [t] t.start() for t in threads: t.join() dialog.close() oGui.setView() oGui.setEndOfDirectory() #xbmc.executebuiltin('Container.Update') return True
def searchGlobal(): import threading oGui = cGui() oGui.globalSearch = True oGui._collectMode = True sSearchText = oGui.showKeyBoard() if not sSearchText: return True aPlugins = [] aPlugins = cPluginHandler().getAvailablePlugins() dialog = xbmcgui.DialogProgress() dialog.create('xStream',"Searching...") numPlugins = len(aPlugins) threads = [] for count, pluginEntry in enumerate(aPlugins): dialog.update((count+1)*50/numPlugins,'Searching: '+str(pluginEntry['name'])+'...') logger.info('Searching for %s at %s' % (sSearchText, pluginEntry['id'])) t = threading.Thread(target=_pluginSearch, args=(pluginEntry,sSearchText,oGui), name =pluginEntry['name']) threads += [t] t.start() for count, t in enumerate(threads): t.join() dialog.update((count+1)*50/numPlugins+50, t.getName()+' returned') dialog.close() # deactivate collectMode attribute because now we want the elements really added oGui._collectMode = False total=len(oGui.searchResults) for result in sorted(oGui.searchResults, key=lambda k: k['guiElement'].getSiteName()): oGui.addFolder(result['guiElement'],result['params'],bIsFolder=result['isFolder'],iTotal=total) oGui.setView() oGui.setEndOfDirectory() return True
def searchGlobal(): oGui = cGui() sSearchText = oGui.showKeyBoard() if (sSearchText != False and sSearchText != ''): aPlugins = [] aPlugins = cPluginHandler().getAvailablePlugins() oGui.dialog = xbmcgui.DialogProgress() oGui.dialog.create('xStream',"Searching...") numPlugins = len(aPlugins) count = 0 for pluginEntry in aPlugins: pluginName = str(pluginEntry['name']) pluginSiteName = pluginEntry['id'] oGui.dialog.update(count*100/numPlugins,'Searching: '+pluginName+'...') count += 1 logger.info('Searching for "'+sSearchText+'" at '+pluginName) try: plugin = __import__(pluginSiteName, globals(), locals()) function = getattr(plugin, '_search') oGuiElement = cGuiElement('[B][COLOR yellow]----'+pluginName+'----[/COLOR][/B]',pluginSiteName,'spacer') if len(pluginEntry)>2: oGuiElement.setThumbnail(pluginEntry['icon']) oGui.addFolder(oGuiElement) function(oGui, sSearchText) except: logger.info(pluginName+': search failed') import traceback print traceback.format_exc() oGui.dialog.close() oGui.setView() oGui.setEndOfDirectory() return True
def __createContextMenu(self, oGuiElement, oListItem): sPluginPath = cPluginHandler().getPluginPath(); aContextMenus = [] if len(oGuiElement.getContextItems()) > 0: for oContextItem in oGuiElement.getContextItems(): oOutputParameterHandler = oContextItem.getOutputParameterHandler() sParams = oOutputParameterHandler.getParameterAsUri() sTest = "%s?site=%s&function=%s&%s" % (sPluginPath, oContextItem.getFile(), oContextItem.getFunction(), sParams) aContextMenus+= [ ( oContextItem.getTitle(), "XBMC.RunPlugin(%s)" % (sTest,),)] oListItem.addContextMenuItems(aContextMenus) #oListItem.addContextMenuItems(aContextMenus, True) if oGuiElement.getSiteName() != "cAboutGui": oContextItem = cContextElement() oContextItem.setFile("cAboutGui") oContextItem.setTitle("Ueber xStream") oContextItem.setFunction("show") oOutputParameterHandler = oContextItem.getOutputParameterHandler() sParams = oOutputParameterHandler.getParameterAsUri() sTest = "%s?site=%s&function=%s&%s" % (sPluginPath, oContextItem.getFile(), oContextItem.getFunction(), sParams) aContextMenus+= [ ( oContextItem.getTitle(), "Container.Update(%s)" % (sTest,),)] oListItem.addContextMenuItems(aContextMenus) return oListItem
def addFolder(self, oGuiElement, oOutputParameterHandler='', isFolder=True): if oOutputParameterHandler.getValue('siteUrl'): sSiteUrl = oOutputParameterHandler.getValue('siteUrl') oGuiElement.setSiteUrl(sSiteUrl) oListItem = self.createListItem(oGuiElement) # if oGuiElement.getMeta(): # oOutputParameterHandler.addParameter('sMeta', oGuiElement.getMeta()) sItemUrl = self.__createItemUrl(oGuiElement, oOutputParameterHandler) #new context prend en charge les metas if cGui.CONTENT == "movies": self.createContexMenuWatch(oGuiElement, oOutputParameterHandler) #self.createContexMenuSimil(oGuiElement, oOutputParameterHandler) self.createContexMenuinfo(oGuiElement, oOutputParameterHandler) self.createContexMenuFav(oGuiElement, oOutputParameterHandler) elif cGui.CONTENT == "tvshows": self.createContexMenuWatch(oGuiElement, oOutputParameterHandler) self.createContexMenuinfo(oGuiElement, oOutputParameterHandler) self.createContexMenuFav(oGuiElement, oOutputParameterHandler) oListItem = self.__createContextMenu(oGuiElement, oListItem) sPluginHandle = cPluginHandler().getPluginHandle(); xbmcplugin.addDirectoryItem(sPluginHandle, sItemUrl, oListItem, isFolder=isFolder)
def selectpage(self): sPluginPath = cPluginHandler().getPluginPath(); oInputParameterHandler = cInputParameterHandler() #sParams = oInputParameterHandler.getAllParameter() sId = oInputParameterHandler.getValue('sId') sFunction = oInputParameterHandler.getValue('OldFunction') siteUrl = oInputParameterHandler.getValue('siteUrl') oParser = cParser() oldNum = oParser.getNumberFromString(siteUrl) newNum = 0 if oldNum: newNum = self.showNumBoard() if newNum: try: siteUrl = siteUrl.replace(oldNum,newNum) oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', siteUrl) sParams = oOutputParameterHandler.getParameterAsUri() sTest = '%s?site=%s&function=%s&%s' % (sPluginPath, sId, sFunction, sParams) xbmc.executebuiltin('XBMC.Container.Update(%s)' % sTest ) except: return False return False
def addFolder(self, oGuiElement, oOutputParameterHandler='', _isFolder=True): #recherche append les reponses if window(10101).getProperty('search') == 'true': import copy cGui.searchResults.append({'guiElement':oGuiElement, 'params':copy.deepcopy(oOutputParameterHandler)}) return #Des infos a rajouter ? params = { "siteUrl": oGuiElement.setSiteUrl,#indispensable #"sTmdbId": oGuiElement.setTmdbId, #"sImbdId": oGuiElement.setImdbId,#inutile ? # "sAdeId": oGuiElement.setAdeId, "sYear": oGuiElement.setYear, } for sParam, callback in params.iteritems(): value = oOutputParameterHandler.getValue(sParam) if value: callback(value) oListItem = self.createListItem(oGuiElement) oListItem.setProperty("IsPlayable", "false") #affiche tag HD # if '1080' in oGuiElement.getTitle(): # oListItem.addStreamInfo('video', { 'aspect': '1.78', 'width':1920, 'height' : 1080 }) # elif '720' in oGuiElement.getTitle(): # oListItem.addStreamInfo('video', { 'aspect': '1.50', 'width':1280, 'height' : 720 }) # elif '2160'in oGuiElement.getTitle(): # oListItem.addStreamInfo('video', { 'aspect': '1.78', 'width':3840, 'height' : 2160 }) #oListItem.addStreamInfo('audio', {'language': 'fr'}) # if oGuiElement.getMeta(): #oOutputParameterHandler.addParameter('sMeta', oGuiElement.getMeta()) if oGuiElement.getCat(): oOutputParameterHandler.addParameter('sCat', oGuiElement.getCat()) sItemUrl = self.__createItemUrl(oGuiElement, oOutputParameterHandler) #new context prend en charge les metas if (oGuiElement.getMeta() > 0): if cGui.CONTENT == "movies": self.createContexMenuWatch(oGuiElement, oOutputParameterHandler) self.createContexMenuFav(oGuiElement, oOutputParameterHandler) # self.createContexMenuinfo(oGuiElement, oOutputParameterHandler) # self.createContexMenuba(oGuiElement, oOutputParameterHandler) self.createContexMenuSimil(oGuiElement, oOutputParameterHandler) oListItem = self.__createContextMenu(oGuiElement, oListItem) sPluginHandle = cPluginHandler().getPluginHandle() #modif 22/06 #xbmcplugin.addDirectoryItem(sPluginHandle, sItemUrl, oListItem, isFolder=_isFolder) self.listing.append((sItemUrl, oListItem, _isFolder))
def parseUrl(self): oInputParameterHandler = cInputParameterHandler() if (oInputParameterHandler.exist('function')): sFunction = oInputParameterHandler.getValue('function') else: cConfig().log('call load methode') sFunction = "load" if (oInputParameterHandler.exist('site')): sSiteName = oInputParameterHandler.getValue('site') cConfig().log('load site ' + sSiteName + ' and call function ' + sFunction) cStatistic().callStartPlugin(sSiteName) if (isHosterGui(sSiteName, sFunction) == True): return if (isGui(sSiteName, sFunction) == True): return if (isFav(sSiteName, sFunction) == True): return if (isHome(sSiteName, sFunction) == True): return #if (isAboutGui(sSiteName, sFunction) == True): #return #try: exec "import " + sSiteName + " as plugin" exec "plugin."+ sFunction +"()" #except: # cConfig().log('could not load site: ' + sSiteName ) else: if (cConfig().getSetting("home-view") == 'true'): oHome = cHome() cAbout() exec "oHome."+ sFunction +"()" return oGui = cGui() oPluginHandler = cPluginHandler() aPlugins = oPluginHandler.getAvailablePlugins() if (len(aPlugins) == 0): oGui.openSettings() oGui.updateDirectory() else: for aPlugin in aPlugins: oGuiElement = cGuiElement() oGuiElement.setTitle(aPlugin[0]) oGuiElement.setSiteName(aPlugin[1]) oGuiElement.setDescription(aPlugin[2]) oGuiElement.setFunction(sFunction) oGuiElement.setIcon("icon.png") oGui.addFolder(oGuiElement) oGui.setEndOfDirectory()
def parseUrl(self): oInputParameterHandler = cInputParameterHandler() if (oInputParameterHandler.exist('function')): sFunction = oInputParameterHandler.getValue('function') else: cConfig().log('call load methode') sFunction = "load" if (oInputParameterHandler.exist('site')): sSiteName = oInputParameterHandler.getValue('site') cConfig().log('load site ' + sSiteName + ' and call function ' + sFunction) cStatistic().callStartPlugin(sSiteName) if (isHosterGui(sSiteName, sFunction) == True): return if (isGui(sSiteName, sFunction) == True): return if (isFav(sSiteName, sFunction) == True): return if (isHome(sSiteName, sFunction) == True): return #if (isAboutGui(sSiteName, sFunction) == True): #return #try: exec "import " + sSiteName + " as plugin" exec "plugin." + sFunction + "()" #except: # cConfig().log('could not load site: ' + sSiteName ) else: if (cConfig().getSetting("home-view") == 'true'): oHome = cHome() exec "oHome." + sFunction + "()" return oGui = cGui() oPluginHandler = cPluginHandler() aPlugins = oPluginHandler.getAvailablePlugins() if (len(aPlugins) == 0): oGui.openSettings() oGui.updateDirectory() else: for aPlugin in aPlugins: oGuiElement = cGuiElement() oGuiElement.setTitle(aPlugin[0]) oGuiElement.setSiteName(aPlugin[1]) oGuiElement.setDescription(aPlugin[2]) oGuiElement.setFunction(sFunction) oGuiElement.setIcon("icon.png") oGui.addFolder(oGuiElement) oGui.setEndOfDirectory()
def __isSeriesEverAvaiable(): cph = cPluginHandler() for site in cph.getAvailablePlugins(): if site['id'] == SERIESEVER_IDENTIFIER: return True return False
def addFolder(self, oGuiElement, oOutputParameterHandler='', bIsFolder=True, iTotal=0): sItemUrl = self.__createItemUrl(oGuiElement, oOutputParameterHandler) oListItem = self.createListItem(oGuiElement) oListItem = self.__createContextMenu(oGuiElement, oListItem, bIsFolder, oOutputParameterHandler) sPluginHandle = cPluginHandler().getPluginHandle() xbmcplugin.addDirectoryItem(sPluginHandle, sItemUrl, oListItem, isFolder=bIsFolder, totalItems=iTotal)
def viewBack(self): sPluginPath = cPluginHandler().getPluginPath() oInputParameterHandler = cInputParameterHandler() # sParams = oInputParameterHandler.getAllParameter() sId = oInputParameterHandler.getValue('sId') sTest = '%s?site=%s' % (sPluginPath, sId) xbmc.executebuiltin('Container.Update(%s, replace)' % sTest)
def __isSeriesEverAvaiable(): cph = cPluginHandler() for site in cph.getAvailablePlugins(): if site['id'] == SERIESEVER_IDENTIFIER: return True return False
def addFolder(self, oGuiElement, oOutputParameterHandler=''): sItemUrl = self.__createItemUrl(oGuiElement, oOutputParameterHandler) oListItem = self.createListItem(oGuiElement) oListItem = self.__createContextMenu(oGuiElement, oListItem) sPluginHandle = cPluginHandler().getPluginHandle(); xbmcplugin.addDirectoryItem(sPluginHandle, sItemUrl, oListItem, True)
def viewback(self): sPluginPath = cPluginHandler().getPluginPath(); oInputParameterHandler = cInputParameterHandler() sParams = oInputParameterHandler.getAllParameter() sId = oInputParameterHandler.getValue('sId') sTest = '%s?site=%s' % (sPluginPath, sId) xbmc.executebuiltin('XBMC.Container.Update(%s, replace)' % sTest )
def addFolder(self, oGuiElement, oOutputParameterHandler=''): sItemUrl = self.__createItemUrl(oGuiElement, oOutputParameterHandler) oListItem = self.createListItem(oGuiElement) oListItem = self.__createContextMenu(oGuiElement, oListItem) sPluginHandle = cPluginHandler().getPluginHandle() xbmcplugin.addDirectoryItem(sPluginHandle, sItemUrl, oListItem, True)
def searchAlter(params): searchTitle = params.getValue('searchTitle') searchImdbId = params.getValue('searchImdbID') searchYear = params.getValue('searchYear') import threading oGui = cGui() oGui.globalSearch = True oGui._collectMode = True aPlugins = [] aPlugins = cPluginHandler().getAvailablePlugins() dialog = xbmcgui.DialogProgress() dialog.create('xStream', "Searching...") numPlugins = len(aPlugins) threads = [] for count, pluginEntry in enumerate(aPlugins): dialog.update((count + 1) * 50 / numPlugins, 'Searching: ' + str(pluginEntry['name']) + '...') logger.info('Searching for ' + searchTitle + pluginEntry['id'].encode('utf-8')) t = threading.Thread(target=_pluginSearch, args=(pluginEntry, searchTitle, oGui), name=pluginEntry['name']) threads += [t] t.start() for count, t in enumerate(threads): t.join() dialog.update((count + 1) * 50 / numPlugins + 50, t.getName() + ' returned') dialog.close() #check results, put this to the threaded part, too filteredResults = [] for result in oGui.searchResults: guiElement = result['guiElement'] logger.info('Site: %s Titel: %s' % (guiElement.getSiteName(), guiElement.getTitle())) if not searchTitle in guiElement.getTitle(): continue if guiElement._sYear and searchYear and guiElement._sYear != searchYear: continue if searchImdbId and guiElement.getItemProperties().get( 'imdbID', False) and guiElement.getItemProperties().get( 'imdbID', False) != searchImdbId: continue filteredResults.append(result) oGui._collectMode = False total = len(filteredResults) for result in sorted(filteredResults, key=lambda k: k['guiElement'].getSiteName()): oGui.addFolder(result['guiElement'], result['params'], bIsFolder=result['isFolder'], iTotal=total) oGui.setView() oGui.setEndOfDirectory() xbmc.executebuiltin('Container.Update') return True
def addFolder(self, oGuiElement, oOutputParameterHandler=''): #Des infos a rajouter ? params = { "siteUrl": oGuiElement.setSiteUrl,#indispensable "sTmdbId": oGuiElement.setTmdbId, "sImbdId": oGuiElement.setImdbId,#inutile ? "sYear": oGuiElement.setYear, } for sParam, callback in params.iteritems(): value = oOutputParameterHandler.getValue(sParam) if value: callback(value) oListItem = self.createListItem(oGuiElement) oListItem.setProperty("IsPlayable", "false") #affiche tag HD if '1080' in oGuiElement.getTitle(): oListItem.addStreamInfo('video', { 'aspect': '1.78', 'width':1920 ,'height' : 1080 }) elif '720' in oGuiElement.getTitle(): oListItem.addStreamInfo('video', { 'aspect': '1.50', 'width':1280 ,'height' : 720 }) #oListItem.addStreamInfo('audio', { 'codec': 'aac', 'language': 'en', 'channels' : 2 }) # if oGuiElement.getMeta(): # oOutputParameterHandler.addParameter('sMeta', oGuiElement.getMeta()) sItemUrl = self.__createItemUrl(oGuiElement, oOutputParameterHandler) #new context prend en charge les metas if (oGuiElement.getMeta() > 0): if cGui.CONTENT == "movies": self.createContexMenuWatch(oGuiElement, oOutputParameterHandler) self.createContexMenuSimil(oGuiElement, oOutputParameterHandler) self.createContexMenuba(oGuiElement, oOutputParameterHandler) self.createContexMenuinfo(oGuiElement, oOutputParameterHandler) self.createContexMenuFav(oGuiElement, oOutputParameterHandler) self.createContexMenuTrakt(oGuiElement, oOutputParameterHandler) elif cGui.CONTENT == "tvshows": self.createContexMenuWatch(oGuiElement, oOutputParameterHandler) self.createContexMenuSimil(oGuiElement, oOutputParameterHandler) self.createContexMenuba(oGuiElement, oOutputParameterHandler) self.createContexMenuinfo(oGuiElement, oOutputParameterHandler) self.createContexMenuFav(oGuiElement, oOutputParameterHandler) self.createContexMenuTrakt(oGuiElement, oOutputParameterHandler) oListItem = self.__createContextMenu(oGuiElement, oListItem) sPluginHandle = cPluginHandler().getPluginHandle(); xbmcplugin.addDirectoryItem(sPluginHandle, sItemUrl, oListItem, isFolder=True)
def showSources(self): oGui = cGui() oPluginHandler = cPluginHandler() aPlugins = oPluginHandler.getAvailablePlugins() for aPlugin in aPlugins: oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter("siteUrl", "http://venom") oGui.addDir(aPlugin[1], "load", aPlugin[0], "tv.png", oOutputParameterHandler) oGui.setEndOfDirectory()
def addFolder(self, oGuiElement, oOutputParameterHandler='', bIsFolder = True, iTotal = 0 ): ''' add GuiElement to Gui, adds listitem to a list ''' sItemUrl = self.__createItemUrl(oGuiElement, bIsFolder, oOutputParameterHandler) oListItem = self.createListItem(oGuiElement) #if not bIsFolder: # oListItem.setProperty('IsPlayable', 'true') oListItem = self.__createContextMenu(oGuiElement, oListItem, bIsFolder, sItemUrl, oOutputParameterHandler) sPluginHandle = cPluginHandler().getPluginHandle() xbmcplugin.addDirectoryItem(sPluginHandle, sItemUrl, oListItem, isFolder = bIsFolder, totalItems = iTotal)
def showSources(self): oGui = cGui() oPluginHandler = cPluginHandler() aPlugins = oPluginHandler.getAvailablePlugins() for aPlugin in aPlugins: oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'http://venom') oGui.addDir(aPlugin[1], 'load', aPlugin[0], 'host.png', oOutputParameterHandler) oGui.setEndOfDirectory()
def showSources(self): oGui = cGui() oPluginHandler = cPluginHandler() aPlugins = oPluginHandler.getAvailablePlugins() for aPlugin in aPlugins: oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'http://venom') oGui.addDir(aPlugin[1], 'load', aPlugin[0], 'tv.png', oOutputParameterHandler) oGui.setEndOfDirectory()
def setView(self, content='movies'): iHandler = cPluginHandler().getPluginHandle() if content == 'movies': xbmcplugin.setContent(iHandler, 'movies') elif content == 'tvshows': xbmcplugin.setContent(iHandler, 'tvshows') elif content == 'seasons': xbmcplugin.setContent(iHandler, 'seasons') elif content == 'episodes': xbmcplugin.setContent(iHandler, 'episodes') if cConfig().getSetting('auto-view') == 'true': xbmc.executebuiltin("Container.SetViewMode(%s)" % cConfig().getSetting(content + '-view'))
def __createItemUrl(self, oGuiElement, oOutputParameterHandler=''): if (oOutputParameterHandler == ''): oOutputParameterHandler = cOutputParameterHandler() sParams = oOutputParameterHandler.getParameterAsUri() sPluginPath = cPluginHandler().getPluginPath() if len(oGuiElement.getFunction()) == 0: sItemUrl = "%s?site=%s&title=%s&%s" % (sPluginPath, oGuiElement.getSiteName(), urllib.quote_plus(oGuiElement.getTitle()), sParams) else: sItemUrl = "%s?site=%s&function=%s&title=%s&%s" % (sPluginPath, oGuiElement.getSiteName(), oGuiElement.getFunction(), urllib.quote_plus(oGuiElement.getTitle()), sParams) return sItemUrl
def selectpage2(self): sPluginPath = cPluginHandler().getPluginPath(); oInputParameterHandler = cInputParameterHandler() #sParams = oInputParameterHandler.getAllParameter() sId = oInputParameterHandler.getValue('sId') sUrlBase = oInputParameterHandler.getValue('siteUrlbase') sMaxpage = oInputParameterHandler.getValue('MaxPage') sTest = '%s?site=%s' % (sPluginPath, sId) sTest = sTest +'&function=showPage&siteUrlbase=' + urllib.quote(sUrlBase) + '&MaxPage=' + str(sMaxpage) xbmc.executebuiltin('XBMC.Container.Update(%s, replace)' % sTest )
def selectpage2(self): sPluginPath = cPluginHandler().getPluginPath(); oInputParameterHandler = cInputParameterHandler() #sParams = oInputParameterHandler.getAllParameter() sId = oInputParameterHandler.getValue('sId') sUrlBase = oInputParameterHandler.getValue('siteUrlbase') sMaxpage = oInputParameterHandler.getValue('MaxPage') sTest = '%s?site=%s' % (sPluginPath, sId) sTest = sTest +'&function=showPage&siteUrlbase=' + urllib.quote(sUrlBase) + '&MaxPage=' + str(sMaxpage) xbmc.executebuiltin('XBMC.Container.Update(%s, replace)' % sTest )
def getDownload(self): oGui = cGui() sPluginHandle = cPluginHandler().getPluginHandle() sPluginPath = cPluginHandler().getPluginPath() sItemUrl = '%s?site=%s&function=%s&title=%s' % ( sPluginPath, SITE_IDENTIFIER, 'StartDownloadList', 'tittle') meta = {'title': 'Demarrer la liste'} item = xbmcgui.ListItem('Demarrer la liste', iconImage=cConfig().getRootArt() + 'download.png') item.setProperty("Fanart_Image", cConfig().getSetting('images_downloads')) #item.setInfo(type="Video", infoLabels = meta) #item.setProperty("Video", "false") #item.setProperty("IsPlayable", "false") xbmcplugin.addDirectoryItem(sPluginHandle, sItemUrl, item, isFolder=False) oOutputParameterHandler = cOutputParameterHandler() oGui.addDir(SITE_IDENTIFIER, 'StopDownloadList', 'Arreter les Téléchargements', 'download.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oGui.addDir(SITE_IDENTIFIER, 'getDownloadList', 'Liste de Téléchargement', 'download.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oGui.addDir(SITE_IDENTIFIER, 'CleanDownloadList', 'Nettoyer la liste (Fichiers finis)', 'download.png', oOutputParameterHandler) oGui.setEndOfDirectory()
def getDownload(self): oGui = cGui() sPluginHandle = cPluginHandler().getPluginHandle() sPluginPath = cPluginHandler().getPluginPath() sItemUrl = '%s?site=%s&function=%s&title=%s' % ( sPluginPath, SITE_IDENTIFIER, 'StartDownloadList', 'title') meta = {'title': 'Démarrer la liste'} item = xbmcgui.ListItem( 'Démarrer la liste', iconImage= 'special://home/addons/plugin.video.vstream/resources/art/download.png' ) #item.setInfo(type='Video', infoLabels = meta) #item.setProperty('Video', 'false') #item.setProperty('IsPlayable', 'false') xbmcplugin.addDirectoryItem(sPluginHandle, sItemUrl, item, isFolder=False) oOutputParameterHandler = cOutputParameterHandler() oGui.addDir(SITE_IDENTIFIER, 'StopDownloadList', 'Arrêter les Téléchargements', 'download.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oGui.addDir(SITE_IDENTIFIER, 'getDownloadList', 'Liste de Téléchargement', 'az.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oGui.addDir(SITE_IDENTIFIER, 'CleanDownloadList', 'Nettoyer la liste (Fichiers finis)', 'download.png', oOutputParameterHandler) oGui.setEndOfDirectory()
def getDownload(self): oGui = cGui() sPluginHandle = cPluginHandler().getPluginHandle() sPluginPath = cPluginHandler().getPluginPath() sItemUrl = '%s?site=%s&function=%s&title=%s' % ( sPluginPath, SITE_IDENTIFIER, 'StartDownloadList', 'title') # meta = {'title': 'Démarrer la liste'} item = xbmcgui.ListItem('Démarrer la liste') item.setArt({ 'icon': 'special://home/addons/plugin.video.vstream/resources/art/download.png' }) # item.setInfo(type='Video', infoLabels=meta) # item.setProperty('Video', 'false') # item.setProperty('IsPlayable', 'false') xbmcplugin.addDirectoryItem(sPluginHandle, sItemUrl, item, isFolder=False) oOutputParameterHandler = cOutputParameterHandler() oGui.addDir(SITE_IDENTIFIER, 'StopDownloadList', self.ADDON.VSlang(30025), 'download.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oGui.addDir(SITE_IDENTIFIER, 'getDownloadList', self.ADDON.VSlang(30039), 'listes.png', oOutputParameterHandler) oOutputParameterHandler = cOutputParameterHandler() oGui.addDir(SITE_IDENTIFIER, 'CleanDownloadList', self.ADDON.VSlang(30040), 'download.png', oOutputParameterHandler) oGui.setEndOfDirectory()
def showSources(self): oGui = cGui() oPluginHandler = cPluginHandler() aPlugins = oPluginHandler.getAvailablePlugins() for aPlugin in aPlugins: oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', 'http://primatech') icon = 'sites/%s.png' % (aPlugin[1]) oGui.addDir(aPlugin[1], 'load', aPlugin[0], icon, oOutputParameterHandler) oGui.setEndOfDirectory()
def searchGlobal(sSearchText=False): import threading oGui = cGui() oGui.globalSearch = True oGui._collectMode = True if not sSearchText: sSearchText = oGui.showKeyBoard() if not sSearchText: return True aPlugins = [] aPlugins = cPluginHandler().getAvailablePlugins() dialog = xbmcgui.DialogProgress() dialog.create('xStream', "Searching...") numPlugins = len(aPlugins) threads = [] for count, pluginEntry in enumerate(aPlugins): if not pluginEntry['globalsearch']: continue dialog.update((count + 1) * 50 / numPlugins, 'Searching: ' + str(pluginEntry['name']) + '...') logger.info('Searching for %s at %s' % (sSearchText.decode('utf-8'), pluginEntry['id'])) t = threading.Thread(target=_pluginSearch, args=(pluginEntry, sSearchText, oGui), name=pluginEntry['name']) threads += [t] t.start() for count, t in enumerate(threads): t.join() dialog.update((count + 1) * 50 / numPlugins + 50, t.getName() + ' returned') dialog.close() # deactivate collectMode attribute because now we want the elements really added oGui._collectMode = False total = len(oGui.searchResults) dialog = xbmcgui.DialogProgress() dialog.create('xStream', "Gathering info...") for count, result in enumerate( sorted(oGui.searchResults, key=lambda k: k['guiElement'].getSiteName()), 1): oGui.addFolder(result['guiElement'], result['params'], bIsFolder=result['isFolder'], iTotal=total) dialog.update( count * 100 / total, str(count) + ' of ' + str(total) + ': ' + result['guiElement'].getTitle()) dialog.close() oGui.setView() oGui.setEndOfDirectory() return True
def run(self, oGuiElement, sTitle, sUrl): sPluginHandle = cPluginHandler().getPluginHandle(); meta = oGuiElement.getInfoLabel() #meta = {'label': sTitle, 'title': sTitle} item = xbmcgui.ListItem(path=sUrl, iconImage="DefaultVideo.png") item.setInfo( type="Video", infoLabels= meta ) xbmcplugin.setResolvedUrl(sPluginHandle, True, item) while not xbmc.abortRequested: try: self.currentTime = self.getTime() self.totalTime = self.getTotalTime() except: break xbmc.sleep(1000)
def run(self, oGuiElement, sTitle, sUrl): sPluginHandle = cPluginHandler().getPluginHandle(); #meta = oGuiElement.getInfoLabel() meta = {'label': sTitle, 'title': sTitle} item = xbmcgui.ListItem(path=sUrl, iconImage="DefaultVideo.png") item.setInfo( type="Video", infoLabels= meta ) xbmcplugin.setResolvedUrl(sPluginHandle, True, item) while not xbmc.abortRequested: try: self.currentTime = self.getTime() self.totalTime = self.getTotalTime() except: break xbmc.sleep(1000)
def viewsimil(self): sPluginPath = cPluginHandler().getPluginPath(); oInputParameterHandler = cInputParameterHandler() sTitle = oInputParameterHandler.getValue('sTitle') oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('searchtext', sTitle) oOutputParameterHandler.addParameter('disp', 'search1') oOutputParameterHandler.addParameter('readdb', 'False') sParams = oOutputParameterHandler.getParameterAsUri() sTest = '%s?site=%s&function=%s&%s' % (sPluginPath, 'cHome', 'searchMovie', sParams) xbmc.executebuiltin('XBMC.Container.Update(%s)' % sTest ) return False
def VstreamSearch(sMovieTitle): sPluginPath = cPluginHandler().getPluginPath(); oInputParameterHandler = cInputParameterHandler() sUrl = oInputParameterHandler.getValue('siteUrl') oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('searchtext', str(sMovieTitle)) oOutputParameterHandler.addParameter('siteUrl', 'http://') sParams = oOutputParameterHandler.getParameterAsUri() sTest = '%s?site=%s&function=%s&%s' % (sPluginPath, 'globalSearch', 'load', sParams) xbmc.executebuiltin('XBMC.Container.Update(%s)' % sTest )
def __ContextMenuPlay(self, oGuiElement, oListItem): sPluginPath = cPluginHandler().getPluginPath() aContextMenus = [] if len(oGuiElement.getContextItems()) > 0: for oContextItem in oGuiElement.getContextItems(): oOutputParameterHandler = oContextItem.getOutputParameterHandler() sParams = oOutputParameterHandler.getParameterAsUri() sTest = '%s?site=%s&function=%s&%s' % (sPluginPath, oContextItem.getFile(), oContextItem.getFunction(), sParams) aContextMenus += [(oContextItem.getTitle(), 'RunPlugin(%s)' % sTest)] oListItem.addContextMenuItems(aContextMenus) return oListItem
def __createContextMenu(self, oGuiElement, oListItem, bIsFolder, sItemUrl, oOutputParams=''): sPluginPath = cPluginHandler().getPluginPath() aContextMenus = [] if len(oGuiElement.getContextItems()) > 0: for oContextItem in oGuiElement.getContextItems(): oOutputParameterHandler = oContextItem.getOutputParameterHandler() sParams = oOutputParameterHandler.getParameterAsUri() sTest = "%s?site=%s&function=%s&%s" % (sPluginPath, oContextItem.getFile(), oContextItem.getFunction(), sParams) aContextMenus+= [ ( oContextItem.getTitle(), "XBMC.RunPlugin(%s)" % (sTest,),)] oContextItem = cContextElement() oContextItem.setTitle("Info") aContextMenus+= [ ( oContextItem.getTitle(), "XBMC.Action(Info)",)] itemValues = oGuiElement.getItemValues() if 'imdb_id' in itemValues and 'title' in itemValues: metaParams = {} if itemValues['title']: metaParams['title'] = itemValues['title'] if 'mediaType' in itemValues and itemValues['mediaType']: metaParams['mediaType'] = itemValues['mediaType'] elif 'TVShowTitle' in itemValues and itemValues['TVShowTitle']: metaParams['mediaType'] = 'tvshow' else: metaParams['mediaType'] = 'movie' if 'season' in itemValues and itemValues['season'] and int(itemValues['season'])>0: metaParams['season'] = itemValues['season'] metaParams['mediaType'] = 'season' if ( 'episode' in itemValues and itemValues['episode'] and int(itemValues['episode'])>0 and 'season' in itemValues and itemValues['season'] and int(itemValues['season']) ): metaParams['episode'] = itemValues['episode'] metaParams['mediaType'] = 'episode' if itemValues['imdb_id']: metaParams['imdbID'] = itemValues['imdb_id'] oContextItem.setTitle("gesehen/ungesehen") aContextMenus+= [ ( oContextItem.getTitle(), "XBMC.RunPlugin(%s?function=changeWatched&%s)" % (sPluginPath, urllib.urlencode(metaParams),),)] if 'year' in itemValues and itemValues['year']: metaParams['year'] = itemValues['year'] oContextItem.setTitle("Suche Metainfos") aContextMenus+= [ ( oContextItem.getTitle(), "XBMC.RunPlugin(%s?function=updateMeta&%s)" % (sPluginPath, urllib.urlencode(metaParams),),)] if not bIsFolder: oContextItem.setTitle("add to Playlist") aContextMenus+= [ ( oContextItem.getTitle(), "XBMC.RunPlugin(%s&playMode=enqueue)" % (sItemUrl,),)] oContextItem.setTitle("download") aContextMenus+= [ ( oContextItem.getTitle(), "XBMC.RunPlugin(%s&playMode=download)" % (sItemUrl,),)] oContextItem.setTitle("send to JDownloader") aContextMenus+= [ ( oContextItem.getTitle(), "XBMC.RunPlugin(%s&playMode=jd)" % (sItemUrl,),)] oListItem.addContextMenuItems(aContextMenus) #oListItem.addContextMenuItems(aContextMenus, True) return oListItem
def __ContextMenuPlay(self, oGuiElement, oListItem): sPluginPath = cPluginHandler().getPluginPath(); aContextMenus = [] if (len(oGuiElement.getContextItems()) > 0): for oContextItem in oGuiElement.getContextItems(): oOutputParameterHandler = oContextItem.getOutputParameterHandler() sParams = oOutputParameterHandler.getParameterAsUri() sTest = '%s?site=%s&function=%s&%s' % (sPluginPath, oContextItem.getFile(), oContextItem.getFunction(), sParams) aContextMenus+= [ ( oContextItem.getTitle(), "XBMC.RunPlugin(%s)" % (sTest,),)] oListItem.addContextMenuItems(aContextMenus) #oListItem.addContextMenuItems(aContextMenus, True) return oListItem
def __callpluging(self, sFunction, sVar, sTitle, sIcon): oGui = cGui() oPluginHandler = cPluginHandler() aPlugins = oPluginHandler.getAvailablePlugins() for aPlugin in aPlugins: try: exec "import "+aPlugin[1] exec "sSiteUrl = "+aPlugin[1]+"."+sVar oOutputParameterHandler = cOutputParameterHandler() oOutputParameterHandler.addParameter('siteUrl', sSiteUrl) oGui.addDir(aPlugin[1], sFunction, sTitle+' - [COLOR azure]'+aPlugin[0]+'[/COLOR]', sIcon, oOutputParameterHandler) except: pass oGui.setEndOfDirectory()
def setEndOfDirectory(self): iHandler = cPluginHandler().getPluginHandle() xbmcplugin.setPluginCategory(iHandler, "") # add some sort methods, these will be present in all views xbmcplugin.addSortMethod(iHandler, xbmcplugin.SORT_METHOD_UNSORTED) xbmcplugin.addSortMethod(iHandler, xbmcplugin.SORT_METHOD_LABEL) xbmcplugin.addSortMethod(iHandler, xbmcplugin.SORT_METHOD_DATE) xbmcplugin.addSortMethod(iHandler, xbmcplugin.SORT_METHOD_SIZE) xbmcplugin.addSortMethod(iHandler, xbmcplugin.SORT_METHOD_VIDEO_RATING) xbmcplugin.addSortMethod(iHandler, xbmcplugin.SORT_METHOD_DATE) xbmcplugin.addSortMethod(iHandler, xbmcplugin.SORT_METHOD_PROGRAM_COUNT) xbmcplugin.addSortMethod(iHandler, xbmcplugin.SORT_METHOD_VIDEO_RUNTIME) xbmcplugin.addSortMethod(iHandler, xbmcplugin.SORT_METHOD_GENRE) xbmcplugin.endOfDirectory(iHandler, True)