Exemplo n.º 1
0
def isDl(sSiteName, sFunction):
    if (sSiteName == 'cDownload'):
        from resources.lib.download import cDownload
        oDownload = cDownload()
        exec "oDownload."+ sFunction +"()"
        return True
    return False
Exemplo n.º 2
0
    def download(self):
        oGui = cGui()
        oInputParameterHandler = cInputParameterHandler()

        sHosterIdentifier = oInputParameterHandler.getValue(
            'sHosterIdentifier')
        sMediaUrl = oInputParameterHandler.getValue('sMediaUrl')
        bGetRedirectUrl = oInputParameterHandler.getValue('bGetRedirectUrl')
        sFileName = oInputParameterHandler.getValue('sFileName')

        if (bGetRedirectUrl == 'True'):
            sMediaUrl = self.__getRedirectUrl(sMediaUrl)

        logger.info('call download: ' + sMediaUrl)

        oHoster = cHosterHandler().getHoster(sHosterIdentifier)
        oHoster.setFileName(sFileName)

        #try:
        oHoster.setUrl(sMediaUrl)
        aLink = oHoster.getMediaLink()
        if (aLink[0] == True):
            oDownload = cDownload()
            oDownload.download(aLink[1], oHoster.getFileName())
            return

        #except:
        #    logger.fatal('could not load plugin: ' + sHosterFileName)

        oGui.setEndOfDirectory()
Exemplo n.º 3
0
    def download(self):
        oGui = cGui()
        oInputParameterHandler = cInputParameterHandler()

        sHosterIdentifier = oInputParameterHandler.getValue(
            'sHosterIdentifier')
        sMediaUrl = oInputParameterHandler.getValue('sMediaUrl')
        bGetRedirectUrl = oInputParameterHandler.getValue('bGetRedirectUrl')
        sFileName = oInputParameterHandler.getValue('sFileName')

        if (bGetRedirectUrl == 'True'):
            sMediaUrl = self.__getRedirectUrl(sMediaUrl)

        cConfig().log("Telechargement " + sMediaUrl)

        oHoster = cHosterHandler().getHoster(sHosterIdentifier)
        oHoster.setFileName(sFileName)

        #try:
        oHoster.setUrl(sMediaUrl)
        aLink = oHoster.getMediaLink()
        if (aLink[0] == True):
            oDownload = cDownload()
            oDownload.download(aLink[1], oHoster.getFileName())
            return

        #except:
        # cConfig().log("Telechargement " + sHosterFileName)

        oGui.setEndOfDirectory()
Exemplo n.º 4
0
    def download(self, siteResult = False):
        #oGui = cGui()
        params = ParameterHandler()

        sMediaUrl = params.getValue('sMediaUrl')
        sFileName = params.getValue('sFileName')
        sFileName = params.getValue('sMovieTitle')
        if siteResult:
            sMediaUrl = siteResult['streamUrl']
            if siteResult['resolved']:
                sLink = sMediaUrl
            else:
                sLink = urlresolver.resolve(sMediaUrl)
        else:
            sLink = urlresolver.resolve(sMediaUrl)
        logger.info('call download: ' + sMediaUrl)
        logger.info('file link: ' + str(sLink))
        if self.dialog:
            self.dialog.close()
        if (sLink != False):
            oDownload = cDownload()
            oDownload.download(sLink, 'Stream')
        else:
            #cGui().showError('Download', 'File deleted or Link could not be resolved', 5);
            return False
        return True
