python类getInfoLabel()的实例源码

colorthemes.py 文件源码 项目:script.skin.helper.skinbackup 作者: marcelveldt 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def daynightthemes(self, dayornight):
        '''allow user to set a specific theme during day/night time'''

        if dayornight not in ["day", "night"]:
            log_msg("Invalid parameter for day/night theme - must be day or night")
            return

        # show listing with themes
        listitems = self.get_skin_colorthemes()
        listitems += self.get_user_colorthemes()
        header = self.addon.getLocalizedString(32031)
        curvalue = xbmc.getInfoLabel("Skin.String(SkinHelper.ColorTheme.%s.theme)" % dayornight).decode("utf-8")
        dialog = DialogSelect("DialogSelect.xml", "", windowtitle=header,
                              richlayout=True, listing=listitems, autofocus=curvalue)
        dialog.doModal()
        result = dialog.result
        del dialog
        if result:
            themefile = result.getfilename().decode("utf-8")
            themename = result.getLabel().decode("utf-8")
            self.set_day_night_theme(dayornight, themename, themefile)
colorthemes.py 文件源码 项目:script.skin.helper.skinbackup 作者: marcelveldt 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def set_day_night_theme(self, dayornight, themename, themefile):
        ''' Sets a new daynight theme'''
        currenttimevalue = xbmc.getInfoLabel("Skin.String(SkinHelper.ColorTheme.%s.time)" % dayornight)
        if not currenttimevalue:
            currenttimevalue = "20:00" if dayornight == "night" else "07:00"
        timevalue = xbmcgui.Dialog().input(self.addon.getLocalizedString(32017),
                                           currenttimevalue).decode("utf-8")
        try:
            # check if the time is valid
            check_date = datetime(*(time.strptime(timevalue, "%H:%M")[0:6]))
            del check_date
            base_setting = "SkinHelper.ColorTheme.%s" % dayornight
            xbmc.executebuiltin("Skin.SetString(%s.theme,%s)" % (base_setting, themename.encode("utf-8")))
            xbmc.executebuiltin("Skin.SetString(%s.time,%s)" % (base_setting, timevalue))
            label = "%s  (%s %s)" % (themename.encode("utf-8"), self.addon.getLocalizedString(32019), timevalue)
            xbmc.executebuiltin("Skin.SetString(%s.label,%s)" % (base_setting, label))
            xbmc.executebuiltin("Skin.SetString(%s.file,%s)" % (base_setting, themefile.encode("utf-8")))
        except Exception as exc:
            log_exception(__name__, exc)
            xbmcgui.Dialog().ok(xbmc.getLocalizedString(329), self.addon.getLocalizedString(32018))
colorthemes.py 文件源码 项目:script.skin.helper.skinbackup 作者: marcelveldt 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def check_daynighttheme(self):
        '''check if a specific day or night theme should be applied'''
        if xbmc.getCondVisibility(
                "Skin.HasSetting(SkinHelper.EnableDayNightThemes) + "
                "Skin.String(SkinHelper.ColorTheme.Day.time) + "
                "Skin.String(SkinHelper.ColorTheme.Night.time)"):
            try:
                daytime = xbmc.getInfoLabel("Skin.String(SkinHelper.ColorTheme.Day.time)")
                daytime = datetime(*(time.strptime(daytime, "%H:%M")[0:6])).time()
                nighttime = xbmc.getInfoLabel("Skin.String(SkinHelper.ColorTheme.Night.time)")
                nighttime = datetime(*(time.strptime(nighttime, "%H:%M")[0:6])).time()
                timestamp = datetime.now().time()
                if daytime <= timestamp <= nighttime:
                    dayornight = "Day"
                else:
                    dayornight = "Night"
                current_theme = xbmc.getInfoLabel("Skin.String(SkinHelper.LastColorTheme)")
                newtheme = xbmc.getInfoLabel("Skin.String(SkinHelper.ColorTheme.%s.theme)" % dayornight)
                if current_theme != newtheme:
                    themefile = xbmc.getInfoLabel("Skin.String(SkinHelper.ColorTheme.%s.file)" % dayornight)
                    self.load_colortheme(themefile)
            except Exception as exc:
                log_exception(__name__, exc)
