Esempio n. 1
0
    def downloadVideo(self, url, title):
        common.log('Trying to download video ' + str(url))

        # check url
        if url.startswith('plugin'):
            common.log('Video is not downloadable')
            return None

        path = common.getSetting('download_path')
        if not path:
            path = common.browseFolders(common.translate(30017))
            common.setSetting('download_path', path)

        title = getKeyboard(default = fu.cleanFilename(title),heading='SportsDevil')
        if title == None or title == '':
            return None

        downloader = Downloader()
        downloaded_file = downloader.downloadMovie(url, path,  fu.cleanFilename(title), '.flv')

        if downloaded_file == None:
            common.log ('Download cancelled')
        else:
            common.log('Video ' + url + " downloaded to '" + downloaded_file + "'")

        return downloaded_file
Esempio n. 2
0
    def downloadVideo(self, url, title):
        common.log('Trying to download video ' + str(url))

        # check url
        if url.startswith('plugin'):
            common.log('Video is not downloadable')
            return None

        path = common.getSetting('download_path')
        if not path:
            path = common.browseFolders(common.translate(30017))
            common.setSetting('download_path', path)

        title = getKeyboard(default=fu.cleanFilename(title),
                            heading='SportsDevil')
        if title == None or title == '':
            return None

        downloader = Downloader()
        downloaded_file = downloader.downloadMovie(url, path,
                                                   fu.cleanFilename(title),
                                                   '.flv')

        if downloaded_file == None:
            common.log('Download cancelled')
        else:
            common.log('Video ' + url + " downloaded to '" + downloaded_file +
                       "'")

        return downloaded_file
Esempio n. 3
0
    def downloadVideo(self, url, title):
        common.log("Trying to download video " + str(url))

        # check url
        if url.startswith("plugin"):
            common.log("Video is not downloadable")
            return None

        path = common.getSetting("download_path")
        if not path:
            path = common.browseFolders(common.translate(30017))
            common.setSetting("download_path", path)

        title = getKeyboard(default=fu.cleanFilename(title), heading="Dragon Streams")
        if title == None or title == "":
            return None

        downloader = Downloader()
        downloaded_file = downloader.downloadMovie(url, path, fu.cleanFilename(title), ".flv")

        if downloaded_file == None:
            common.log("Download cancelled")
        else:
            common.log("Video " + url + " downloaded to '" + downloaded_file + "'")

        return downloaded_file
 def editItem(self, item):
     menuItems = ["Change label", "Change icon", "Change fanart"]
     virtualFolders = self._getVirtualFoldersList()
     if len(virtualFolders) > 0 and not item.getInfo('url').startswith('favfolders/'):
         menuItems.append("Move to folder")
     select = xbmcgui.Dialog().select('Choose' , menuItems)
     if select == -1:
         return False
     cfgFile = self._favouritesFile
     definedIn = item.getInfo('definedIn')
     if definedIn and definedIn.startswith('favfolders/'):
         cfgFile = os.path.join(self._favouritesFoldersFolder, definedIn.split('/')[1])
     if select == 0:
         newLabel = getKeyboard(default = item.getInfo('title'), heading = 'Change label')
         if not newLabel or newLabel == "":
             return False
         self.changeLabel(item, newLabel)
     elif select == 1:
         newIcon = getImage('Change icon')
         if not newIcon:
             return False
         self.changeIcon(item, newIcon)
     elif select == 2:
         newFanart = getImage('Change fanart')
         if not newFanart:
             return False
         self.changeFanart(item, newFanart)
     elif select == 3:
         newCfgFile = self._virtualFolderSelection()
         if not newCfgFile or cfgFile == newCfgFile:
             return False
         self.moveToFolder(cfgFile, item, newCfgFile)
     return True
    def addFolder(self):
        if not (os.path.exists(self._favouritesFile) and os.path.exists(self._favouritesFoldersFolder)):
            return False
        
        # get name
        name = getKeyboard(default = '', heading = 'Set name')
        if not name or name == "":
            return False

        # create cfg
        virtualFolderFile = urllib.quote_plus(name) + '.cfg'
        physicalFolder = self._favouritesFoldersFolder
        virtualFolderPath = os.path.join(physicalFolder, virtualFolderFile)
        if os.path.exists(virtualFolderPath):
            common.showInfo('Folder already exists')
            return False
        data = [\
            '\n',
            '########################################################',
            '# ' + name.upper(),
            '########################################################'
            ]
        fu.setFileContent(virtualFolderPath, '\n'.join(data))

        # create link
        linkToFolder = self._createItem(name, 'rss', '', '', None, 'favfolders/' + virtualFolderFile)
        fu.appendFileContent(self._favouritesFile, linkToFolder)
        return True    
 def add(self, rootFolder=None):
     menuItems = ["Add folder", "Add SportsDevil item", "Add xbmc favourite"]
     select = xbmcgui.Dialog().select('Choose', menuItems)
     if select == 0:
         name = getKeyboard(default = '', heading = 'Set name')
         if name and len(name) > 0:
             return self._addFolder(name, rootFolder)
     elif select == 1:
         common.showInfo('Please browse through SportsDevil and use \ncontext menu entry "Add to SportsDevil favourites"')
     elif select == 2:
         return self._addXbmcFavourite(rootFolder)
     return False
 def add(self, rootFolder=None):
     menuItems = ["Add folder", "Add PGLiveTV item", "Add xbmc favourite"]
     select = xbmcgui.Dialog().select("Choose", menuItems)
     if select == 0:
         name = getKeyboard(default="", heading="Set name")
         if name and len(name) > 0:
             return self._addFolder(name, rootFolder)
     elif select == 1:
         common.showInfo('Please browse through PGLiveTV and use \ncontext menu entry "Add to PGLiveTV favourites"')
     elif select == 2:
         return self._addXbmcFavourite(rootFolder)
     return False
