本文整理汇总了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
示例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()
示例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)
示例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 ''
示例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
示例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)
示例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
示例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
示例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
示例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
示例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'
示例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
示例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")
示例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)
示例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