Пример #1
0
        def onInit(self):
            #par default le resumer#
            color = ADDON.getSetting('deco_color')
            window(10000).setProperty('color', color)

            self.getControl(50).setVisible(False)
            self.getControl(5200).setVisible(False)
            #self.getControl(50).reset()
            listitems = []
            cast = []
        
            try:
                for slabel, slabel2, sicon, sid in meta['cast']:
                    listitem_ = listitem(label = slabel, label2=slabel2, iconImage=sicon)
                #listitem.setInfo('video', {'Title': 'test', 'RatingAndVotes':'6.8'})
                    listitem_.setProperty('id', str(sid))
                    listitems.append(listitem_)
                    cast.append(slabel.encode('ascii', 'ignore'))
                self.getControl(50).addItems(listitems)
                window(10000).setProperty('ListItem.casting', str(cast))
            except: pass
            #title
            #self.getControl(1).setLabel(meta['title'])
            meta['title'] = sTitle

            #self.getControl(49).setVisible(True)
            #self.getControl(2).setImage(meta['cover_url'])
            #self.getControl(3).setLabel(meta['rating'])
 
            for e in meta:
                property = 'ListItem.%s' %(e)
                if isinstance(meta[e], unicode):
                    window(10000).setProperty(property, meta[e].encode('utf-8'))
                else:
                    window(10000).setProperty(property, str(meta[e]))
Пример #2
0
    def showHistory(self):
        oGui = cGui()

        row = cDb().get_history()
        if row:
            oGui.addText(SITE_IDENTIFIER, self.addons.VSlang(30416))
        else:
            oGui.addText(SITE_IDENTIFIER)
        for match in row:
            oOutputParameterHandler = cOutputParameterHandler()

            # code to get type with disp
            sType = self.addons.getSetting('search' + match[2][-1:] + '_type')
            if sType:
                oOutputParameterHandler.addParameter('type', sType)
                window(10101).setProperty('search_type', sType)

            oOutputParameterHandler.addParameter('siteUrl', 'http://venom')
            oOutputParameterHandler.addParameter('searchtext', match[1])
            # oOutputParameterHandler.addParameter('disp', match[2])
            # oOutputParameterHandler.addParameter('readdb', 'False')

            oGuiElement = cGuiElement()
            oGuiElement.setSiteName('globalSearch')
            oGuiElement.setFunction('globalSearch')

            try:
                oGuiElement.setTitle('- ' + match[1])
            except:
                oGuiElement.setTitle('- ' + str(match[1], 'utf-8'))

            oGuiElement.setFileName(match[1])
            oGuiElement.setCat(match[2])
            oGuiElement.setIcon('search.png')
            oGui.CreateSimpleMenu(oGuiElement, oOutputParameterHandler,
                                  SITE_IDENTIFIER, 'cHome', 'delSearch',
                                  self.addons.VSlang(30412))
            oGui.addFolder(oGuiElement, oOutputParameterHandler)

        if row:
            oOutputParameterHandler = cOutputParameterHandler()
            oOutputParameterHandler.addParameter('siteUrl', 'http://venom')
            oGui.addDir(SITE_IDENTIFIER, 'delSearch',
                        self.addons.VSlang(30413), 'search.png',
                        oOutputParameterHandler)

        oGui.setEndOfDirectory()
Пример #3
0
    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))
Пример #4
0
def _pluginSearch(plugin, sSearchText):

    # Appeler la source en mode Recherche globale
    window(10101).setProperty('search', 'true')
    
    try:
        plugins = __import__('resources.sites.%s' % plugin['identifier'], fromlist=[plugin['identifier']])
        function = getattr(plugins, plugin['search'][1])
        sUrl = plugin['search'][0] + str(sSearchText)
        
        function(sUrl)
        
        VSlog('Load Search: ' + str(plugin['identifier']))
    except:
        VSlog(plugin['identifier'] + ': search failed')

    window(10101).setProperty('search', 'false')
Пример #5
0
    def showHistory(self):

        oGui = cGui()

        row = cDb().get_history()
        if row:
            oGui.addText(SITE_IDENTIFIER, self.ADDON.VSlang(30416))
        else :
            oGui.addText(SITE_IDENTIFIER)
        for match in row:
            oOutputParameterHandler = cOutputParameterHandler()

            #code to get type with disp
            type = self.ADDON.getSetting('search' + match[2][-1:] + '_type')
            if type:
                oOutputParameterHandler.addParameter('type', type)
                #xbmcgui.Window(10101).setProperty('search_type', type)
                window(10101).setProperty('search_type', type)

            oOutputParameterHandler.addParameter('siteUrl', 'http://venom')
            oOutputParameterHandler.addParameter('searchtext', match[1])
            #oOutputParameterHandler.addParameter('disp', match[2])
            #oOutputParameterHandler.addParameter('readdb', 'False')

            oGuiElement = cGuiElement()
            oGuiElement.setSiteName('globalSearch')
            oGuiElement.setFunction('globalSearch')
            oGuiElement.setTitle("- " + match[1])
            oGuiElement.setFileName(match[1])
            oGuiElement.setCat(match[2])
            oGuiElement.setIcon("search.png")
            oGui.CreateSimpleMenu(oGuiElement,oOutputParameterHandler,SITE_IDENTIFIER,'cHome','delSearch', self.ADDON.VSlang(30412))
            oGui.addFolder(oGuiElement, oOutputParameterHandler)

        if row:

            oOutputParameterHandler = cOutputParameterHandler()
            oOutputParameterHandler.addParameter('siteUrl', 'http://venom')
            oGui.addDir(SITE_IDENTIFIER, 'delSearch', self.ADDON.VSlang(30413), 'search.png', oOutputParameterHandler)

        oGui.setEndOfDirectory()