osd.py 文件源码 项目:plugin.audio.spotify 作者: marcelveldt 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def get_curplayback(self):
        '''get current playback details - retry on error'''
        count = 5
        while count and self.active:
            try:
                cur_playback = self.dialog.sp.current_playback()
                return cur_playback
            except Exception as exc:
                if "token expired" in str(exc):
                    token = xbmc.getInfoLabel("Window(Home).Property(spotify-token)")
                    self.sp._auth = token
                else:
                    log_exception(__name__, exc)
            count -= 1
            xbmc.sleep(500)
        self.dialog.close_dialog()
        return None
Settings.py 文件源码 项目:plugin.video.telekom-sport 作者: asciidisco 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def __get_mac_address(cls, delay=1):
        """
        Returns the users mac address

        :param delay: retry delay in sec
        :type delay: int
        :returns:  string -- Devices MAC address
        """
        mac_addr = xbmc.getInfoLabel('Network.MacAddress')
        # hack response busy
        i = 0
        while ':' not in mac_addr and i < 3:
            i += 1
            time.sleep(delay)
            mac_addr = xbmc.getInfoLabel('Network.MacAddress')
        return mac_addr
kodi.py 文件源码 项目:context.youtube.download 作者: anxdpanic 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def get_current_view():
    skinPath = translate_path('special://skin/')
    xml = os.path.join(skinPath, 'addon.xml')
    f = xbmcvfs.File(xml)
    read = f.read()
    f.close()
    try:
        src = re.search('defaultresolution="([^"]+)', read, re.DOTALL).group(1)
    except:
        src = re.search('<res.+?folder="([^"]+)', read, re.DOTALL).group(1)
    src = os.path.join(skinPath, src, 'MyVideoNav.xml')
    f = xbmcvfs.File(src)
    read = f.read()
    f.close()
    match = re.search('<views>([^<]+)', read, re.DOTALL)
    if match:
        views = match.group(1)
        for view in views.split(','):
            if xbmc.getInfoLabel('Control.GetLabel(%s)' % view): return view
utils.py 文件源码 项目:plugin.video.netflix 作者: asciidisco 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def __get_mac_address(delay=1):
    """
    Returns the users mac address

    :param delay: retry delay in sec
    :type delay: int
    :returns:  string -- Devices MAC address
    """
    mac_addr = xbmc.getInfoLabel('Network.MacAddress')
    # hack response busy
    i = 0
    while ':' not in mac_addr and i < 3:
        i += 1
        time.sleep(delay)
        mac_addr = xbmc.getInfoLabel('Network.MacAddress')
    return mac_addr
myPlayer.py 文件源码 项目:plugin.video.stream-cinema 作者: bbaronSVK 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def timeRatio(self):
        if self.isPlayingVideo():
            self.watchedTime = self.getTime()
            self.itemDuration = self.getTotalTime()
        try:
            util.debug("[SC] watched %f duration %f" % (self.watchedTime, self.itemDuration))
            return float("%.3f" % (self.watchedTime / math.floor(self.itemDuration)))
        except Exception, e:
            util.debug("[SC] timeRatio error")
            util.debug(e)
            pass
        try:
            self.realFinishTime = xbmc.getInfoLabel('Player.FinishTime(hh:mm:ss)')
            return (self.get_sec(self.estimateFinishTime).seconds - \
                self.get_sec(self.realFinishTime).seconds) / \
                math.floor(self.itemDuration)
        except:
            return None
