Exemple #1
0
    def run(self, argv=None):
        
        self.addon = Addon('plugin.video.SportsDevil', argv)

        common.log('SportsDevil running')
        
        base = argv[0]
        handle = int(argv[1])
        parameter = argv[2]
        self.base = base
        self.handle = handle
        
        paramstring = urllib.unquote_plus(parameter)
        
        try:
            
            # if addon is started
            listItemPath = xbmcUtils.getListItemPath()
            if not listItemPath.startswith(self.base):
                if not('mode=' in paramstring and not 'mode=1&' in paramstring):   
                    xbmcplugin.setPluginFanart(self.handle, common.Paths.pluginFanart)
                    self.clearCache()                    
                     
                    #if common.getSetting('autoupdate') == 'true':    
                    #    self.update()
            
            
            # Main Menu
            if len(paramstring) <= 2:                
                mainMenu = ListItem.create()
                mainMenu['url'] = self.MAIN_MENU_FILE
                tmpList = self.parseView(mainMenu)
                if tmpList:
                    self.currentlist = tmpList
                
            else:
                [mode, item] = self._parseParameters()

                # switch(mode)
                if mode == Mode.VIEW:
                    tmpList = self.parseView(item)
                    if tmpList:
                        self.currentlist = tmpList
                        count = len(self.currentlist.items)
                        if count == 1:
                            # Autoplay single video
                            autoplayEnabled = common.getSetting('autoplay') == 'true'
                            if autoplayEnabled:
                                videos = self.currentlist.getVideos()
                                if len(videos) == 1:
                                    self.playVideo(videos[0], True)


                elif mode == Mode.ADDITEM:
                    tmp = os.path.normpath(paramstring.split('url=')[1])
                    if tmp:
                        suffix = tmp.split(os.path.sep)[-1]
                        tmp = tmp.replace(suffix,'') + urllib.quote_plus(suffix)
                    if self.favouritesManager.add(tmp):
                        xbmc.executebuiltin('Container.Refresh()')


                elif mode in [Mode.ADDTOFAVOURITES, Mode.REMOVEFROMFAVOURITES, Mode.EDITITEM]:

                    if mode == Mode.ADDTOFAVOURITES:
                        self.favouritesManager.addItem(item)
                    elif mode == Mode.REMOVEFROMFAVOURITES:
                        self.favouritesManager.removeItem(item)
                        xbmc.executebuiltin('Container.Refresh()')
                    elif mode == Mode.EDITITEM:
                        if self.favouritesManager.editItem(item):
                            xbmc.executebuiltin('Container.Refresh()')


                elif mode == Mode.EXECUTE:
                    self.executeItem(item)

                elif mode == Mode.PLAY:
                    self.playVideo(item)

                elif mode == Mode.QUEUE:
                    self.queueAllVideos(item)

                elif mode == Mode.DOWNLOAD:
                    url = urllib.unquote(item['url'])
                    title = item['title']
                    self.downloadVideo(url, title)
                
                elif mode == Mode.REMOVEFROMCUSTOMMODULES:
                    self.removeCustomModule(item)
                
                #elif mode == Mode.UPDATE:
                #    self.update()
                    
                elif mode == Mode.DOWNLOADCUSTOMMODULE:
                    self.downloadCustomModule()
                
                elif mode == Mode.INSTALLADDON:
                    success = install(item['url'])
                    if success:
                        xbmc.sleep(100)
                        if xbmcUtils.getCurrentWindowXmlFile() == 'DialogAddonSettings.xml':
                            # workaround to update settings dialog
                            common.setSetting('', '')
                            

        except Exception, e:
            common.showError('Error running SportsDevil')
            common.log('Error running SportsDevil. Reason:' + str(e))
    def run(self, argv=None):
        self.addon = Addon('plugin.video.SportsDevil', argv)
        common.log('SportsDevil running')
        
        base = argv[0]
        handle = int(argv[1])
        parameter = argv[2]
        self.base = base
        self.handle = handle
        
        paramstring = urllib.unquote_plus(parameter)
        common.log(paramstring)
        
        try:
            
            # if addon is started
            listItemPath = xbmcUtils.getListItemPath()
            if not listItemPath.startswith(self.base):
                if not('mode=' in paramstring and not 'mode=1&' in paramstring):   
                    xbmcplugin.setPluginFanart(self.handle, common.Paths.pluginFanart)
                    self.clearCache()
            
            # Main Menu
            if len(paramstring) <= 2:                
                mainMenu = ListItem.create()
                mainMenu['url'] = self.MAIN_MENU_FILE
                tmpList = self.parseView(mainMenu)
                if tmpList:
                    self.currentlist = tmpList
                
            else:
                [mode, item] = self._parseParameters()
                # switch(mode)
                if mode == Mode.VIEW:
                    tmpList = self.parseView(item)
                    if tmpList:
                        self.currentlist = tmpList
                        count = len(self.currentlist.items)
                        if count == 1:
                            # Autoplay single video
                            autoplayEnabled = common.getSetting('autoplay') == 'true'
                            if autoplayEnabled:
                                videos = self.currentlist.getVideos()
                                if len(videos) == 1:
                                    self.playVideo(videos[0], True)
                                    


                elif mode == Mode.ADDITEM:
                    
                    tmp = os.path.normpath(paramstring.split('url=')[1])
                    if tmp:
                        suffix = tmp.split(os.path.sep)[-1]
                        tmp = tmp.replace(suffix,'') + urllib.quote_plus(suffix)
                        
                    if self.favouritesManager.add(tmp):
                        xbmc.executebuiltin('Container.Refresh()')


                elif mode in [Mode.ADDTOFAVOURITES, Mode.REMOVEFROMFAVOURITES, Mode.EDITITEM]:

                    if mode == Mode.ADDTOFAVOURITES:
                        self.favouritesManager.addItem(item)
                    elif mode == Mode.REMOVEFROMFAVOURITES:
                        self.favouritesManager.removeItem(item)
                        xbmc.executebuiltin('Container.Refresh()')
                    elif mode == Mode.EDITITEM:
                        if self.favouritesManager.editItem(item):
                            xbmc.executebuiltin('Container.Refresh()')


                elif mode == Mode.EXECUTE:
                    self.executeItem(item)

                elif mode == Mode.PLAY:
                    self.playVideo(item)
                
                elif mode == Mode.SLPROXY:
                    self.playSLProxy(item)
                
                elif mode == Mode.WEBDRIVER:
                    url = urllib.quote(item['url'])
                    title = item['title']
                    self.playWebDriver(url, title)

                elif mode == Mode.QUEUE:
                    self.queueAllVideos(item)

                elif mode == Mode.CHROME:
                    url = urllib.quote(item['url'])
                    title = item['title']
                    self.launchChrome(url, title)
                
                elif mode == Mode.INSTALLADDON:
                    success = install(item['url'])
                    if success:
                        xbmc.sleep(100)
                        if xbmcUtils.getCurrentWindowXmlFile() == 'DialogAddonSettings.xml':
                            # workaround to update settings dialog
                            common.setSetting('', '')
                            

        except Exception, e:
            common.showError('Error running SportsDevil')
            common.log('Error running SportsDevil. Reason:' + str(e))
