示例#1
0
    def downloadMovie(self, url, path, title, extension):
        if not os.path.exists(path):
            common.log('Path does not exist')
            return None
        if title == '':
            common.log('No title given')
            return None

        file_path = xbmc.makeLegalFilename(os.path.join(path, title + extension))
        file_path = urllib.unquote_plus(file_path)
        # Overwrite existing file?
        if os.path.isfile(file_path):
            self.pDialog = xbmcgui.Dialog()

            if not common.ask('File already exists. Overwrite?\n' + os.path.basename(file_path)):
                title = common.showOSK(urllib.unquote_plus(title), common.translate(30102))
                if not title:
                    return None
                file_path = xbmc.makeLegalFilename(os.path.join(path, title + extension))
                file_path = urllib.unquote_plus(file_path)
        
        success = self.__download(url, file_path)
        if success:
            return file_path
        else:
            return None
示例#2
0
    def downloadMovie(self, url, path, title, extension):
        if not os.path.exists(path):
            common.log('Path does not exist')
            return None
        if title == '':
            common.log('No title given')
            return None

        file_path = xbmc.makeLegalFilename(os.path.join(path, title + extension))
        file_path = urllib.unquote_plus(file_path)
        # Overwrite existing file?
        if os.path.isfile(file_path):
            self.pDialog = xbmcgui.Dialog()

            if not common.ask('File already exists. Overwrite?\n' + os.path.basename(file_path)):
                title = common.showOSK(urllib.unquote_plus(title), common.translate(30102))
                if not title:
                    return None
                file_path = xbmc.makeLegalFilename(os.path.join(path, title + extension))
                file_path = urllib.unquote_plus(file_path)
        
        success = self.__download(url, file_path)
        if success:
            return file_path
        else:
            return None
示例#3
0
    def getSearchPhrase(self):
        searchCache = os.path.join(common.Paths.cacheDir, 'search')
        default_phrase = fu.getFileContent(searchCache)
        if not default_phrase:
            default_phrase = ''

        search_phrase = common.showOSK(default_phrase, common.translate(30102))
        if search_phrase == '':
            return None
        xbmc.sleep(10)
        fu.setFileContent(searchCache, search_phrase)

        return search_phrase
示例#4
0
    def getSearchPhrase(self):
        searchCache = os.path.join(common.Paths.cacheDir, 'search')
        default_phrase = fu.getFileContent(searchCache)
        if not default_phrase:
            default_phrase = ''

        search_phrase = common.showOSK(default_phrase, common.translate(30102))
        if search_phrase == '':
            return None
        xbmc.sleep(10)
        fu.setFileContent(searchCache, search_phrase)

        return search_phrase