koditidal2.py 文件源码 项目:plugin.audio.tidal2 作者: arnesongit 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def add_list_items(self, items, content=None, end=True, withNextPage=False):
        TidalSession.add_list_items(self, items, content=content, end=end, withNextPage=withNextPage)
        if end:
            try:
                self.save_album_cache()
                kodiVersion = xbmc.getInfoLabel('System.BuildVersion').split()[0]
                kodiVersion = kodiVersion.split('.')[0]
                skinTheme = xbmc.getSkinDir().lower()
                if 'onfluence' in skinTheme:
                    if kodiVersion <= '16':
                        xbmc.executebuiltin('Container.SetViewMode(506)')
                    elif content == 'musicvideos':
                        xbmc.executebuiltin('Container.SetViewMode(511)')
                    elif content == 'artists':
                        xbmc.executebuiltin('Container.SetViewMode(512)')
                    else:
                        xbmc.executebuiltin('Container.SetViewMode(506)')
                elif 'estuary' in skinTheme:
                    xbmc.executebuiltin('Container.SetViewMode(55)')
            except:
                pass
pasateatorrent.py 文件源码 项目:pelisalacarta-ce 作者: pelisalacarta-ce 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def get_page(url):
    logger.info()
    global krypton
    xbmc_version =xbmc.getInfoLabel( "System.BuildVersion" )
    check_xbmc_version = scrapertools.get_match(xbmc_version,'(\d+).')

    if check_xbmc_version >=17:
       krypton=True   
       data = httptools.downloadpage(url).data
    else:
       data = httptools.downloadpage("http://ssl-proxy.my-addr.org/myaddrproxy.php/"+url).data


    return data

#Para la busqueda en bing evitando baneos
utils.py 文件源码 项目:context.elementum 作者: elgatito 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def getMediaType():
    version = xbmcVersion()

    if xbmc.getInfoLabel('ListItem.DBTYPE'):
        # Seasons and calls from library will work
        return xbmc.getInfoLabel('ListItem.DBTYPE')
    elif version >= 18:
        # Will work on Kodi 17 and further
        return getVideoTag().getMediaType()
    else:
        # No other way, we query Kodi for information
        dbid = getDbId()

        response = getJSONResponse('{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovieDetails", "params": { "movieid": %s }, "id": "0"}' % dbid)
        if 'error' not in response:
            return 'movie'

        response = getJSONResponse('{"jsonrpc": "2.0", "method": "VideoLibrary.GetEpisodeDetails", "params": { "episodeid": %s }, "id": "0"}' % dbid)
        if 'error' not in response:
            return 'episode'

        return None
utils.py 文件源码 项目:context.elementum 作者: elgatito 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def xbmcVersion():
    build = xbmc.getInfoLabel('System.BuildVersion')

    methods = [
        lambda b: float(b.split()[0]),
        lambda b: float(b.split()[0].split('-')[1]),
        lambda b: float(b.split()[0].split('-')[0]),
        lambda b: 0.0
    ]

    for m in methods:
        try:
            version = m(build)
            break
        except ValueError:
            # parsing failed, try next method
            pass

    return version
xbmctools.py 文件源码 项目:plugin.video.streamondemand-pureita 作者: orione7 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def playstrm(params,url,category):
    '''Play para videos en ficheros strm
    '''
    logger.info("[xbmctools.py] playstrm url="+url)

    title = unicode( xbmc.getInfoLabel( "ListItem.Title" ), "utf-8" )
    thumbnail = urllib.unquote_plus( params.get("thumbnail") )
    plot = unicode( xbmc.getInfoLabel( "ListItem.Plot" ), "utf-8" )
    server = params["server"]
    if (params.has_key("Serie")):
        serie = params.get("Serie")
    else:
        serie = ""
    if (params.has_key("subtitle")):
        subtitle = params.get("subtitle")
    else:
        subtitle = ""
    from core.item import Item
    from platformcode.subtitletools import saveSubtitleName
    item = Item(title=title,show=serie)
    saveSubtitleName(item)
    play_video("Biblioteca streamondemand",server,url,category,title,thumbnail,plot,strmfile=True,Serie=serie,subtitle=subtitle)
