当前位置: 首页>>代码示例>>Python>>正文


Python FavouritesManager.add方法代码示例

本文整理汇总了Python中favouritesManager.FavouritesManager.add方法的典型用法代码示例。如果您正苦于以下问题:Python FavouritesManager.add方法的具体用法?Python FavouritesManager.add怎么用?Python FavouritesManager.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在favouritesManager.FavouritesManager的用法示例。


在下文中一共展示了FavouritesManager.add方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from favouritesManager import FavouritesManager [as 别名]
# 或者: from favouritesManager.FavouritesManager import add [as 别名]
class Main:

    MAIN_MENU_FILE = 'mainMenu.cfg'


    def __init__(self):
        
        if not os.path.exists(common.Paths.pluginDataDir):
            os.makedirs(common.Paths.pluginDataDir, 0777)

        self.favouritesManager = FavouritesManager(common.Paths.favouritesFolder)
        self.customModulesManager = CustomModulesManager(common.Paths.customModulesDir, common.Paths.customModulesRepo)
        
        # todo: cache this (due to limited API calls for github)
        self.syncManager = SyncManager()
        #self.syncManager.addSource("Max Mustermann - Catchers", SyncSourceType.CATCHERS, common.Paths.catchersRepo)
        #self.syncManager.addSource("Max Mustermann - Modules", SyncSourceType.MODULES, common.Paths.modulesRepo)
        
        if not os.path.exists(common.Paths.customModulesDir):
            os.makedirs(common.Paths.customModulesDir, 0777)

        self.parser = Parser()
        self.currentlist = None
        
        self.addon = None
        
        common.log('SportsDevil initialized')
        


    def getPlayerType(self):
        sPlayerType = common.getSetting('playerType')
        
        if (sPlayerType == '0'):
            return xbmc.PLAYER_CORE_AUTO
        elif (sPlayerType == '1'):
            return xbmc.PLAYER_CORE_MPLAYER
        elif (sPlayerType == '2'):
            return xbmc.PLAYER_CORE_DVDPLAYER        
        # PLAYER_CORE_AMLPLAYER
        elif (sPlayerType == '3'):
            return 5

        return xbmc.PLAYER_CORE_AUTO


    def playVideo(self, videoItem, isAutoplay = False):
        if not videoItem:
            return

        listitem = self.createXBMCListItem(videoItem)

        title = videoItem['videoTitle']
        if title:
            listitem.setInfo('video', {'title': enc.clean_safe(title)})

        if not isAutoplay:
            xbmcplugin.setResolvedUrl(self.handle, True, listitem)
        else:
            url = urllib.unquote_plus(videoItem['url'])
            xbmc.Player(self.getPlayerType()).play(url, listitem)


    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


    def getVideos(self, lItem, dia = None, percent = 0, percentSpan = 100):
        allitems = []
        
        if dia and dia.isCanceled():
            return allitems
        
        currentName = lItem['title']

        if lItem['type'].find('video') != -1:
#.........这里部分代码省略.........
开发者ID:hackur,项目名称:SportsDevil-Fixes,代码行数:103,代码来源:main.py

示例2: __init__

