Пример #1
0
 def SelectionneVue(self):
     content_type = utils.VueActuelle()
     if not content_type:
         content_type = "files"
     current_view = xbmc.getInfoLabel("Container.Viewmode").decode("utf-8")
     utils.ModeVues(content_type, current_view)
Пример #2
0
    def __init__(self):

        self._init_vars()
        self.ui = None
        self.windowhome.setProperty("IconMixDataPath", ADDON_DATA_PATH)

        #get params
        action = None
        try:
            params = urlparse.parse_qs(sys.argv[2][1:].decode("utf-8"))

            if params:
                #logMsg("Plugin : %s" %(params),0)
                path = params.get("path", None)
                if path: path = path[0]
                limit = params.get("limit", None)
                if limit: limit = int(limit[0])
                else: limit = 25
                action = params.get("action", None)
                if action: action = action[0].upper()

            if action:
                if action == "GETGENRE":
                    genre = params.get("genre", None)
                    if genre: genre = genre[0]

                    genretype = params.get("genretype", None)
                    if genretype: genretype = genretype[0]
                    origtitle = params.get("title", None)
                    if origtitle: origtitle = origtitle[0]
                    #if origtitle and genre and genretype:
                    utils.getGenre(genre, genretype, origtitle)

                if action == "GETCAST":
                    Id = params.get("id", None)
                    if Id: Id = Id[0]
                    castingtype = params.get("casttype", None)
                    if castingtype: castingtype = castingtype[0]
                    utils.getCasting(castingtype, Id)

                if action == "GETEPISODESKODI":
                    Id = params.get("id", None)
                    if Id: Id = Id[0]
                    Episodes = utils.GetEpisodesKodi(Id, False)
                    if Episodes:
                        xbmcplugin.addDirectoryItems(int(sys.argv[1]),
                                                     Episodes)
                    xbmcplugin.endOfDirectory(int(sys.argv[1]))
                    OldTvShowId = self.windowhome.getProperty(
                        'IconmixFlagPanelEpisode')
                    if OldTvShowId != Id:
                        self.windowhome.clearProperty(
                            'IconmixFlagPanelEpisode')

                if action == "GETARTISTEART":
                    Id = params.get("id", None)
                    if Id: Id = Id[0]
                    castingtype = params.get("casttype", None)
                    if castingtype: castingtype = castingtype[0]
                    Id = xbmc.getInfoLabel("ListItem.DBID")
                    utils.getArtisteArt(castingtype, Id)

                if action == "GETMENUVIEW":
                    if (len(sys.argv) > 1 and sys.argv[1]):
                        content_type = utils.VueActuelle()
                        if not content_type:
                            content_type = "files"
                        current_view = xbmc.getInfoLabel(
                            "Container.Viewmode").decode("utf-8")

                        ListeVues = utils.ModeVuesMenu(content_type,
                                                       current_view)
                        if ListeVues:
                            #logMsg("ListeVues ok (%s)" %(ListeVues))
                            xbmcplugin.addDirectoryItems(
                                int(sys.argv[1]), ListeVues)
                        xbmcplugin.endOfDirectory(int(sys.argv[1]))
        except:
            params = {}

        try:
            params = dict(arg.split('=') for arg in sys.argv[1].split('&'))
        except:
            params = {}

        self.trailer = params.get('trailer', False)
        self.trailerTypeVideo = params.get('dbtype', None)
        self.trailerTitre = params.get('label', None)
        self.trailerAnnee = params.get('year', None)
        self.trailerKODIID = params.get('dbid', None)
        self.trailerIMDBID = params.get('imdbnumber', None)
        self.trailerTMDBID = params.get('tmdbnumber', None)

        self.setview = params.get('setview', False)
        self.setviewmenu = params.get('setviewmenu', False)
        if self.setviewmenu:
            self.idview = params.get('id', None)
            #logMsg("On y est !!! (%s)(%s)" %(self.idview,params))

        self.videcache = params.get('videcache', False)
        self.addplaylist = params.get('addplaylist', False)
        self.supplaylist = params.get('supplaylist', False)
        self.updateallmusic = params.get('updateallmusic', False)
        self.mettreajour = params.get('mettreajour', False)
        self.backend = params.get('backend', False)
        self.updateacteursinf = params.get('updateacteursinf', False)
        if self.updateacteursinf:
            self.itemidkodi = params.get('idkodi', None)
            self.itemidtmdb = params.get('idtmb', None)
        self.showinfo = params.get('showinfo', False)

        if self.videcache:
            self.quelcache = params.get('cache', False)
            dialogC = xbmcgui.Dialog()
            ret = dialogC.yesno(
                "ICONMIXTOOLS CACHE !!!", __language__(32602), " ",
                str(self.quelcache).upper())  #-- Show a dialog 'YES/NO'.
            if ret > 0:
                utils.vidercache(self.quelcache)

        else:

            if not action:
                saga = ""
                #------ lancer mode serveur -----------
                if self.backend and xbmc.getCondVisibility(
                        "String.IsEmpty(Window(home).Property(IconMixToolsbackend))"
                ):
                    MainService.MainService()

                #-------------METTRE A JOUR SAGA ou SERIE-------------
                if self.mettreajour:
                    self.MiseAJour()

                #-------------BANDES ANNONCES-------------
                if self.trailer:
                    self.GetTrailer()

                #-------------CHOIX DE LA VUE-------------
                if self.setview:
                    self.SelectionneVue()

                if self.setviewmenu and self.idview:
                    xbmc.executebuiltin("Container.SetViewMode(%s)" %
                                        self.idview)

            #     self.SelectionneVueMenu()

#{"jsonrpc":"2.0","method":"Playlist.Add","id":-2067158130,"params":{"playlistid":0,"item":{"directory":"special://profile/playlists/music/Long Tracks.xsp"}}}
#{"jsonrpc":"2.0","method":"Player.Open","id":1877953368,"params":{"options":{"shuffled":true},"item":{"playlistid":0,"position":0}}}
#-------------AJOUTER A UNE PLAYLIST-------------
                if self.addplaylist:
                    utils.AddToPlayList()
                #-------------SUPPRIMER D'UNE PLAYLIST-------------
                if self.supplaylist:
                    utils.DelFromPlayList()

                if self.updateacteursinf and self.windowhome.getProperty(
                        'IconmixShowInfo') == "1":
                    ListeActeurs = self.GetControl(self.windowvideoinf, 1998)
                    #ACTEURS  ------------------------------------------------
                    if ListeActeurs:
                        ListeItemx = utils.getCasting("movie", self.itemidkodi,
                                                      1, self.itemidtmdb)
                        ListeActeurs.reset()
                        if ListeItemx:
                            #logMsg("Acteursinf.....")
                            for itemX in ListeItemx:
                                ListeActeurs.addItem(itemX)

                        status = ""