Exemplo n.º 5
0
    def download(self):
        oGui = cGui()
        oInputParameterHandler = cInputParameterHandler()

        sHosterIdentifier = oInputParameterHandler.getValue('sHosterIdentifier')
        sMediaUrl = oInputParameterHandler.getValue('sMediaUrl')
        bGetRedirectUrl = oInputParameterHandler.getValue('bGetRedirectUrl')
        sFileName = oInputParameterHandler.getValue('sFileName')

        if (bGetRedirectUrl == 'True'):
            sMediaUrl = self.__getRedirectUrl(sMediaUrl)

        cConfig().log("Telechargement " + sMediaUrl)

        oHoster = cHosterHandler().getHoster(sHosterIdentifier)
        oHoster.setFileName(sFileName)

        #try:
        oHoster.setUrl(sMediaUrl)
        aLink = oHoster.getMediaLink()
        if (aLink[0] == True):
            oDownload = cDownload()
            oDownload.download(aLink[1], oHoster.getFileName())
            return

        #except:
        # cConfig().log("Telechargement " + sHosterFileName)

        oGui.setEndOfDirectory()
Exemplo n.º 6
0
    def download(self):
        oGui = cGui()
        oInputParameterHandler = cInputParameterHandler()

        sHosterIdentifier = oInputParameterHandler.getValue('sHosterIdentifier')
        sMediaUrl = oInputParameterHandler.getValue('sMediaUrl')
        bGetRedirectUrl = oInputParameterHandler.getValue('bGetRedirectUrl')
        sFileName = oInputParameterHandler.getValue('sFileName')

        if (bGetRedirectUrl == 'True'):
            sMediaUrl = self.__getRedirectUrl(sMediaUrl)

        logger.info('call download: ' + sMediaUrl)

        oHoster = cHosterHandler().getHoster(sHosterIdentifier)
        oHoster.setFileName(sFileName)

        #try:
        oHoster.setUrl(sMediaUrl)
        aLink = oHoster.getMediaLink()
        if (aLink[0] == True):
            oDownload = cDownload()
            oDownload.download(aLink[1], oHoster.getFileName())
            return

        #except:
        #    logger.fatal('could not load plugin: ' + sHosterFileName)

        oGui.setEndOfDirectory()
Exemplo n.º 7
0
def isDl(sSiteName, sFunction):
    if sSiteName == 'cDownload':
        from resources.lib.download import cDownload
        oDownload = cDownload()
        exec("oDownload." + sFunction + "()")
        return True
    return False
Exemplo n.º 8
0
    def download(self, siteResult = False):
        #oGui = cGui()
        oInputParameterHandler = cInputParameterHandler()

        sMediaUrl = oInputParameterHandler.getValue('sMediaUrl')
        sFileName = oInputParameterHandler.getValue('sFileName')
        sFileName = oInputParameterHandler.getValue('sMovieTitle')
        if siteResult:
            sMediaUrl = siteResult['streamUrl']
            if siteResult['resolved']:
                sLink = sMediaUrl
            else:
                sLink = urlresolver.resolve(sMediaUrl)
        else:
            sLink = urlresolver.resolve(sMediaUrl)
        logger.info('call download: ' + sMediaUrl)
        logger.info('file link: ' + str(sLink))
        if self.dialog:
            self.dialog.close()
        if (sLink != False):
            oDownload = cDownload()
            oDownload.download(sLink, 'Stream')
        else:
            cGui().showError('Download', 'File deleted or Link could not be resolved', 5);
            return False
        return True
    def download(self):
        oGui = cGui()
        oInputParameterHandler = cInputParameterHandler()

        sHosterIdentifier = oInputParameterHandler.getValue('sHosterIdentifier')
        sMediaUrl = oInputParameterHandler.getValue('sMediaUrl')
        bGetRedirectUrl = oInputParameterHandler.getValue('bGetRedirectUrl')
        sFileName = oInputParameterHandler.getValue('sFileName')

        if (bGetRedirectUrl == 'True'):
            sMediaUrl = self.__getRedirectUrl(sMediaUrl)

        logger.info('call download: ' + sMediaUrl)

        oHoster = cHosterHandler().getHoster(sHosterIdentifier)
        oHoster.setFileName(sFileName)

        selfAddon = xbmcaddon.Addon(id='plugin.video.xstream')
        sPath = str(selfAddon.getSetting('download-folder'))

        #try:
        oHoster.setUrl(sMediaUrl)
        aLink = oHoster.getMediaLink()
        if (aLink[0] == True):
            oDownload = cDownload()
            oDownload.download(aLink[1], oHoster.getFileName(), sPath)
            return

        #except:
        #    logger.fatal('could not load plugin: ' + sHosterFileName)

        oGui.setEndOfDirectory()