Пример #6
0
 def TextBoxes(self, heading, anounce):
     # activate the text viewer window
     xbmc.executebuiltin( "ActivateWindow(%d)" % ( 10147, ) )
     # get window
     win = window(10147)
     #win.show()
     # give window time to initialize
     xbmc.sleep(100)
     # set heading
     win.getControl(1).setLabel(heading)
     win.getControl(5).setText(anounce)
     return
Пример #7
0
 def TextBoxes(self, heading, anounce):
     # activate the text viewer window
     xbmc.executebuiltin( "ActivateWindow(%d)" % ( 10147, ) )
     # get window
     win = window(10147)
     #win.show()
     # give window time to initialize
     xbmc.sleep(100)
     # set heading
     win.getControl(1).setLabel(heading)
     win.getControl(5).setText(anounce)
     return
Пример #8
0
        def person(self, sid=""):
            from resources.lib.tmdb import cTMDb
            grab = cTMDb(lang='en')
            sUrl = 'person/' + str(sid)
            meta = grab.getUrl(sUrl)

            listitems = []

            try:
                try:
                    sTitle = unicodedata.normalize('NFKD', meta['name']).encode('ascii', 'ignore')
                except: sTitle = "Aucune information"
                #xbmcgui.Window(10000).setProperty('person_name', sTitle)
                try:
                    sThumbnail = 'https://image.tmdb.org/t/p/w396' + meta['profile_path']
                except:
                    sThumbnail = ''
                sId = meta['id']


                bio = meta['biography'].replace('\n\n', '[CR]').replace('\n', '[CR]')

                #self.getControl(5300).setLabel('[COLOR gold]test[/COLOR]')

                #window(10000).setProperty('biography', bio)
                window(10000).setProperty('birthday', meta['birthday'])
                window(10000).setProperty('place_of_birth', meta['place_of_birth'])
                window(10000).setProperty('deathday', meta['deathday'])

                #self.getControl(20).setVisible(True)
            except: pass
Пример #9
0
        def person(self, sid=""):
            from resources.lib.tmdb import cTMDb
            grab = cTMDb(lang='en')
            sUrl = 'person/' + str(sid)
            meta = grab.getUrl(sUrl)

            listitems = []

            try:
                try:
                    sTitle = unicodedata.normalize('NFKD', meta['name']).encode('ascii','ignore')
                except: sTitle = "Aucune information"
                #xbmcgui.Window(10000).setProperty('person_name', sTitle)
                try:
                    sThumbnail = 'https://image.tmdb.org/t/p/w396' + meta['profile_path']
                except:
                    sThumbnail = ''
                sId = meta['id']


                bio = meta['biography'].replace('\n\n', '[CR]').replace('\n', '[CR]')

                #self.getControl(5300).setLabel('[COLOR gold]test[/COLOR]')

                #window(10000).setProperty('biography', bio)
                window(10000).setProperty('birthday', meta['birthday'])
                window(10000).setProperty('place_of_birth', meta['place_of_birth'])
                window(10000).setProperty('deathday', meta['deathday'])

                #self.getControl(20).setVisible(True)
            except: pass
Пример #10
0
        def person(self, sid=''):
            grab = cTMDb(lang='en')
            sUrl = 'person/' + str(sid)
            meta = grab.getUrl(sUrl)

            try:
                try:
                    sTitle = unicodedata.normalize('NFKD',
                                                   meta['name']).encode(
                                                       'ascii', 'ignore')
                except:
                    sTitle = 'Aucune information'
                try:
                    sThumbnail = 'https://image.tmdb.org/t/p/w396' + meta[
                        'profile_path']
                except:
                    sThumbnail = ''

                sId = meta['id']
                # bio = meta['biography'].replace('\n\n', '[CR]').replace('\n', '[CR]')

                # self.getControl(5300).setLabel('[COLOR gold]test[/COLOR]')

                # window(10000).setProperty('biography', bio)
                window(10000).setProperty('birthday', meta['birthday'])
                window(10000).setProperty('place_of_birth',
                                          meta['place_of_birth'])
                window(10000).setProperty('deathday', meta['deathday'])
            except:
                pass
