예제 #1
0
    def AddDownload(self, meta):

        sTitle = meta['title']
        sUrl = meta['url']

        # titre fichier
        sTitle = self.__createTitle(sUrl, sTitle)
        sTitle = self.__createDownloadFilename(sTitle)
        sTitle = cGui().showKeyBoard(sTitle)

        if (sTitle != False and len(sTitle) > 0):

            # chemin de sauvegarde
            sPath2 = VSPath(self.ADDON.getSetting('download_folder'))

            dialog = xbmcgui.Dialog()
            sPath = dialog.browse(3, 'Downloadfolder', 'files', '', False,
                                  False, sPath2)

            if (sPath != ''):
                self.ADDON.setSetting('download_folder', sPath)
                sDownloadPath = VSPath(sPath + '%s' % (sTitle))

                if xbmcvfs.exists(sDownloadPath):
                    self.DIALOG.VSinfo(self.ADDON.VSlang(30082), sTitle)
                    return self.AddDownload(meta)
                else:
                    xbmcvfs.File(sDownloadPath, 'w')

                try:

                    VSlog(self.ADDON.VSlang(30083) + ' ' + str(sUrl))
                    meta['title'] = sTitle
                    meta['path'] = sDownloadPath

                    cDb().insert_download(meta)

                    return True

                except:
                    # print_exc()

                    self.DIALOG.VSinfo(self.ADDON.VSlang(30084), sTitle)
                    VSlog('Unable to download')

        return False
예제 #2
0
    def AddDownload(self, meta):

        sTitle = meta['title']
        sUrl = meta['url']

        #titre fichier
        sTitle = self.__createTitle(sUrl, sTitle)
        sTitle = self.__createDownloadFilename(sTitle)
        sTitle = cGui().showKeyBoard(sTitle)

        if (sTitle != False and len(sTitle) > 0):

            #chemin de sauvegarde
            sPath2 = xbmc.translatePath(
                self.ADDON.getSetting('download_folder'))

            dialog = xbmcgui.Dialog()
            sPath = dialog.browse(3, 'Downloadfolder', 'files', '', False,
                                  False, sPath2)

            if (sPath != ''):
                self.ADDON.setSetting('download_folder', sPath)
                sDownloadPath = xbmc.translatePath(sPath + '%s' % (sTitle))

                if xbmcvfs.exists(sDownloadPath):
                    self.DIALOG.VSinfo('Nom déjà utilisé', sTitle)
                    return self.AddDownload(meta)
                else:
                    xbmcvfs.File(sDownloadPath, 'w')

                try:
                    VSlog('Ajout en liste de téléchargement ' + str(sUrl))
                    meta['title'] = sTitle
                    meta['path'] = sDownloadPath

                    cDb().insert_download(meta)

                    return True

                except:
                    #print_exc()
                    self.DIALOG.VSinfo('Téléchargement impossible', sTitle)
                    VSlog('Téléchargement impossible')

        return False
예제 #3
0
    def AddDownload(self,meta):

        sTitle = meta['title']
        sUrl = meta['url']

        #titre fichier
        sTitle = self.__createTitle(sUrl, sTitle)
        sTitle = self.__createDownloadFilename(sTitle)
        sTitle =  cGui().showKeyBoard(sTitle)

        if (sTitle != False and len(sTitle) > 0):

            #chemin de sauvegarde
            sPath2 = xbmc.translatePath(self.ADDON.getSetting('download_folder'))

            dialog = xbmcgui.Dialog()
            sPath = dialog.browse(3, 'Downloadfolder', 'files', '', False, False , sPath2)

            if (sPath != ''):
                self.ADDON.setSetting('download_folder',sPath)
                sDownloadPath = xbmc.translatePath(sPath +  '%s' % (sTitle, ))

                if xbmcvfs.exists(sDownloadPath):
                    self.DIALOG.VSinfo('Nom deja utilise', sTitle)
                    return self.AddDownload(meta)
                else:
                    xbmcvfs.File(sDownloadPath, 'w')

                try:
                    VSlog("Rajout en liste de telechargement " + str(sUrl))
                    meta['title'] = sTitle
                    meta['path'] = sDownloadPath

                    cDb().insert_download(meta)

                    return True

                except:
                    #print_exc()
                    self.DIALOG.VSinfo('Telechargement impossible', sTitle)
                    VSlog("Telechargement impossible")

        return False