Exemplo n.º 10
0
    def download(self, siteResult=False):
        from resources.lib.download import cDownload
        import urlresolver

        # oGui = cGui()
        params = ParameterHandler()

        sMediaUrl = params.getValue("sMediaUrl")
        sFileName = params.getValue("sFileName")
        sFileName = params.getValue("sMovieTitle")
        if siteResult:
            sMediaUrl = siteResult["streamUrl"]
            if siteResult["resolved"]:
                sLink = sMediaUrl
            else:
                sLink = urlresolver.resolve(sMediaUrl)
        else:
            sLink = urlresolver.resolve(sMediaUrl)
        logger.info("call download: " + sMediaUrl)
        logger.info("file link: " + str(sLink))
        if self.dialog:
            self.dialog.close()
        if sLink != False:
            oDownload = cDownload()
            oDownload.download(sLink, "Stream")
        else:
            # cGui().showError('Download', 'File deleted or Link could not be resolved', 5);
            return False
        return True
Exemplo n.º 11
0
    def download(self, siteResult=False):
        from resources.lib.download import cDownload
        logger.info('attempt download')
        data = self._getInfoAndResolve(siteResult)
        if not data: return False

        logger.info('download file link: ' + data['link'])
        if self.dialog:
            self.dialog.close()
        oDownload = cDownload()
        oDownload.download(data['link'], data['title'])
        return True
Exemplo n.º 12
0
def update(REMOTE_PATH):
    logger.info("xStream Update URL: " + REMOTE_PATH)

    download.cDownload().download(REMOTE_PATH, LOCAL_FILE_NAME, False)

    updateFile = zipfile.ZipFile(os.path.join(TEMP_DIR, LOCAL_FILE_NAME))

    for index, n in enumerate(updateFile.namelist()):
        if n[-1] != "/":
            dest = os.path.join(ROOT_DIR, "/".join(n.split("/")[1:]))
            destdir = os.path.dirname(dest)
            if not os.path.isdir(destdir):
                os.makedirs(destdir)
            data = updateFile.read(n)
            if os.path.exists(dest):
                os.remove(dest)
            f = open(dest, 'w')
            f.write(data)
            f.close()
    updateFile.close()
    logger.info("Update Successful")
def update(REMOTE_PATH):
    logger.info("xStream Update URL: " + REMOTE_PATH)

    download.cDownload().download(REMOTE_PATH, LOCAL_FILE_NAME, False)

    updateFile = zipfile.ZipFile(os.path.join(TEMP_DIR, LOCAL_FILE_NAME))

    for index, n in enumerate(updateFile.namelist()):
        if n[-1] != "/":
            dest = os.path.join(ROOT_DIR, "/".join(n.split("/")[1:]))
            destdir = os.path.dirname(dest)
            if not os.path.isdir(destdir):
                os.makedirs(destdir)
            data = updateFile.read(n)
            if os.path.exists(dest):
                os.remove(dest)
            f = open(dest, 'w')
            f.write(data)
            f.close()
    updateFile.close()
    logger.info("Update Successful")
Exemplo n.º 14
0
    def download(self, siteResult = False):
        from resources.lib.download import cDownload
        logger.info('attempt download')
        data = self._getInfoAndResolve(siteResult)
        if not data: return False

        logger.info('download file link: ' + data['link'])
        if self.dialog:
            self.dialog.close()
        oDownload = cDownload()
        oDownload.download(data['link'], data['title'])
        return True