Пример #11
0
 def TextBoxes(self, anounce):
     # activate the text viewer window
     xbmc.executebuiltin("ActivateWindow(%d)" % (10147, ))
     # get window
     win = window(10147)
     #win.show()
     # give window time to initialize
     xbmc.sleep(100)
     # set heading
     win.getControl(1).setLabel("vStream mise à jour")
     win.getControl(5).setText(anounce)
     while xbmc.getCondVisibility("Window.IsActive(10147)"):
         xbmc.sleep(100)
     ret = dialog().VSok('Mise à jour terminée')
     return
Пример #12
0
 def TextBoxes(self, anounce):
     addons = addon()
     # activate the text viewer window
     xbmc.executebuiltin('ActivateWindow(%d)' % (10147))
     # get window
     win = window(10147)
     # win.show()
     # give window time to initialize
     xbmc.sleep(100)
     # set heading
     win.getControl(1).setLabel(addons.VSlang(30013))
     win.getControl(5).setText(anounce)
     while xbmc.getCondVisibility('Window.IsActive(10147)'):
         xbmc.sleep(100)
     ret = dialog().VSok(addons.VSlang(30014))
     return
Пример #13
0
 def TextBoxes(self, anounce):
     # activate the text viewer window
     xbmc.executebuiltin( "ActivateWindow(%d)" % ( 10147, ) )
     # get window
     win = window(10147)
     #win.show()
     # give window time to initialize
     xbmc.sleep(100)
     # set heading
     win.getControl(1).setLabel("vStream mise à jour")
     win.getControl(5).setText(anounce)
     while xbmc.getCondVisibility("Window.IsActive(10147)"):
         xbmc.sleep(100)
     ret = dialog().VSok('Mise à jour terminée')
     if ret:
         xbmc.executebuiltin("Container.Refresh")
     return
Пример #14
0
    def addText(self, sId, sLabel='', sIcon='none.png'):

        # Pas de texte lors des recherches globales
        if window(10101).getProperty('search') == 'true':
            return

        oGuiElement = cGuiElement()
        oGuiElement.setSiteName(sId)
        oGuiElement.setFunction('DoNothing')
        if not sLabel:
            sLabel = self.ADDON.VSlang(30204)
        oGuiElement.setTitle(sLabel)
        oGuiElement.setIcon(sIcon)
        oGuiElement.setThumbnail(oGuiElement.getIcon())
        oGuiElement.setMeta(0)

        oOutputParameterHandler = cOutputParameterHandler()
        self.addFolder(oGuiElement, oOutputParameterHandler)
Пример #15
0
        def onInit(self):
            #par default le resumer#
            color = ADDON.getSetting('deco_color')
            window(10000).setProperty('color', color)

            self.getControl(50).setVisible(False)
            self.getControl(5200).setVisible(False)
            #synopsis_first
            self.setFocusId(36)

            #self.getControl(50).reset()
            listitems = []
            cast = []

            try:
                for slabel, slabel2, sicon, sid in meta['cast']:
                    listitem_ = listitem(label = slabel, label2=slabel2, iconImage=sicon)
                #listitem.setInfo('video', {'Title': 'test', 'RatingAndVotes':'6.8'})
                    listitem_.setProperty('id', str(sid))
                    listitems.append(listitem_)
                    cast.append(slabel.encode('ascii', 'ignore'))
                self.getControl(50).addItems(listitems)
                window(10000).setProperty('ListItem.casting', str(cast))
            except: pass
            #title
            #self.getControl(1).setLabel(meta['title'])
            meta['title'] = sTitle

            #self.getControl(49).setVisible(True)
            #self.getControl(2).setImage(meta['cover_url'])
            #self.getControl(3).setLabel(meta['rating'])

            for e in meta:
                property = 'ListItem.%s' %(e)
                if isinstance(meta[e], unicode):
                    window(10000).setProperty(property, meta[e].encode('utf-8'))
                else:
                    window(10000).setProperty(property, str(meta[e]))