Exemple #3
0
    def run(self, argv=None):

        self.addon = Addon('plugin.video.ViendoKodiStreaming', argv)

        common.log('ViendoKodiStreaming running')

        base = argv[0]
        handle = int(argv[1])
        parameter = argv[2]
        self.base = base
        self.handle = handle

        paramstring = urllib.unquote_plus(parameter)
        common.log(paramstring)

        try:

            # if addon is started
            listItemPath = xbmcUtils.getListItemPath()
            if not listItemPath.startswith(self.base):
                if not ('mode=' in paramstring
                        and not 'mode=1&' in paramstring):
                    xbmcplugin.setPluginFanart(self.handle,
                                               common.Paths.pluginFanart)
                    self.clearCache()

                    #if common.getSetting('autoupdate') == 'true':
                    #    self.update()

            # Main Menu
            if '98VKS' in paramstring:
                nametorrent = os.path.normpath(paramstring.split('url=')[1])
                if nametorrent == 'quasar':
                    addonTorrent = 'item_info_build=plugin://plugin.video.quasar/play?uri=%s'
                elif nametorrent == 'pulsar':
                    addonTorrent = 'item_info_build=plugin://plugin.video.pulsar/play?uri=%s'
                elif nametorrent == 'kmediatorrent':
                    addonTorrent = 'item_info_build=plugin://plugin.video.kmediatorrent/play/%s'
                elif nametorrent == "torrenter":
                    addonTorrent = 'item_info_build=plugin://plugin.video.torrenter/?action=playSTRM&url=%s&not_download_only=True'
                elif nametorrent == "yatp":
                    addonTorrent = 'item_info_build=plugin://plugin.video.yatp/?action=play&torrent=%s'
                else:
                    addonTorrent = 'item_info_build=plugin://plugin.video.xbmctorrent/play/%s'

                cFichero = common.Paths.catchersDir + '/' + 'torrent.txt'
                outfile = open(cFichero, 'w')  # Indicamos el valor 'w'.
                outfile.write('item_info_name=url\n' +
                              'item_info_from=@PARAM1@\n' + addonTorrent +
                              '\n')
                outfile.close()
                common.showInfo(
                    '[COLOR red]NO INSTALAR[/COLOR] conjuntamente los addon pulsar y quasar.\nYa que tendremos problemas de compatibilidad y no funcionará ninguno. [COLOR lime] \nPara los torrent se utilizará: [/COLOR] '
                    + nametorrent)

            elif len(paramstring) <= 2:
                mainMenu = ListItem.create()
                mainMenu['url'] = self.MAIN_MENU_FILE
                tmpList = self.parseView(mainMenu)
                if tmpList:
                    self.currentlist = tmpList

            else:
                [mode, item] = self._parseParameters()

                # switch(mode)
                if mode == Mode.VIEW:
                    tmpList = self.parseView(item)
                    if tmpList:
                        self.currentlist = tmpList
                        count = len(self.currentlist.items)
                        if count == 1:
                            # Autoplay single video
                            autoplayEnabled = common.getSetting(
                                'autoplay') == 'true'
                            if autoplayEnabled:
                                videos = self.currentlist.getVideos()
                                if len(videos) == 1:
                                    self.playVideo(videos[0], True)

                elif mode == Mode.ADDITEM:
                    tmp = os.path.normpath(paramstring.split('url=')[1])
                    if tmp:
                        suffix = tmp.split(os.path.sep)[-1]
                        tmp = tmp.replace(suffix,
                                          '') + urllib.quote_plus(suffix)
                    if self.favouritesManager.add(tmp):
                        xbmc.executebuiltin('Container.Refresh()')

                elif mode in [
                        Mode.ADDTOFAVOURITES, Mode.REMOVEFROMFAVOURITES,
                        Mode.EDITITEM
                ]:

                    if mode == Mode.ADDTOFAVOURITES:
                        self.favouritesManager.addItem(item)
                    elif mode == Mode.REMOVEFROMFAVOURITES:
                        self.favouritesManager.removeItem(item)
                        xbmc.executebuiltin('Container.Refresh()')
                    elif mode == Mode.EDITITEM:
                        if self.favouritesManager.editItem(item):
                            xbmc.executebuiltin('Container.Refresh()')

                elif mode == Mode.EXECUTE:
                    self.executeItem(item)

                elif mode == Mode.PLAY:
                    self.playVideo(item)

                elif mode == Mode.WEBDRIVER:
                    url = urllib.quote(item['url'])
                    title = item['title']
                    self.playWebDriver(url, title)

                elif mode == Mode.QUEUE:
                    self.queueAllVideos(item)

                elif mode == Mode.CHROME:
                    url = urllib.quote(item['url'])
                    title = item['title']
                    self.launchChrome(url, title)

                elif mode == Mode.SAY:
                    #title = item['title']
                    url = ""

                elif mode == Mode.INSTALLADDON:
                    success = install(item['url'])
                    if success:
                        xbmc.sleep(100)
                        if xbmcUtils.getCurrentWindowXmlFile(
                        ) == 'DialogAddonSettings.xml':
                            # workaround to update settings dialog
                            common.setSetting('', '')

        except Exception, e:
            common.showError('Error running ViendoKodiStreaming')
            common.log('Error running ViendoKodiStreaming. Reason:' + str(e))
    def run(self, argv=None):

        self.addon = Addon('plugin.video.ViendoKodiStreaming', argv)

        common.log('ViendoKodiStreaming running')

        base = argv[0]
        handle = int(argv[1])
        parameter = argv[2]
        self.base = base
        self.handle = handle

        paramstring = urllib.unquote_plus(parameter)
        common.log(paramstring)
        try:

            # if addon is started
            listItemPath = xbmcUtils.getListItemPath()
            if not listItemPath.startswith(self.base):
                if not('mode=' in paramstring and not 'mode=1&' in paramstring):
                    xbmcplugin.setPluginFanart(self.handle, common.Paths.pluginFanart)
                    self.clearCache()

                    #if common.getSetting('autoupdate') == 'true':
                    #    self.update()


            # Main Menu
            if '98VKS' in paramstring:
                nametorrent = os.path.normpath(paramstring.split('url=')[1])
                if nametorrent == 'quasar':
                    addonTorrent = 'item_info_build=plugin://plugin.video.quasar/play?uri=%s'
                elif nametorrent == 'pulsar':
                    addonTorrent = 'item_info_build=plugin://plugin.video.pulsar/play?uri=%s'
                elif nametorrent == 'kmediatorrent':
                    addonTorrent = 'item_info_build=plugin://plugin.video.kmediatorrent/play/%s'
                elif nametorrent == "torrenter":
                    addonTorrent = 'item_info_build=plugin://plugin.video.torrenter/?action=playSTRM&url=%s&not_download_only=True'
                elif nametorrent == "yatp":
                    addonTorrent = 'item_info_build=plugin://plugin.video.yatp/?action=play&torrent=%s'
                else:
                    addonTorrent = 'item_info_build=plugin://plugin.video.xbmctorrent/play/%s'

                cFichero = common.Paths.catchersDir + '/'+'torrent.txt'
                outfile = open(cFichero, 'w') # Indicamos el valor 'w'.
                outfile.write('item_info_name=url\n'
                + 'item_info_from=@PARAM1@\n' + addonTorrent + '\n' )
                outfile.close()
                common.showInfo('Para los torrent se utilizará ' + nametorrent )

            elif len(paramstring) <= 2:
                mainMenu = ListItem.create()
                mainMenu['url'] = self.MAIN_MENU_FILE
                tmpList = self.parseView(mainMenu)
                if tmpList:
                    self.currentlist = tmpList

            else:

                [mode, item] = self._parseParameters()

                # switch(mode)
                if mode == Mode.VIEW:
                    tmpList = self.parseView(item)
                    if tmpList:
                        self.currentlist = tmpList
                        count = len(self.currentlist.items)
                        if count == 1:
                            # Autoplay single video
                            autoplayEnabled = common.getSetting('autoplay') == 'true'
                            if autoplayEnabled:
                                videos = self.currentlist.getVideos()
                                if len(videos) == 1:
                                    self.playVideo(videos[0], True)

                elif mode == Mode.ADDITEM:
                    tmp = os.path.normpath(paramstring.split('url=')[1])
                    if tmp:
                        suffix = tmp.split(os.path.sep)[-1]
                        tmp = tmp.replace(suffix,'') + urllib.quote_plus(suffix)
                    if self.favouritesManager.add(tmp):
                        xbmc.executebuiltin('Container.Refresh()')


                elif mode in [Mode.ADDTOFAVOURITES, Mode.REMOVEFROMFAVOURITES, Mode.EDITITEM]:

                    if mode == Mode.ADDTOFAVOURITES:
                        self.favouritesManager.addItem(item)
                    elif mode == Mode.REMOVEFROMFAVOURITES:
                        self.favouritesManager.removeItem(item)
                        xbmc.executebuiltin('Container.Refresh()')
                    elif mode == Mode.EDITITEM:
                        if self.favouritesManager.editItem(item):
                            xbmc.executebuiltin('Container.Refresh()')


                elif mode == Mode.EXECUTE:
                    self.executeItem(item)

                elif mode == Mode.PLAY:
                    self.playVideo(item)

                elif mode == Mode.WEBDRIVER:
                    url = urllib.quote(item['url'])
                    title = item['title']
                    self.playWebDriver(url, title)

                elif mode == Mode.QUEUE:
                    self.queueAllVideos(item)

                elif mode == Mode.DOWNLOAD:
                    url = urllib.unquote(item['url'])
                    title = item['title']
                    self.downloadVideo(url, title)

                elif mode == Mode.CHROME:
                    url = urllib.quote(item['url'])
                    title = item['title']
                    self.launchChrome(url, title)

                elif mode == Mode.REMOVEFROMCUSTOMMODULES:
                    self.removeCustomModule(item)

                #elif mode == Mode.UPDATE:
                #    self.update()
                elif mode == Mode.SAY:
                    #title = item['title']
                    url = ""

                elif mode == Mode.DOWNLOADCUSTOMMODULE:
                    self.downloadCustomModule()

                elif mode == Mode.INSTALLADDON:
                    success = install(item['url'])
                    if success:
                        xbmc.sleep(100)
                        if xbmcUtils.getCurrentWindowXmlFile() == 'DialogAddonSettings.xml':
                            # workaround to update settings dialog
                            common.setSetting('', '')

        except Exception, e:
            common.showError('Error running ViendoKodiStreaming')
            common.log('Error running ViendoKodiStreaming. Reason:' + str(e))