utils.py 文件源码 项目:script.reddit.reader 作者: gedisony 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def xbmcVersion():
    #https://github.com/analogue/mythbox/blob/master/resources/src/mythbox/platform.py
    build = xbmc.getInfoLabel('System.BuildVersion')

    # TODO: regex'ify
    # methods to extract version as number given build string
    methods = [
        lambda b: float(b.split()[0]),               # sample input: 10.1 Git:Unknown
        lambda b: float(b.split()[0].split('-')[1]), # sample input: PRE-11.0 Git:Unknown
        lambda b: float(b.split()[0].split('-')[0]), # sample input: 11.0-BETA1 Git:20111222-22ad8e4
        lambda b: 0.0
    ]

    for m in methods:
        try:
            version = m(build)
            break
        except ValueError:
            # parsing failed, try next method
            pass

    return version
preplay.py 文件源码 项目:plex-for-kodi-mod 作者: mrclemds 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def getRoleItemDDPosition(self):
        y = 980
        if xbmc.getCondVisibility('Control.IsVisible(500)'):
            y += 360
        if xbmc.getCondVisibility('Control.IsVisible(501)'):
            y += 520
        if xbmc.getCondVisibility('!IsEmpty(Window.Property(on.extras))'):
            y -= 300
        if xbmc.getCondVisibility('IntegerGreaterThan(Window.Property(hub.focus),0) + Control.IsVisible(500)'):
            y -= 500
        if xbmc.getCondVisibility('IntegerGreaterThan(Window.Property(hub.focus),1) + Control.IsVisible(501)'):
            y -= 500

        focus = int(xbmc.getInfoLabel('Container(403).Position'))

        x = ((focus + 1) * 304) - 100
        return x, y
videoplayer.py 文件源码 项目:plex-for-kodi-mod 作者: mrclemds 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def getRoleItemDDPosition(self):
        y = 1000
        if xbmc.getCondVisibility('Control.IsVisible(500)'):
            y += 360
        if xbmc.getCondVisibility('Control.IsVisible(501)'):
            y += 520
        if xbmc.getCondVisibility('!IsEmpty(Window.Property(on.extras))'):
            y -= 300
        if xbmc.getCondVisibility('IntegerGreaterThan(Window.Property(hub.focus),0) + Control.IsVisible(500)'):
            y -= 500
        if xbmc.getCondVisibility('IntegerGreaterThan(Window.Property(hub.focus),1) + Control.IsVisible(501)'):
            y -= 500

        focus = int(xbmc.getInfoLabel('Container(403).Position'))

        x = ((focus + 1) * 304) - 100
        return x, y
subitems.py 文件源码 项目:plex-for-kodi-mod 作者: mrclemds 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def getRoleItemDDPosition(self):
        y = 980
        if xbmc.getCondVisibility('Control.IsVisible(500)'):
            y += 360
        if xbmc.getCondVisibility('Control.IsVisible(501)'):
            y += 360
        if xbmc.getCondVisibility('Control.IsVisible(502)'):
            y += 520
        if xbmc.getCondVisibility('!IsEmpty(Window.Property(on.extras))'):
            y -= 300
        if xbmc.getCondVisibility('IntegerGreaterThan(Window.Property(hub.focus),0) + Control.IsVisible(500)'):
            y -= 500
        if xbmc.getCondVisibility('IntegerGreaterThan(Window.Property(hub.focus),1) + Control.IsVisible(501)'):
            y -= 360
        if xbmc.getCondVisibility('IntegerGreaterThan(Window.Property(hub.focus),1) + Control.IsVisible(502)'):
            y -= 500

        focus = int(xbmc.getInfoLabel('Container(403).Position'))

        x = ((focus + 1) * 304) - 100
        return x, y