Пример #16
0
def searchGlobal():
    cancel = False
    oGui = cGui()
    addons = addon()

    oInputParameterHandler = cInputParameterHandler()

    sSearchText = oInputParameterHandler.getValue('searchtext')
    sCat = oInputParameterHandler.getValue('sCat')

    oHandler = cRechercheHandler()
    oHandler.setText(sSearchText)
    oHandler.setCat(sCat)
    aPlugins = oHandler.getAvailablePlugins()
    if not aPlugins: return True
    total = len(aPlugins)

    #VSlog(str(aPlugins), xbmc.LOGNOTICE)

    progress_ = progress().VScreate()

    #kodi 17 vire la fenetre busy qui ce pose au dessus de la barre de Progress
    try:
        xbmc.executebuiltin("Dialog.Close(busydialog)")
    except: pass

    window(10101).setProperty('search', 'true')

    oGui.addText('globalSearch', addons.VSlang(30081) % (sSearchText), 'none.png')

    for count, plugin in enumerate(aPlugins):

        #text = '%s/%s - %s' % ((count+1), total, plugin['name'])
        progress_.VSupdatesearch(progress_, total, plugin['name'])
        if progress_.iscanceled():
            cancel = True
            progress_.close()
            break

        #nom du site
        oGui.addText(plugin['identifier'], '%s. [COLOR olive]%s[/COLOR]' % ((count+1), plugin['name']), 'sites/%s.png' % (plugin['identifier']))
        #recherche import
        _pluginSearch(plugin, sSearchText)

    window(10101).setProperty('search', 'false')
    #progress_.VSclose(progress_)

    #affichage
    total=len(oGui.searchResults)
    #progress_ = progress().VScreate()

    for count,result in enumerate(oGui.searchResults):
        #text = '%s/%s - %s' % ((count+1/total), total, result['guiElement'].getTitle())

        #if(count == 0):
        #    cConfig().updateDialogSearch(dialog, total, text,True)
        #else:
        #    cConfig().updateDialogSearch(dialog, total, text)
        progress_.VSupdatesearch(progress_, total, "Patience...")



        #result['params'].addParameter('VSTRMSEARCH', 'True')

        oGui.addFolder(result['guiElement'],result['params'])
        #VSlog('%s - %s' % (middle, old_label),  xbmc.LOGNOTICE)

        # if progress_.iscanceled():
        #     if cancel == True:
        #         continue
        #     else:
        #         break

    progress_.VSclose(progress_)

    oGui.setEndOfDirectory()

    return True
Пример #17
0
    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 ?
            'sYear': oGuiElement.setYear,
        }

        try:
            for sParam, callback in params.iteritems():
                value = oOutputParameterHandler.getValue(sParam)
                if value:
                    callback(value)

        except AttributeError:
            for sParam, callback in params.items():
                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)

        oOutputParameterHandler.addParameter('sTitleWatched', oGuiElement.getTitleWatched())

        # new context prend en charge les metas
        if oGuiElement.getMeta() in (1, 2, 3, 4):  # Films, Séries, Saga, Animes
            if cGui.CONTENT in ('movies', 'tvshows'):
                self.createContexMenuinfo(oGuiElement, oOutputParameterHandler)
                self.createContexMenuba(oGuiElement, oOutputParameterHandler)
                self.createContexMenuBookmark(oGuiElement, oOutputParameterHandler)

                if self.ADDON.getSetting('bstoken') != '':
                    self.createContexMenuTrakt(oGuiElement, oOutputParameterHandler)
                if self.ADDON.getSetting('tmdb_account') != '':
                    self.createContexMenuTMDB(oGuiElement, oOutputParameterHandler)
                self.createContexMenuSimil(oGuiElement, oOutputParameterHandler)
                self.createContexMenuWatch(oGuiElement, oOutputParameterHandler)

        oListItem = self.__createContextMenu(oGuiElement, oListItem)

        # sPluginHandle = cPluginHandler().getPluginHandle()
        # xbmcplugin.addDirectoryItem(sPluginHandle, sItemUrl, oListItem, isFolder=_isFolder)
        self.listing.append((sItemUrl, oListItem, _isFolder))
Пример #18
0
        def onClick(self, controlId):
            print(controlId)
            if controlId == 5:
                self.getControl(400).setVisible(False)
                self.getControl(50).setVisible(True)
                self.setFocusId(20)
                return
            elif controlId == 20:
                self.getControl(50).setVisible(False)
                self.getControl(400).setVisible(True)
                self.setFocusId(5)
                return
            elif controlId == 7:
                self.getControl(50).setVisible(True)
                self.setFocusId(50)
                return
            elif controlId == 11:
                from resources.lib.ba import cShowBA
                cBA = cShowBA()
                cBA.SetSearch(sFileName)
                cBA.SearchBA()
                self.close()
                return
            elif controlId == 30:
                self.close()
                return
            elif controlId == 50:
                # print(self.getControl(50).ListItem.Property('id'))
                item = self.getControl(50).getSelectedItem()
                sid = item.getProperty('id')

                grab = cTMDb()
                sUrl = 'person/' + str(sid) + '/movie_credits'
                try:
                    meta = grab.getUrl(sUrl)
                    meta = meta['cast']
                    self.credit(meta)
                except:
                    return
                # self.getControl(50).setVisible(True)
            # click sur similaire
            elif controlId == 9:
                # print(self.getControl(9000).ListItem.tmdb_id)
                sid = window(10000).getProperty('ListItem.tmdb_id')

                grab = cTMDb()
                sUrl = 'movie/%s/similar' % str(sid)
                try:
                    meta = grab.getUrl(sUrl)
                    meta = meta['results']
                    if meta:
                        self.credit(meta)
                    else:
                        self.getControl(9).setLabel('Aucune Information')
                except:
                    return
            # click sur recommendations
            elif controlId == 13:
                # print(self.getControl(9000).ListItem.tmdb_id)
                sid = window(10000).getProperty('ListItem.tmdb_id')

                grab = cTMDb()
                sUrl = 'movie/%s/recommendations' % str(sid)
                try:
                    meta = grab.getUrl(sUrl)
                    meta = meta['results']
                    if meta:
                        self.credit(meta)
                    else:
                        self.getControl(13).setLabel('Aucune Information')

                except:
                    return

            elif controlId == 5200:
                # click sur un film acteur
                import sys
                from resources.lib.util import cUtil
                item = self.getControl(5200).getSelectedItem()
                sTitle = item.getLabel()

                try:
                    sTitle = sTitle.encode('utf-8')
                    sTitle = cUtil().CleanName(sTitle)
                except:
                    return

                sTest = '%s?site=globalSearch&searchtext=%s&sCat=1' % (
                    sys.argv[0], sTitle)
                xbmc.executebuiltin('XBMC.Container.Update(%s)' % sTest)
                self.close()
                return