Esempio n. 8
0
    def getSearchPhrase(self):
        searchCache = os.path.join(common.Paths.cacheDir, 'search')
        try:
            curr_phrase = fu.getFileContent(searchCache)
        except:
            curr_phrase = ''
        search_phrase = getKeyboard(default = curr_phrase, heading = common.translate(30102))
        if search_phrase == '':
            return None
        xbmc.sleep(10)
        fu.setFileContent(searchCache, search_phrase)

        return search_phrase
Esempio n. 9
0
 def add(self, rootFolder=None):
     menuItems = ["Add folder", "Add PGLiveTV item", "Add xbmc favourite"]
     select = xbmcgui.Dialog().select('Choose', menuItems)
     if select == 0:
         name = getKeyboard(default='', heading='Set name')
         if name and len(name) > 0:
             return self._addFolder(name, rootFolder)
     elif select == 1:
         common.showInfo(
             'Please browse through PGLiveTV and use \ncontext menu entry "Add to PGLiveTV favourites"'
         )
     elif select == 2:
         return self._addXbmcFavourite(rootFolder)
     return False
Esempio n. 10
0
 def editItem(self, item):
     menuItems = ["Change label", "Change icon", "Change fanart"]
     virtualFolders = self._getVirtualFoldersList()
     if len(virtualFolders) > 0 and not item.getInfo('url').startswith(
             'favfolders/'):
         menuItems.append("Move to folder")
     select = xbmcgui.Dialog().select('Choose', menuItems)
     if select == -1:
         return False
     cfgFile = self._favouritesFile
     definedIn = item.getInfo('definedIn')
     if definedIn and definedIn.startswith('favfolders/'):
         cfgFile = os.path.join(self._favouritesFoldersFolder,
                                definedIn.split('/')[1])
     if select == 0:
         newLabel = getKeyboard(default=item.getInfo('title'),
                                heading='Change label')
         if not newLabel or newLabel == "":
             return False
         self.changeLabel(item, newLabel)
     elif select == 1:
         newIcon = getImage('Change icon')
         if not newIcon:
             return False
         self.changeIcon(item, newIcon)
     elif select == 2:
         newFanart = getImage('Change fanart')
         if not newFanart:
             return False
         self.changeFanart(item, newFanart)
     elif select == 3:
         newCfgFile = self._virtualFolderSelection()
         if not newCfgFile or cfgFile == newCfgFile:
             return False
         self.moveToFolder(cfgFile, item, newCfgFile)
     return True
Esempio n. 11
0
def showOSK(defaultText='', title='', hidden=False):
    return getKeyboard(defaultText, title, hidden)
Esempio n. 12
0
def showOSK(defaultText='', title='', hidden=False):
    return getKeyboard(defaultText, title, hidden)