當前位置: 首頁>>代碼示例>>Python>>正文


Python xbmc.getInfoLabel方法代碼示例

本文整理匯總了Python中xbmc.getInfoLabel方法的典型用法代碼示例。如果您正苦於以下問題:Python xbmc.getInfoLabel方法的具體用法?Python xbmc.getInfoLabel怎麽用?Python xbmc.getInfoLabel使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在xbmc的用法示例。


在下文中一共展示了xbmc.getInfoLabel方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: get_device_name

# 需要導入模塊: import xbmc [as 別名]
# 或者: from xbmc import getInfoLabel [as 別名]
def get_device_name():

    ''' Detect the device name. If deviceNameOpt, then
        use the device name in the add-on settings.
        Otherwise fallback to the Kodi device name.
    '''
    if not settings('deviceNameOpt.bool'):
        device_name = xbmc.getInfoLabel('System.FriendlyName').decode('utf-8')
    else:
        device_name = settings('deviceName')
        device_name = device_name.replace("\"", "_")
        device_name = device_name.replace("/", "_")

    if not device_name:
        device_name = "Kodi"

    return device_name 
開發者ID:MediaBrowser,項目名稱:plugin.video.emby,代碼行數:19,代碼來源:client.py

示例2: remove_watched_status

# 需要導入模塊: import xbmc [as 別名]
# 或者: from xbmc import getInfoLabel [as 別名]
def remove_watched_status(self, videoid):
        """Remove the watched status from the Netflix service"""
        if not ui.ask_for_confirmation(common.get_local_string(30168),
                                       common.get_local_string(30300).format(xbmc.getInfoLabel('ListItem.Label'))):
            return
        if not api.remove_watched_status(videoid):
            ui.show_notification('The operation was cancelled due to an unexpected error')
            return
        # Check if item is in the cache
        videoid_exists, list_id = common.make_http_call('get_continuewatching_videoid_exists',
                                                        {'video_id': str(videoid.value)})
        if videoid_exists:
            # Try to remove the videoid from the list in the cache
            try:
                video_list_sorted_data = g.CACHE.get(cache_utils.CACHE_COMMON, list_id)
                del video_list_sorted_data.videos[videoid.value]
                g.CACHE.add(cache_utils.CACHE_COMMON, list_id, video_list_sorted_data)
                common.json_rpc('Input.Down')  # Avoids selection back to the top
            except CacheMiss:
                pass
        common.container_refresh() 
開發者ID:CastagnaIT,項目名稱:plugin.video.netflix,代碼行數:23,代碼來源:actions.py

示例3: root

# 需要導入模塊: import xbmc [as 別名]
# 或者: from xbmc import getInfoLabel [as 別名]
def root(self, pathitems=None):  # pylint: disable=unused-argument
        """Show profiles or home listing when profile auto-selection is enabled"""
        # Get the URL parent path of the navigation: xbmc.getInfoLabel('Container.FolderPath')
        #   it can be found in Kodi log as "ParentPath = [xyz]" but not always return the exact value
        is_parent_root_path = xbmc.getInfoLabel('Container.FolderPath') == g.BASE_URL + '/'
        # Fetch initial page to refresh all session data
        if is_parent_root_path:
            common.make_call('fetch_initial_page')
        # Note when the profiles are updated to the database (by fetch_initial_page call),
        #   the update sanitize also relative settings to profiles (see _delete_non_existing_profiles in website.py)
        autoselect_profile_guid = g.LOCAL_DB.get_value('autoselect_profile_guid', '')
        if autoselect_profile_guid:
            if is_parent_root_path:
                common.info('Performing auto-selection of profile {}', autoselect_profile_guid)
            # Do not perform the profile switch if navigation come from a page that is not the root url,
            # prevents profile switching when returning to the main menu from one of the sub-menus
            if not is_parent_root_path or activate_profile(autoselect_profile_guid):
                self.home(None, False, True)
                return
        list_data, extra_data = common.make_call('get_profiles', {'request_update': False})
        self._profiles(list_data, extra_data) 
開發者ID:CastagnaIT,項目名稱:plugin.video.netflix,代碼行數:23,代碼來源:directory.py

示例4: __init__