Пример #19
0
    def showSearch(self,
                   searchtext=cInputParameterHandler().getValue('searchtext')):

        if not searchtext:
            return self.showSearchText()

        #n'existe plus mais pas sure.
        #xbmcgui.Window(10101).clearProperty('search_text')
        window(10101).clearProperty('search_text')

        oGui = cGui()

        #print xbmc.getInfoLabel('ListItem.Property(Category)')

        oGui.addText('globalSearch',
                     self.ADDON.VSlang(30077) % (searchtext), 'none.png')

        #utilisation de guielement pour ajouter la bonne catégories

        oOutputParameterHandler = cOutputParameterHandler()
        oOutputParameterHandler.addParameter('siteUrl', 'http://venom')
        oOutputParameterHandler.addParameter('searchtext', searchtext)

        oGuiElement = cGuiElement()
        oGuiElement.setSiteName('globalSearch')
        oGuiElement.setFunction('showSearch')
        oGuiElement.setTitle(self.ADDON.VSlang(30078))
        oGuiElement.setFileName(self.ADDON.VSlang(30078))
        oGuiElement.setIcon('search.png')
        oGuiElement.setMeta(0)
        #oGuiElement.setThumbnail(sThumbnail)
        #oGuiElement.setFanart(sFanart)
        oGuiElement.setCat(1)

        oGui.addFolder(oGuiElement, oOutputParameterHandler)

        oOutputParameterHandler = cOutputParameterHandler()
        oOutputParameterHandler.addParameter('siteUrl', 'http://venom')
        oOutputParameterHandler.addParameter('searchtext', searchtext)

        oGuiElement = cGuiElement()
        oGuiElement.setSiteName('globalSearch')
        oGuiElement.setFunction('showSearch')
        oGuiElement.setTitle(self.ADDON.VSlang(30079))
        oGuiElement.setFileName(self.ADDON.VSlang(30079))
        oGuiElement.setIcon('search.png')
        oGuiElement.setMeta(0)
        #oGuiElement.setThumbnail(sThumbnail)
        #oGuiElement.setFanart(sFanart)
        oGuiElement.setCat(2)

        oGui.addFolder(oGuiElement, oOutputParameterHandler)

        oOutputParameterHandler = cOutputParameterHandler()
        oOutputParameterHandler.addParameter('siteUrl', 'http://venom')
        oOutputParameterHandler.addParameter('searchtext', searchtext)

        oGuiElement = cGuiElement()
        oGuiElement.setSiteName('globalSearch')
        oGuiElement.setFunction('showSearch')
        oGuiElement.setTitle(self.ADDON.VSlang(30080))
        oGuiElement.setFileName(self.ADDON.VSlang(30080))
        oGuiElement.setIcon('search.png')
        oGuiElement.setMeta(0)
        #oGuiElement.setThumbnail(sThumbnail)
        #oGuiElement.setFanart(sFanart)
        oGuiElement.setCat(3)

        oGui.addFolder(oGuiElement, oOutputParameterHandler)

        # oOutputParameterHandler = cOutputParameterHandler()
        # oOutputParameterHandler.addParameter('siteUrl', 'http://venom')
        # oOutputParameterHandler.addParameter('searchtext', searchtext)
        # oOutputParameterHandler.addParameter('disp', 'search10')
        # oOutputParameterHandler.addParameter('readdb', 'True')
        # oGui.addDir('globalSearch', 'showSearchText', '[COLOR orange]Recherche: Alluc_ee[/COLOR]', 'search.png', oOutputParameterHandler)

        oGui.setEndOfDirectory()