# 需要导入模块: from favouritesManager import FavouritesManager [as 别名]
# 或者: from favouritesManager.FavouritesManager import add [as 别名]
class MrknowFilms:

    MAIN_MENU_FILE = 'mainMenu.cfg'


    def __init__(self):
        #BASE_RESOURCE_PATH = os.path.join( os.getcwd(), "resources" )
        BASE_RESOURCE_PATH = os.path.join( ptv.getAddonInfo('path'), "resources" )
        BASE_RESOURCE_PATH = os.path.join( ptv2.getAddonInfo('path'), "resources" )

        sys.path.append( os.path.join( BASE_RESOURCE_PATH, "lib" ) )
        sys.path.append( os.path.join( BASE_RESOURCE_PATH, "resources" ) )

        sys.path.append( os.path.join( ptv.getAddonInfo('path'), "host" ) )
        import mrknow_pLog, settings, Parser, mrknow_pCommon

        self.cm = mrknow_pCommon.common()
        self.log = mrknow_pLog.pLog()
        self.settings = settings.TVSettings()
        self.parser = Parser.Parser()
        #self.log.info("DIR " + common.Paths.modulesDir + 'mainMenu.cfg')
        #self.MAIN_MENU_FILE = os.path.join( common.Paths.modulesDir, 'mainMenu.cfg' )
        self.MAIN_MENU_FILE = 'mainMenu.cfg'
        if not os.path.exists(common.Paths.pluginDataDir):
            os.makedirs(common.Paths.pluginDataDir, 0777)

        self.favouritesManager = FavouritesManager(common.Paths.favouritesFolder)
        self.customModulesManager = CustomModulesManager(common.Paths.customModulesDir, common.Paths.customModulesRepo)

        if not os.path.exists(common.Paths.customModulesDir):
            os.makedirs(common.Paths.customModulesDir, 0777)

        self.parser2 = Parser2()
        self.currentlist = None

        self.addon = None
        self.log.info('Filmy online www.mrknow.pl')
        common.clearCache()


    def _parseParameters(self):
        mode = int(self.addon.queries['mode'])
        queryString = self.addon.queries['item']
        item = ListItem.create()
        if mode in [common.Mode2.CHROME, common.Mode2.ADDTOFAVOURITES, common.Mode2.REMOVEFROMFAVOURITES, common.Mode2.EDITITEM]:
            item.infos = self.addon.parse_query(urllib.unquote(queryString),{})
        else:
            item.infos = self.addon.parse_query(queryString,{})
        item.infos = dict((k.decode('utf8'), v.decode('utf8')) for k, v in item.infos.items())
        return [mode, item]


    def showListOptions(self,argv=None):
        params = self.parser.getParams()
        mode = self.parser.getIntParam(params, "mode")
        name = self.parser.getParam(params, "name")
        service = self.parser.getParam(params, "service")
        self.addon = Addon(scriptID, argv)
        print("MMMMMMMM",mode,params)
        mymodes = [common.Mode2.VIEW ,common.Mode2.PLAY, common.Mode2.ADDTOFAVOURITES, common.Mode2.EXECUTE]


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

        paramstring = urllib.unquote_plus(parameter)
        #self.log.info(paramstring)
        #self.log.info('Base: '+ base)
        #self.log.info('Handle: '+ str(handle))
        #self.log.info('Parameter: '+ parameter)
        #self.log.info('LEN: ' + str(len(paramstring)))
        #self.log.info('mode: ' + str(mode))

        if mode == None and name == None and service == None:
            self.log.info('Wyświetlam kategorie')
            self.CATEGORIES()
            #self.LIST(MENU_TABLE)
        elif mode == 1:
            self.LIST(TV_ONLINE_TABLE)
        elif mode == 4:
            self.LIST(FUN_ONLINE_TABLE)
        elif mode == 19:
            self.LIST(SPORT_ONLINE_TABLE)
        elif mode == 2:
            self.LIST(FILM_ONLINE_TABLE)
        elif mode == 3:
            self.LIST(SERIALE_ONLINE_TABLE)
        elif mode == 20:
            self.log.info('Wyświetlam ustawienia')
            self.settings.showSettings()
        elif mode == 30:
            self.LIBRTMP()
        #elif mode == 30 and category=='update':
        #    self.DLLIBRTMP(name,murl)

        elif mode in mymodes:
            try:
#.........这里部分代码省略.........
开发者ID:neopack1,项目名称:filmkodi,代码行数:103,代码来源:default.py

示例3: __init__