episodes.py 文件源码 项目:plex-for-kodi-mod 作者: mrclemds 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def getRoleItemDDPosition(self):
        y = 980
        if xbmc.getCondVisibility('Control.IsVisible(500)'):
            y += 360
        if xbmc.getCondVisibility('Control.IsVisible(501)'):
            y += 520
        if xbmc.getCondVisibility('Control.IsVisible(502)'):
            y += 520
        if xbmc.getCondVisibility('!IsEmpty(Window.Property(on.extras))'):
            y -= 125
        if xbmc.getCondVisibility('IntegerGreaterThan(Window.Property(hub.focus),0) + Control.IsVisible(500)'):
            y -= 500
        if xbmc.getCondVisibility('IntegerGreaterThan(Window.Property(hub.focus),1) + Control.IsVisible(501)'):
            y -= 500
        if xbmc.getCondVisibility('IntegerGreaterThan(Window.Property(hub.focus),1) + Control.IsVisible(502)'):
            y -= 500

        focus = int(xbmc.getInfoLabel('Container(403).Position'))

        x = ((focus + 1) * 304) - 100
        return x, y
common.py 文件源码 项目:service.vpn.manager 作者: Zomboided 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def getConnectTime(addon):
    # Get the connection time from the settings or use a default
    t = addon.getSetting("last_connect_time")
    if not t.isdigit():
        # Return the Kodi build time or the time I just wrote this in Feb '17, whichever is more recent
        # Expecting a %m %d %Y format date here but will just grab the year and not do time 
        # formatting because I don't know what Kodi will do to the month in different locales
        seconds = 0
        try:
            build_date = xbmc.getInfoLabel("System.BuildDate")
            seconds = (int(build_date[-4:]) - 1970) * 31557600
        except:
            # In case the formatting of the build date changess
            pass
        vpn_mgr_time = 1487116800
        if seconds < vpn_mgr_time:
            seconds = vpn_mgr_time
        return seconds
    else:
        return int(t)
platform.py 文件源码 项目:service.vpn.manager 作者: Zomboided 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def getPlatform():
    # Work out which platform is being used.
    build = xbmc.getInfoLabel('System.BuildVersion')
    build_number = int(build[0:2])
    if sys.platform == "win32": return platforms.WINDOWS
    if sys.platform == "linux" or sys.platform == "linux2":
        if build_number == 15 and getAddonPath(True, "").startswith("/storage/.kodi/"):
            # For OE 6.0.0 (Kodi 15), openvpn is a separate install             
            return platforms.RPI
        else:
            # Other OE versions and other Linux installs use the openvpn installed in usr/sbin
            return platforms.LINUX

    # **** ADD MORE PLATFORMS HERE ****

    #if sys.platform == "?": return platforms.ANDROID
    #if sys.platform == "darwin": return platforms.MAC
    return platforms.UNKNOWN
colorthemes.py 文件源码 项目:script.skin.helper.skinbackup 作者: marcelveldt 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def get_activetheme():
        '''get current active theme name'''
        return xbmc.getInfoLabel("$INFO[Skin.String(SkinHelper.LastColorTheme)]").decode("utf-8")
backuprestore.py 文件源码 项目:script.skin.helper.skinbackup 作者: marcelveldt 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def get_skinsettings(filters=None):
        '''get all active skin settings'''
        all_skinsettings = []
        guisettings_path = 'special://profile/addon_data/%s/settings.xml' % xbmc.getSkinDir()
        if xbmcvfs.exists(guisettings_path):
            doc = parse(xbmc.translatePath(guisettings_path).decode("utf-8"))
            skinsettings = doc.documentElement.getElementsByTagName('setting')
            for skinsetting in skinsettings:
                settingname = skinsetting.attributes['id'].nodeValue
                settingtype = skinsetting.attributes['type'].nodeValue
                if isinstance(settingname, unicode):
                    settingname = settingname.encode("utf-8")
                # we must grab the actual values because the xml file only updates at restarts
                if settingtype == "bool":
                    if "$INFO" not in settingname and xbmc.getCondVisibility("Skin.HasSetting(%s)" % settingname):
                        settingvalue = "true"
                    else:
                        settingvalue = "false"
                else:
                    settingvalue = xbmc.getInfoLabel("Skin.String(%s)" % settingname)
                if not filters:
                    # no filter - just add all settings we can find
                    all_skinsettings.append((settingtype, settingname, settingvalue))
                else:
                    # only select settings defined in our filters
                    for filteritem in filters:
                        if filteritem.lower() in settingname.lower():
                            all_skinsettings.append((settingtype, settingname, settingvalue))
        return all_skinsettings