Пример #20
0
def searchGlobal():
    cancel = False
    oGui = cGui()
    addons = addon()

    oInputParameterHandler = cInputParameterHandler()

    sSearchText = oInputParameterHandler.getValue('searchtext')
    sCat = oInputParameterHandler.getValue('sCat')

    oHandler = cRechercheHandler()
    oHandler.setText(sSearchText)
    oHandler.setCat(sCat)
    aPlugins = oHandler.getAvailablePlugins()
    if not aPlugins: return True
    total = len(aPlugins)

    #VSlog(str(aPlugins), xbmc.LOGNOTICE)

    progress_ = progress().VScreate()
  
    #kodi 17 vire la fenetre busy qui ce pose au dessus de la barre de Progress
    try:
        xbmc.executebuiltin("Dialog.Close(busydialog)")
    except: pass
    
    window(10101).setProperty('search', 'true')

    oGui.addText('globalSearch', addons.VSlang(30081) % (sSearchText), 'none.png')

    for count, plugin in enumerate(aPlugins):

        #text = '%s/%s - %s' % ((count+1), total, plugin['name'])
        progress_.VSupdatesearch(progress_, total, plugin['name'])
        if progress_.iscanceled():
            cancel = True
            progress_.close()
            break

        #nom du site
        oGui.addText(plugin['identifier'], '%s. [COLOR olive]%s[/COLOR]' % ((count+1), plugin['name']), 'sites/%s.png' % (plugin['identifier']))
        #recherche import
        _pluginSearch(plugin, sSearchText)

    window(10101).setProperty('search', 'false')
    #progress_.VSclose(progress_)

    #affichage
    total=len(oGui.searchResults)
    #progress_ = progress().VScreate()

    for count,result in enumerate(oGui.searchResults):
        #text = '%s/%s - %s' % ((count+1/total), total, result['guiElement'].getTitle())

        #if(count == 0):
        #    cConfig().updateDialogSearch(dialog, total, text,True)
        #else:
        #    cConfig().updateDialogSearch(dialog, total, text)
        progress_.VSupdatesearch(progress_, total, "Patience...")



        #result['params'].addParameter('VSTRMSEARCH','True')

        oGui.addFolder(result['guiElement'],result['params'])
        #VSlog('%s - %s' % (middle,old_label),  xbmc.LOGNOTICE)

        # if progress_.iscanceled():
        #     if cancel == True:
        #         continue
        #     else:
        #         break

    progress_.VSclose(progress_)

    oGui.setEndOfDirectory()

    return True
Пример #21
0
    def showSearch(self, searchtext=None):

        if not searchtext:
            searchtext = cInputParameterHandler().getValue('searchtext')

        if not searchtext:
            return self.showSearchText()

        window(10101).clearProperty('search_text')

        oGui = cGui()
        oGui.addText('globalSearch',
                     self.addons.VSlang(30077) % searchtext, 'none.png')

        # utilisation de guielement pour ajouter la bonne catégorie
        oGuiElement = cGuiElement()
        oGuiElement.setSiteName('globalSearch')
        oGuiElement.setFunction('showSearch')
        oGuiElement.setIcon('search.png')
        oGuiElement.setMeta(0)
        # oGuiElement.setThumbnail(sThumbnail)
        # oGuiElement.setFanart(sFanart)

        # Recherche globale films
        oOutputParameterHandler = cOutputParameterHandler()
        oOutputParameterHandler.addParameter('siteUrl', 'http://venom')
        oOutputParameterHandler.addParameter('searchtext', searchtext)
        oGuiElement.setTitle(self.addons.VSlang(30078))
        oGuiElement.setFileName(self.addons.VSlang(30078))
        oGuiElement.setCat(1)
        oGui.addFolder(oGuiElement, oOutputParameterHandler)

        # Recherche globale séries
        oOutputParameterHandler.addParameter('siteUrl', 'http://venom')
        oOutputParameterHandler.addParameter('searchtext', searchtext)
        oGuiElement.setTitle(self.addons.VSlang(30079))
        oGuiElement.setFileName(self.addons.VSlang(30079))
        oGuiElement.setCat(2)
        oGui.addFolder(oGuiElement, oOutputParameterHandler)

        # Recherche globale Animés
        oOutputParameterHandler.addParameter('siteUrl', 'http://venom')
        oOutputParameterHandler.addParameter('searchtext', searchtext)
        oGuiElement.setTitle(self.addons.VSlang(30118))
        oGuiElement.setFileName(self.addons.VSlang(30118))
        oGuiElement.setCat(3)
        oGui.addFolder(oGuiElement, oOutputParameterHandler)

        # Recherche globale Dramas
        oOutputParameterHandler.addParameter('siteUrl', 'http://venom')
        oOutputParameterHandler.addParameter('searchtext', searchtext)
        oGuiElement.setTitle(self.addons.VSlang(30123))
        oGuiElement.setFileName(self.addons.VSlang(30123))
        oGuiElement.setCat(4)
        oGui.addFolder(oGuiElement, oOutputParameterHandler)

        # Recherche globale divers
        oOutputParameterHandler.addParameter('siteUrl', 'http://venom')
        oOutputParameterHandler.addParameter('searchtext', searchtext)
        oGuiElement.setTitle(self.addons.VSlang(30080))
        oGuiElement.setFileName(self.addons.VSlang(30080))
        oGuiElement.setCat(5)
        oGui.addFolder(oGuiElement, oOutputParameterHandler)

        # oOutputParameterHandler.addParameter('siteUrl', 'http://venom')
        # oOutputParameterHandler.addParameter('searchtext', searchtext)
        # oOutputParameterHandler.addParameter('disp', 'search10')
        # oOutputParameterHandler.addParameter('readdb', 'True')
        # oGui.addDir('globalSearch', 'showSearchText', 'self.addons.VSlang(30417), 'search.png', oOutputParameterHandler)

        oGui.setEndOfDirectory()