# 需要导入模块: from favouritesManager import FavouritesManager [as 别名]
# 或者: from favouritesManager.FavouritesManager import add [as 别名]
class Main:

    MAIN_MENU_FILE = 'mainMenu.cfg'


    def __init__(self):
        
        if not os.path.exists(common.Paths.pluginDataDir):
            os.makedirs(common.Paths.pluginDataDir, 0777)

        self.favouritesManager = FavouritesManager(common.Paths.favouritesFolder)
        self.parser = Parser()
        self.currentlist = None
        self.addon = None
        
        common.log('SportsDevilNL initialized')
        
    def playVideo(self, videoItem, isAutoplay = False):
        if not videoItem:
            return

        listitem = self.createXBMCListItem(videoItem)

        title = videoItem['videoTitle']
        if title:
            listitem.setInfo('video', {'title': title})

        if not isAutoplay:
            xbmcplugin.setResolvedUrl(self.handle, True, listitem)
        else:
            url = urllib.unquote_plus(videoItem['url'])
            xbmc.Player().play(url, listitem)

    def launchChrome(self, url, title):
        action = 'RunPlugin(%s)' % ('plugin://plugin.program.chrome.launcher/?kiosk=yes&mode=showSite&stopPlayback=yes&url=' + url)
        common.log('chrome test:' + str(action))
        xbmc.executebuiltin(action)
        
    def playWebDriver(self, url, title):
        try:
            import liveremote
            video = liveremote.resolve(url)
            liz = xbmcgui.ListItem(title)
            liz.setPath(video)
            liz.setProperty('IsPlayable','true')
            xbmc.Player().play(video, liz)
        except:
            import sys,traceback
            traceback.print_exc(file = sys.stdout)
            common.showInfo('This is not the option you are looking for.')

    def getVideos(self, lItem, dia = None, percent = 0, percentSpan = 100):
        allitems = []
        
        if dia and dia.isCanceled():
            return allitems
        
        currentName = lItem['title']

        if lItem['type'].find('video') != -1:
            if dia:
                dia.update(percent + percentSpan, thirdline=currentName)
            allitems.append(lItem)
        else:
            tmpList = self.parser.parse(lItem).list
            if tmpList and len(tmpList.items) > 0:
                
                if dia:
                    dia.update(percent, secondline=currentName, thirdline=' ')
                
                inc = percentSpan/len(tmpList.items)
                for item in tmpList.items:
                    
                    if dia and dia.isCanceled():
                        break
                    
                    children = self.getVideos(item, dia, percent, inc)
                    if children:
                        allitems.extend(children)
                    percent += inc

        return allitems


    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


    def parseView(self, lItem):
#.........这里部分代码省略.........
开发者ID:EPiC-APOC,项目名称:repository.xvbmc,代码行数:103,代码来源:main.py

示例4: __init__

# 需要导入模块: from favouritesManager import FavouritesManager [as 别名]
# 或者: from favouritesManager.FavouritesManager import add [as 别名]
class Main:

    MAIN_MENU_FILE = "mainMenu.cfg"

    def __init__(self):

        if not os.path.exists(common.Paths.pluginDataDir):
            os.makedirs(common.Paths.pluginDataDir, 0777)

        self.favouritesManager = FavouritesManager(common.Paths.favouritesFolder)
        self.customModulesManager = CustomModulesManager(common.Paths.customModulesDir, common.Paths.customModulesRepo)

        if not os.path.exists(common.Paths.customModulesDir):
            os.makedirs(common.Paths.customModulesDir, 0777)

        self.parser = Parser()
        self.currentlist = None

        self.addon = None

        common.log("SportsDevil initialized")

    def getPlayerType(self):
        sPlayerType = common.getSetting("playerType")

        if sPlayerType == "0":
            return xbmc.PLAYER_CORE_AUTO
        elif sPlayerType == "1":
            return xbmc.PLAYER_CORE_MPLAYER
        elif sPlayerType == "2":
            return xbmc.PLAYER_CORE_DVDPLAYER
        # PLAYER_CORE_AMLPLAYER
        elif sPlayerType == "3":
            return 5

        return xbmc.PLAYER_CORE_AUTO

    def playVideo(self, videoItem, isAutoplay=False):
        if not videoItem:
            return

        listitem = self.createXBMCListItem(videoItem)

        title = videoItem["videoTitle"]
        if title:
            listitem.setInfo("video", {"title": title})

        if not isAutoplay:
            xbmcplugin.setResolvedUrl(self.handle, True, listitem)
        else:
            url = urllib.unquote_plus(videoItem["url"])
            # xbmc.Player(self.getPlayerType()).play(url, listitem)
            xbmc.Player().play(url, listitem)

    def launchChrome(self, url, title):
        action = "RunPlugin(%s)" % (
            "plugin://plugin.program.chrome.launcher/?kiosk=yes&mode=showSite&stopPlayback=yes&url=" + url
        )
        common.log("chrome test:" + str(action))
        xbmc.executebuiltin(action)

    def playWebDriver(self, url, title):
        try:
            import liveremote

            video = liveremote.resolve(url)
            liz = xbmcgui.ListItem(title)
            liz.setPath(video)
            liz.setProperty("IsPlayable", "true")
            # xbmc.Player(self.getPlayerType()).play(video, liz)
            xbmc.Player().play(video, liz)
        except:
            import sys, traceback

            traceback.print_exc(file=sys.stdout)
            common.showInfo("This is not the option you are looking for.")

    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:
#.........这里部分代码省略.........
开发者ID:mrknow,项目名称:filmkodi,代码行数:103,代码来源:main.py


注:本文中的favouritesManager.FavouritesManager.add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。