def update(LocalDir, REMOTE_PATH, Title):
    logger.info(Title + " from: " + REMOTE_PATH)
    cDownload().download(REMOTE_PATH, LOCAL_FILE_NAME, False, Title)

    updateFile = zipfile.ZipFile(os.path.join(profilePath, LOCAL_FILE_NAME))

    removeFilesNotInRepo(updateFile, LocalDir)

    for index, n in enumerate(updateFile.namelist()):
        if n[-1] != "/":
            dest = os.path.join(LocalDir, "/".join(n.split("/")[1:]))
            destdir = os.path.dirname(dest)
            if not os.path.isdir(destdir):
                os.makedirs(destdir)
            data = updateFile.read(n)
            if os.path.exists(dest):
                os.remove(dest)
            f = open(dest, 'wb')
            f.write(data)
            f.close()
    updateFile.close()

    logger.info("Update Successful")
Exemplo n.º 16
0
    def download(self):
        oGui = cGui()
        oInputParameterHandler = cInputParameterHandler()

        sMediaUrl = oInputParameterHandler.getValue('sMediaUrl')
        bGetRedirectUrl = oInputParameterHandler.getValue('bGetRedirectUrl')

        if (bGetRedirectUrl == 'True'):
            sMediaUrl = self.__getRedirectUrl(sMediaUrl)

        logger.info('call download: ' + sMediaUrl)

        sLink = urlresolver.resolve(sMediaUrl)
        if sLink is not False:
            oDownload = cDownload()
            oDownload.download(sLink, 'Stream')
            return

        oGui.setEndOfDirectory()
Exemplo n.º 17
0
    def download(self):
        oGui = cGui()
        oInputParameterHandler = cInputParameterHandler()

        sMediaUrl = oInputParameterHandler.getValue('sMediaUrl')
        bGetRedirectUrl = oInputParameterHandler.getValue('bGetRedirectUrl')
        sFileName = oInputParameterHandler.getValue('sFileName')

        if (bGetRedirectUrl == 'True'):
            sMediaUrl = self.__getRedirectUrl(sMediaUrl)

        logger.info('call download: ' + sMediaUrl)

        sLink = urlresolver.resolve(sMediaUrl)
        
        if (sLink != False):
            oDownload = cDownload()
            oDownload.download(sLink, 'Stream')
            return

        #except:
        #    logger.fatal('could not load plugin: ' + sHosterFileName)

        oGui.setEndOfDirectory()
Exemplo n.º 18
0
    def download(self):
        oGui = cGui()
        oInputParameterHandler = cInputParameterHandler()

        sMediaUrl = oInputParameterHandler.getValue("sMediaUrl")
        bGetRedirectUrl = oInputParameterHandler.getValue("bGetRedirectUrl")
        sFileName = oInputParameterHandler.getValue("sFileName")

        if bGetRedirectUrl == "True":
            sMediaUrl = self.__getRedirectUrl(sMediaUrl)

        logger.info("call download: " + sMediaUrl)

        sLink = urlresolver.resolve(sMediaUrl)

        if sLink != False:
            oDownload = cDownload()
            oDownload.download(sLink, "Stream")
            return

        # except:
        #    logger.fatal('could not load plugin: ' + sHosterFileName)

        oGui.setEndOfDirectory()
Exemplo n.º 19
0
    def download(self):
        oGui = cGui()
        oInputParameterHandler = cInputParameterHandler()

        sMediaUrl = oInputParameterHandler.getValue('sMediaUrl')
        bGetRedirectUrl = oInputParameterHandler.getValue('bGetRedirectUrl')
        sFileName = oInputParameterHandler.getValue('sFileName')

        if (bGetRedirectUrl == 'True'):
            sMediaUrl = self.__getRedirectUrl(sMediaUrl)

        logger.info('call download: ' + sMediaUrl)

        sLink = urlresolver.resolve(sMediaUrl)

        if (sLink != False):
            oDownload = cDownload()
            oDownload.download(sLink, 'Stream')
            return

        #except:
        #    logger.fatal('could not load plugin: ' + sHosterFileName)

        oGui.setEndOfDirectory()