Пример #22
0
        def onClick(self, controlId):
            print controlId
            if controlId == 5:
                self.getControl(400).setVisible(False)
                self.getControl(50).setVisible(True)
                self.setFocusId(20)
                return
            elif controlId == 20:
                self.getControl(50).setVisible(False)
                self.getControl(400).setVisible(True)
                self.setFocusId(5)
                return
            elif controlId == 7:
                self.getControl(50).setVisible(True)
                self.setFocusId(50)
                return
            elif controlId == 11:
                from resources.lib.ba import cShowBA
                cBA = cShowBA()
                cBA.SetSearch(sFileName)
                cBA.SearchBA()
                self.close()
                return
            elif controlId == 30:
                self.close()
                return
            elif controlId == 50:
                #print self.getControl(50).ListItem.Property('id')
                item = self.getControl(50).getSelectedItem()
                sid = item.getProperty('id')

                from resources.lib.tmdb import cTMDb
                grab = cTMDb()
                sUrl = 'person/' + str(sid) + '/movie_credits'
                try:
                    meta = grab.getUrl(sUrl)
                    meta = meta['cast']
                    self.credit(meta)
                except:
                    return
                #self.getControl(50).setVisible(True)
            #click sur similaire
            elif controlId == 9:
                #print self.getControl(9000).ListItem.tmdb_id
                sid = window(10000).getProperty("ListItem.tmdb_id")

                from resources.lib.tmdb import cTMDb
                grab = cTMDb()
                sUrl = 'movie/%s/similar' % str(sid)
                try:
                    meta = grab.getUrl(sUrl)
                    meta = meta['results']
                    if meta:
                        self.credit(meta)
                    else:
                        self.getControl(9).setLabel("Aucune Information")
                except: return
            #click sur recommendations
            elif controlId == 13:
                #print self.getControl(9000).ListItem.tmdb_id
                sid = window(10000).getProperty("ListItem.tmdb_id")

                from resources.lib.tmdb import cTMDb
                grab = cTMDb()
                sUrl = 'movie/%s/recommendations' % str(sid)
                try:
                    meta = grab.getUrl(sUrl)
                    meta = meta['results']
                    if meta:
                        self.credit(meta)
                    else:
                        self.getControl(13).setLabel("Aucune Information")

                except: return

            elif controlId == 5200:
            #click sur un film acteur
                import sys
                from resources.lib.util import cUtil
                item = self.getControl(5200).getSelectedItem()
                sTitle = item.getLabel()

                try:
                    sTitle = sTitle.encode("utf-8")
                    sTitle = cUtil().CleanName(sTitle)
                except: return

                sTest = '%s?site=globalSearch&searchtext=%s&sCat=1' % (sys.argv[0], sTitle)
                xbmc.executebuiltin('XBMC.Container.Update(%s)' % sTest )
                self.close()
                return
Пример #23
0
    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,
            'sTmdbId': oGuiElement.setTmdbId,
            'sYear': oGuiElement.setYear
        }

        try:
            for sParam, callback in params.iteritems():
                value = oOutputParameterHandler.getValue(sParam)
                if value:
                    callback(value)

        except AttributeError:
            for sParam, callback in params.items():
                value = oOutputParameterHandler.getValue(sParam)
                if value:
                    callback(value)

        oListItem = self.createListItem(oGuiElement)
        oListItem.setProperty('IsPlayable', 'false')

        sCat = oGuiElement.getCat()
        if sCat:
            cGui.sCat = sCat
            oOutputParameterHandler.addParameter('sCat', sCat)

        sItemUrl = self.__createItemUrl(oGuiElement, oOutputParameterHandler)

        oOutputParameterHandler.addParameter('sTitleWatched',
                                             oGuiElement.getTitleWatched())

        if sCat:  # 1 = movies, moviePack; 2 = series, animes, episodes; 5 = MISC
            if oGuiElement.getMeta():
                self.createContexMenuinfo(oGuiElement, oOutputParameterHandler)
                self.createContexMenuba(oGuiElement, oOutputParameterHandler)
            if not oListItem.getProperty('isBookmark'):
                self.createContexMenuBookmark(oGuiElement,
                                              oOutputParameterHandler)

            if sCat in (1, 2):
                if self.ADDON.getSetting('bstoken') != '':
                    self.createContexMenuTrakt(oGuiElement,
                                               oOutputParameterHandler)
                if self.ADDON.getSetting('tmdb_account') != '':
                    self.createContexMenuTMDB(oGuiElement,
                                              oOutputParameterHandler)
                self.createContexMenuSimil(oGuiElement,
                                           oOutputParameterHandler)
            self.createContexMenuWatch(oGuiElement, oOutputParameterHandler)

        oListItem = self.__createContextMenu(oGuiElement, oListItem)
        self.listing.append((sItemUrl, oListItem, _isFolder))

        # Vider les paramètres pour être recyclé
        oOutputParameterHandler.clearParameter()