plugin_content.py 文件源码 项目:plugin.audio.spotify 作者: marcelveldt 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def active_playback_device(self):
        '''determine if we should use local playback or connect playback'''
        playback = self.addon.getSetting("playback_device")
        connect_id = ""
        if not playback:
            # set default to local playback if supported
            if self.win.getProperty("spotify.supportsplayback"):
                playback = "local"
            else:
                playback = "connect"
            self.addon.setSetting("playback_device", playback)
        # set device name
        if playback == "local":
            is_local = True
            devicename = self.addon.getLocalizedString(11037)
        elif playback == "remote":
            is_local = True
            connect_id = self.addon.getSetting("connect_id")
            devicename = self.addon.getLocalizedString(11063) % connect_id
        elif playback == "squeezebox":
            is_local = False
            devicename = xbmc.getInfoLabel("System.AddonTitle(plugin.audio.squeezebox)")
        else:
            is_local = False
            devicename = "Spotify Connect"  # placeholder value
            for device in self.sp.devices()["devices"]:
                if device["is_active"]:
                    devicename = device["name"]
        return is_local, devicename, connect_id
plugin_content.py 文件源码 项目:plugin.audio.spotify 作者: marcelveldt 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def add_track_to_playlist(self):
        xbmc.executebuiltin("ActivateWindow(busydialog)")

        if not self.trackid and xbmc.getInfoLabel("MusicPlayer.(1).Property(spotifytrackid)"):
            self.trackid = xbmc.getInfoLabel("MusicPlayer.(1).Property(spotifytrackid)")

        playlists = self.sp.user_playlists(self.userid, limit=50, offset=0)
        ownplaylists = []
        ownplaylistnames = []
        for playlist in playlists['items']:
            if playlist["owner"]["id"] == self.userid:
                ownplaylists.append(playlist)
                ownplaylistnames.append(playlist["name"])
        ownplaylistnames.append(xbmc.getLocalizedString(525))
        xbmc.executebuiltin("Dialog.Close(busydialog)")
        select = xbmcgui.Dialog().select(xbmc.getLocalizedString(524), ownplaylistnames)
        if select != -1 and ownplaylistnames[select] == xbmc.getLocalizedString(525):
            # create new playlist...
            kb = xbmc.Keyboard('', xbmc.getLocalizedString(21381))
            kb.setHiddenInput(False)
            kb.doModal()
            if kb.isConfirmed():
                name = kb.getText()
                playlist = self.sp.user_playlist_create(self.userid, name, False)
                self.sp.user_playlist_add_tracks(self.userid, playlist["id"], [self.trackid])
        elif select != -1:
            playlist = ownplaylists[select]
            self.sp.user_playlist_add_tracks(self.userid, playlist["id"], [self.trackid])
utils.py 文件源码 项目:plugin.audio.spotify 作者: marcelveldt 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def get_playername():
    playername = xbmc.getInfoLabel("System.FriendlyName").decode("utf-8")
    if playername == "Kodi":
        import socket
        playername = "Kodi (%s)" % socket.gethostname()
    return playername
tweets.py 文件源码 项目:script.matchcenter 作者: enen92 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def start(twitterhash=None, standalone=False):
    if not twitterhash:
        userInput = True
        if os.path.exists(tweet_file):
            twitter_data = json.loads(FileIO.fileread(tweet_file))
            twitterhash = twitter_data["hash"]
            twitter_mediafile = twitter_data["file"]
            if twitter_mediafile == xbmc.getInfoLabel('Player.Filenameandpath'):
                userInput = False
    else:
        userInput = False

    if userInput:
        dialog = xbmcgui.Dialog()
        twitterhash = dialog.input(translate(32046), type=xbmcgui.INPUT_ALPHANUM)
        if len(twitterhash) != 0:
            twitterhash = twitterhash.replace("#","")
        else:
            xbmcgui.Dialog().ok(translate(32000), translate(32047))
            mainmenu.start()

    if twitterhash:
        #Save twitter hashtag
        if twitter_history_enabled == 'true':
            tweet.add_hashtag_to_twitter_history(twitterhash)
        if xbmc.getCondVisibility("Player.HasMedia") and save_hashes_during_playback == 'true':
            tweet.savecurrenthash(twitterhash)

        main = TwitterDialog('script-matchcenter-Twitter.xml', addon_path, getskinfolder(), '', hash=twitterhash, standalone=standalone)
        main.doModal()
        del main