# 需要導入模塊: import xbmc [as 別名]
# 或者: from xbmc import getInfoLabel [as 別名]
def __init__(self):
        import re
        self.build_version = xbmc.getInfoLabel('System.BuildVersion')
        # Parse the version number
        result = re.search(r'\d+\.\d+', self.build_version)
        self.version = result.group(0) if result else ''
        # Parse the major version number
        self.major_version = self.version.split('.')[0] if self.version else ''
        # Parse the date of GIT build
        result = re.search(r'(Git:)(\d+?(?=(-|$)))', self.build_version)
        self.date = int(result.group(2)) if result and len(result.groups()) >= 2 else None
        # Parse the stage name
        result = re.search(r'(\d+\.\d+-)(.+)(?=\s)', self.build_version)
        if not result:
            result = re.search(r'^(.+)(-\d+\.\d+)', self.build_version)
            self.stage = result.group(1) if result else ''
        else:
            self.stage = result.group(2) if result else '' 
開發者ID:CastagnaIT,項目名稱:plugin.video.netflix,代碼行數:20,代碼來源:kodiops.py

示例5: getPlatform

# 需要導入模塊: import xbmc [as 別名]
# 或者: from xbmc import getInfoLabel [as 別名]
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 
開發者ID:Zomboided,項目名稱:service.vpn.manager,代碼行數:20,代碼來源:vpnplatform.py

示例6: getConnectTime

# 需要導入模塊: import xbmc [as 別名]
# 或者: from xbmc import getInfoLabel [as 別名]
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) 
開發者ID:Zomboided,項目名稱:service.vpn.manager,代碼行數:22,代碼來源:common.py

示例7: get_current_view

# 需要導入模塊: import xbmc [as 別名]
# 或者: from xbmc import getInfoLabel [as 別名]
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 
開發者ID:tvaddonsco,項目名稱:script.module.urlresolver,代碼行數:22,代碼來源:kodi.py

示例8: get_curplayback

# 需要導入模塊: import xbmc [as 別名]
# 或者: from xbmc import getInfoLabel [as 別名]
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 
開發者ID:kodi-community-addons,項目名稱:plugin.audio.spotify,代碼行數:19,代碼來源:osd.py

示例9: wait_for_update

# 需要導入模塊: import xbmc [as 別名]
# 或者: from xbmc import getInfoLabel [as 別名]
def wait_for_update(self, call_id=None, poll=1, timeout=60):
        """
        Wait for container to update.
        Returns True if successful
        """
        is_instance = self.get_instance(call_id)
        is_updating = xbmc.getCondVisibility("Container(9999).IsUpdating")
        num_items = utils.try_parse_int(xbmc.getInfoLabel("Container(9999).NumItems"))

        t = 0
        while not self.monitor.abortRequested() and t < timeout and is_instance and (is_updating or not num_items):
            self.monitor.waitForAbort(poll)
            is_instance = self.get_instance(call_id)
            is_updating = xbmc.getCondVisibility("Container(9999).IsUpdating")
            num_items = utils.try_parse_int(xbmc.getInfoLabel("Container(9999).NumItems"))
            t += poll

        return True if is_instance and t < timeout else False 
開發者ID:jurialmunkey,項目名稱:plugin.video.themoviedb.helper,代碼行數:20,代碼來源:script.py

示例10: get_mediatype

# 需要導入模塊: import xbmc [as 別名]
# 或者: from xbmc import getInfoLabel [as 別名]
def get_mediatype(listitem):
    try:
        item = listitem.getVideoInfoTag().getMediaType()
        if not item:
            item = listitem.getMusicInfoTag().getMediaType()
        return item
    except AttributeError:
        # DEPRECATED: Before Krypton
        pass
    count = 0
    mediatype = xbmc.getInfoLabel('ListItem.DBTYPE')
    while not mediatype and count < 5:
        count += 1
        xbmc.sleep(200)
        mediatype = xbmc.getInfoLabel('ListItem.DBTYPE')
    if not mediatype:
        xbmc.executebuiltin('Notification(Artwork Beef cannot proceed, "Got an unexpected content type. Try again, it should work.", 6000, DefaultIconWarning.png)')
    return mediatype 
開發者ID:rmrector,項目名稱:script.artwork.beef,代碼行數:20,代碼來源:context.py

示例11: logGA

# 需要導入模塊: import xbmc [as 別名]
# 或者: from xbmc import getInfoLabel [as 別名]
def logGA(channel, param, programName):
    url = 'http://www.google-analytics.com/collect'
    cid = str(uuid.uuid1())
    cid = cid[cid.rfind('-') + 1:]
    tid = 'UA-62709903-1'
    build = xbmc.getInfoLabel("System.BuildVersion")
    build = 'Kodi ' + build[:build.find(' ')]
    values = {'v': '1',
              'tid': tid,
              'cid': cid,
              't': 'pageview',
              'dl': 'c=%s&p=%s' % (channel, param),
              'dt': programName[:50],
              'ua': build,
              'dr': (globalvar.ADDON.getAddonInfo('name') + '-' + globalvar.ADDON.getAddonInfo('version'))}
    print 'Log', 'c=%s&p=%s' % (channel, param)
    try:
      data = urllib.urlencode(values)
      req = urllib2.Request(url, data)
      response = urllib2.urlopen(req)
    except Exception:
      print 'Error during Google Analytics' 