Пример #24
0
    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 ?
            "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)
                
                if self.ADDON.getSetting("bstoken"):
                    self.createContexMenuTrakt(oGuiElement, oOutputParameterHandler)
                if self.ADDON.getSetting('tmdb_account'):
                    self.createContexMenuTMDB(oGuiElement, oOutputParameterHandler)
                self.createContexMenuSimil(oGuiElement, oOutputParameterHandler)


            elif cGui.CONTENT == "tvshows":
                self.createContexMenuWatch(oGuiElement, oOutputParameterHandler)
                self.createContexMenuFav(oGuiElement, oOutputParameterHandler)
                
                self.createContexMenuinfo(oGuiElement, oOutputParameterHandler)
                self.createContexMenuba(oGuiElement, oOutputParameterHandler)
                
                if self.ADDON.getSetting("bstoken"):
                    self.createContexMenuTrakt(oGuiElement, oOutputParameterHandler)
                if self.ADDON.getSetting('tmdb_account'):
                    self.createContexMenuTMDB(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))
Пример #25
0
    def showSearch(self, searchtext=cInputParameterHandler().getValue('searchtext')):

        if not searchtext:
            return self.showSearchText()

        #n'existe plus mais pas sure.
        #xbmcgui.Window(10101).clearProperty('search_text')
        window(10101).clearProperty('search_text')

        oGui = cGui()

        #print xbmc.getInfoLabel('ListItem.Property(Category)')

        oGui.addText('globalSearch', self.ADDON.VSlang(30077) % (searchtext), 'none.png')

        #utilisation de guielement pour ajouter la bonne catégories

        oOutputParameterHandler = cOutputParameterHandler()
        oOutputParameterHandler.addParameter('siteUrl', 'http://venom')
        oOutputParameterHandler.addParameter('searchtext', searchtext)

        oGuiElement = cGuiElement()
        oGuiElement.setSiteName('globalSearch')
        oGuiElement.setFunction('showSearch')
        oGuiElement.setTitle(self.ADDON.VSlang(30078))
        oGuiElement.setFileName(self.ADDON.VSlang(30078))
        oGuiElement.setIcon('search.png')
        oGuiElement.setMeta(0)
        #oGuiElement.setThumbnail(sThumbnail)
        #oGuiElement.setFanart(sFanart)
        oGuiElement.setCat(1)

        oGui.addFolder(oGuiElement, oOutputParameterHandler)

        oOutputParameterHandler = cOutputParameterHandler()
        oOutputParameterHandler.addParameter('siteUrl', 'http://venom')
        oOutputParameterHandler.addParameter('searchtext', searchtext)

        oGuiElement = cGuiElement()
        oGuiElement.setSiteName('globalSearch')
        oGuiElement.setFunction('showSearch')
        oGuiElement.setTitle(self.ADDON.VSlang(30079))
        oGuiElement.setFileName(self.ADDON.VSlang(30079))
        oGuiElement.setIcon('search.png')
        oGuiElement.setMeta(0)
        #oGuiElement.setThumbnail(sThumbnail)
        #oGuiElement.setFanart(sFanart)
        oGuiElement.setCat(2)

        oGui.addFolder(oGuiElement, oOutputParameterHandler)

        oOutputParameterHandler = cOutputParameterHandler()
        oOutputParameterHandler.addParameter('siteUrl', 'http://venom')
        oOutputParameterHandler.addParameter('searchtext', searchtext)

        oGuiElement = cGuiElement()
        oGuiElement.setSiteName('globalSearch')
        oGuiElement.setFunction('showSearch')
        oGuiElement.setTitle(self.ADDON.VSlang(30080))
        oGuiElement.setFileName(self.ADDON.VSlang(30080))
        oGuiElement.setIcon('search.png')
        oGuiElement.setMeta(0)
        #oGuiElement.setThumbnail(sThumbnail)
        #oGuiElement.setFanart(sFanart)
        oGuiElement.setCat(3)

        oGui.addFolder(oGuiElement, oOutputParameterHandler)

        # oOutputParameterHandler = cOutputParameterHandler()
        # oOutputParameterHandler.addParameter('siteUrl', 'http://venom')
        # oOutputParameterHandler.addParameter('searchtext', searchtext)
        # oOutputParameterHandler.addParameter('disp', 'search10')
        # oOutputParameterHandler.addParameter('readdb', 'True')
        # oGui.addDir('globalSearch', 'showSearchText', '[COLOR orange]Recherche: Alluc_ee[/COLOR]', 'search.png', oOutputParameterHandler)

        oGui.setEndOfDirectory()