Exemplo n.º 20
0
def isDl(sSiteName, sFunction):
    if (sSiteName == 'cDownload'):
        oDownload = cDownload()
        exec "oDownload."+ sFunction +"()"
        return True
    return False
Exemplo n.º 21
0
    def parseUrl(self):

        oInputParameterHandler = cInputParameterHandler()
        # params = oInputParameterHandler.getAllParameter()
        # VSlog(params)

        if (oInputParameterHandler.exist('function')
                and oInputParameterHandler.exist('site')):
            sFunction = oInputParameterHandler.getValue('function')
            sSiteName = oInputParameterHandler.getValue('site')

            if (sFunction == 'DoNothing'):
                return

            VSlog('load site ' + sSiteName + ' and call function ' + sFunction)

            #home
            if (sSiteName == 'cHome'):
                oHome = cHome()
                exec "oHome." + sFunction + "()"

            #librairie
            elif (sSiteName == 'cLibrary'):
                from resources.lib.library import cLibrary
                oLibrary = cLibrary()
                exec "oLibrary." + sFunction + "()"

            #marque page
            elif (sSiteName == 'cFav'):
                from resources.lib.favourite import cFav
                oFav = cFav()
                exec "oFav." + sFunction + "()"

            #dl
            elif (sSiteName == 'cDownload'):
                from resources.lib.download import cDownload
                oDownload = cDownload()
                exec "oDownload." + sFunction + "()"

            #sous menu home vers sources
            elif (sSiteName == 'sitehandler' and sFunction == 'callplugin'):
                oSiteHandler = cSiteHandler()
                oSiteHandler.callplugin()

            #trakt
            elif (sSiteName == 'cTrakt'):
                from resources.lib.trakt import cTrakt
                oTrakt = cTrakt()
                exec "oTrakt." + sFunction + "()"

            #hoster
            elif (sSiteName == 'cHosterGui'):
                oHosterGui = cHosterGui()
                exec "oHosterGui." + sFunction + "()"

            #gui
            elif (sSiteName == 'cGui'):
                oGui = cGui()
                exec "oGui." + sFunction + "()"

            #parametres de vstream
            elif (sSiteName == 'globalParametre'):
                xbmcaddon.Addon('plugin.video.vstream').openSettings()
                xbmc.executebuiltin("Container.Refresh")

            #toutes les sources
            elif (sSiteName == 'globalSources'):
                oSiteHandler = cSiteHandler()
                oSiteHandler.callAllSources()

            #recherche global
            elif (sSiteName == 'globalSearch'):
                from resources.test.rechercheHandler import cRechercheHandler
                oTr = cRechercheHandler()
                oTr.searchGlobal()

            #mise a jour
            elif (sSiteName == 'MAJ'):
                try:
                    oAbout = cAbout()
                    oAbout.checkdownload()
                except:
                    pass
            else:
                try:
                    plugins = __import__('resources.sites.%s' % sSiteName,
                                         fromlist=[sSiteName])
                    function = getattr(plugins, sFunction)
                    function()
                except Exception as e:
                    VSlog('could not load site: ' + sSiteName + ' error: ' +
                          str(e))
                    return

                VSlog('load >>>>>>>>>>>>>>>>>>>>>> site ')

        else:
            #si aucun argument verif mise a jour et on load home
            try:
                oAbout = cAbout()
                oAbout.getUpdate()
            except Exception as e:
                #VSlog(e)
                pass

            oHome = cHome()
            oHome.load()

            VSlog('load >>>>>>>>>>>>>>>>>>> home ')
Exemplo n.º 22
0
def isDl(sSiteName, sFunction):
    if (sSiteName == 'cDownload'):
        oDownload = cDownload()
        exec "oDownload." + sFunction + "()"
        return True
    return False