ignoreleagues.py 文件源码 项目:script.matchcenter 作者: enen92 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def onInit(self):
        self.getControl(1).setLabel(translate(32003))
        self.getControl(3).setVisible(False)
        leagues = api.Search().Leagues(sport="Soccer")
        ignored_through_context_menu = self.already_ignored
        if leagues:
            items = []
            for league in leagues:
                if removeNonAscii(league.strLeague) in self.already_ignored:
                    item = xbmcgui.ListItem("[COLOR selected]" + league.strLeague + "[/COLOR]")
                    item.setProperty("isIgnored","true")
                    ignored_through_context_menu.remove(removeNonAscii(league.strLeague))
                else:
                    item = xbmcgui.ListItem(league.strLeague)
                    item.setProperty("isIgnored","false")
                item.setArt({"thumb":league.strBadge})
                items.append(item)

            #ignore the ones ignored through context menu
            if ignored_through_context_menu:
                for league_ign in ignored_through_context_menu:
                    item = xbmcgui.ListItem("[COLOR selected]" + league_ign + "[/COLOR]")
                    item.setProperty("isIgnored","true")
                    item.setArt({"thumb":os.path.join(addon_path,"resources","img","nobadge_placeholder.png")})
                    items.append(item)

            self.getControl(6).addItems(items)
            self.setFocusId(6)
            #Krypton
            if int(xbmc.getInfoLabel("System.BuildVersion")[0:2]) >= 17:
                self.getControl(5).setLabel(translate(32052))
                self.getControl(7).setLabel(translate(32053))
tweet.py 文件源码 项目:script.matchcenter 作者: enen92 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def savecurrenthash(_hash):
    media_file = xbmc.getInfoLabel('Player.Filenameandpath')
    media_dict = {"file" : media_file, "hash":_hash}
    if not os.path.exists(tweet_file):
        if not os.path.exists(addon_userdata):
            os.mkdir(addon_userdata)
    FileIO.filewrite(tweet_file,json.dumps(media_dict))
    return
kodi.py 文件源码 项目:context.youtube.download 作者: anxdpanic 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def get_info_label(name):
    return xbmc.getInfoLabel('%s') % name
default.py 文件源码 项目:catchup4kodi 作者: catchup4kodi 项目源码 文件源码 阅读 41 收藏 0 点赞 0 评论 0
def Kodi17():
    xbmc_version =  re.search('^(\d+)', xbmc.getInfoLabel( "System.BuildVersion" ))
    if xbmc_version:
        xbmc_version = int(xbmc_version.group(1))
    else:
        xbmc_version = 1

    if xbmc_version >= 16.9:
            dependencies = []

            import glob


            folder = xbmc.translatePath('special://home/addons/')

            for DEPEND in glob.glob(folder+'*.*'):
                try:dependencies.append(DEPEND.rsplit('\\', 1)[1])
                except:dependencies.append(DEPEND.rsplit('/', 1)[1])


            for THEPLUGIN in dependencies:

                query = '{"jsonrpc":"2.0", "method":"Addons.SetAddonEnabled","params":{"addonid":"%s","enabled":true}, "id":1}' % (THEPLUGIN)

                xbmc.executeJSONRPC(query)

            xbmc.executebuiltin('UpdateLocalAddons') 
            xbmc.executebuiltin("UpdateAddonRepos")


问题


面经


文章

微信
公众号

扫码关注公众号