開發者ID:spmjc,項目名稱:plugin.video.freplay,代碼行數:24,代碼來源:log.py

示例12: GetCurrentView

# 需要導入模塊: import xbmc [as 別名]
# 或者: from xbmc import getInfoLabel [as 別名]
def GetCurrentView(self):
        skinPath = xbmc.translatePath('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)
            log.info("Skin's ViewModes: %s" % views)
            for view in views.split(','):
                if xbmc.getInfoLabel('Control.GetLabel(%s)' % view):
                    return view 
開發者ID:alfa-addon,項目名稱:addon,代碼行數:23,代碼來源:rpc.py

示例13: Search

# 需要導入模塊: import xbmc [as 別名]
# 或者: from xbmc import getInfoLabel [as 別名]
def Search(item):
    try:
        rmtree(__temp__)
    except:
        pass
    try:
        os.makedirs(__temp__)
    except:
        pass

    if item['mansearch']:
        title = item['mansearchstr']
        getSubByTitle(title, item['3let_language'])
    else:
        title = '%s %s' % (item['title'], item['year'])
        # pass original filename, api.assrt.net will handle it more properly
        getSubByTitle(xbmc.getInfoLabel("VideoPlayer.Title"),
                      item['3let_language'])  # use assrt.net
        if __addon__.getSetting("subSourceAPI") == 'true':  # use splayer api
            if 'chi' in item['3let_language']:
                getSubByHash(item['file_original_path'],
                             "chn", "zh", "Chinese")
            if 'eng' in item['3let_language']:
                getSubByHash(item['file_original_path'],
                             "eng", "en", "English") 
開發者ID:taxigps,項目名稱:xbmc-addons-chinese,代碼行數:27,代碼來源:service.py

示例14: getControls

# 需要導入模塊: import xbmc [as 別名]
# 或者: from xbmc import getInfoLabel [as 別名]
def getControls(self):
        coordinates = self.getControl(2000).getPosition()

        c_anim = []
        try:
            for anim in re.findall("(\[.*?\])", xbmc.getInfoLabel("Control.GetLabel(1999)"), re.S):
                try: c_anim.append(tuple(eval(anim)))
                except: pass
        except:
            print_exc()

        self.controls["background"] = Control(self.getControl(2001), 0, coordinates, c_anim)

        self.controls["heading"] = Control(self.getControl(2002), 1, coordinates, c_anim)

        self.controls["label"] = Control(self.getControl(2003), 1, coordinates, c_anim)

        try:
            v = xbmc.getInfoLabel("Control.GetLabel(2045)").replace(", ", ",")
            progressTextures = dict([k.split("=") for k in v.split(",")])
        except:
            progressTextures = {}


        self.controls["progress"] = Control(self.getControl(2004), 2, coordinates, c_anim, **progressTextures) 
開發者ID:seppius-xbmc-repo,項目名稱:ru,代碼行數:27,代碼來源:DialogDownloadProgress.py

示例15: __init__

# 需要導入模塊: import xbmc [as 別名]
# 或者: from xbmc import getInfoLabel [as 別名]
def __init__(self, parent_win=None, **kwargs):
        if xbmc.getInfoLabel("Window.Property(DialogDownloadProgress.IsAlive)") == "true":
            raise xbmcguiWindowError("DialogDownloadProgress IsAlive: Not possible to overscan!")

        self.SKINS_PATH = os.path.join(addonDir, "resources", "skins")
        self.ADDON_SKIN = ("default", XBMC_SKIN)[os.path.exists(os.path.join(self.SKINS_PATH, XBMC_SKIN))]
        windowXml = DialogDownloadProgressXML("DialogDownloadProgress.xml", addonDir, self.ADDON_SKIN)
        #windowXml = DialogDownloadProgressXML("DialogProgress.xml", addonDir, self.ADDON_SKIN) # Aeon nox
        self.controls = windowXml.controls
        del windowXml

        self.window   = parent_win
        self.windowId = parent_win

        self.background = None
        self.heading	= None
        self.label	  = None
        self.progress   = None 
開發者ID:seppius-xbmc-repo,項目名稱:ru,代碼行數:20,代碼來源:DialogDownloadProgress.py


注:本文中的xbmc.getInfoLabel方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。