本文整理汇总了Python中xbmc.getCondVisibility方法的典型用法代码示例。如果您正苦于以下问题:Python xbmc.getCondVisibility方法的具体用法?Python xbmc.getCondVisibility怎么用?Python xbmc.getCondVisibility使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xbmc
的用法示例。
在下文中一共展示了xbmc.getCondVisibility方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: platform
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import getCondVisibility [as 别名]
def platform():
ret = {
"arch": sys.maxsize > 2**32 and "x64" or "x86",
}
if xbmc.getCondVisibility("system.platform.android"):
ret["os"] = "android"
if "arm" in os.uname()[4]:
ret["arch"] = "arm"
elif xbmc.getCondVisibility("system.platform.linux"):
ret["os"] = "linux"
if "arm" in os.uname()[4]:
ret["arch"] = "arm"
elif xbmc.getCondVisibility("system.platform.xbox"):
system_platform = "xbox"
ret["arch"] = ""
elif xbmc.getCondVisibility("system.platform.windows"):
ret["os"] = "windows"
elif xbmc.getCondVisibility("system.platform.osx"):
ret["os"] = "darwin"
elif xbmc.getCondVisibility("system.platform.ios"):
ret["os"] = "ios"
ret["arch"] = "arm"
return ret
示例2: get_platform
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import getCondVisibility [as 别名]
def get_platform():
if xbmc.getCondVisibility('system.platform.osx'):
return "OSX"
elif xbmc.getCondVisibility('system.platform.atv2'):
return "ATV2"
elif xbmc.getCondVisibility('system.platform.ios'):
return "iOS"
elif xbmc.getCondVisibility('system.platform.windows'):
return "Windows"
elif xbmc.getCondVisibility('system.platform.android'):
return "Linux/Android"
elif xbmc.getCondVisibility('system.platform.linux.raspberrypi'):
return "Linux/RPi"
elif xbmc.getCondVisibility('system.platform.linux'):
return "Linux"
else:
return "Unknown"
示例3: run
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import getCondVisibility [as 别名]
def run(self):
while True:
try:
item = self.queue.get(timeout=3)
except Queue.Empty:
break
time = self.music_time if item[0] == 'Audio' else self.video_time
if time and (not self.player.isPlayingVideo() or xbmc.getCondVisibility('VideoPlayer.Content(livetv)')):
dialog("notification", heading="%s %s" % (_(33049), item[0]), message=item[1],
icon="{emby}", time=time, sound=False)
self.queue.task_done()
if window('emby_should_stop.bool'):
break
LOG.info("--<[ q:notify/%s ]", id(self))
self.is_done = True
示例4: get_media_type
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import getCondVisibility [as 别名]
def get_media_type(self):
''' Get media type based on sys.listitem. If unfilled, base on visible window.
'''
media = sys.listitem.getVideoInfoTag().getMediaType() or sys.listitem.getMusicInfoTag().getMediaType()
if not media:
if xbmc.getCondVisibility('Container.Content(albums)'):
media = "album"
elif xbmc.getCondVisibility('Container.Content(artists)'):
media = "artist"
elif xbmc.getCondVisibility('Container.Content(songs)'):
media = "song"
elif xbmc.getCondVisibility('Container.Content(pictures)'):
media = "picture"
else:
LOG.info("media is unknown")
return media.decode('utf-8')
示例5: __init__
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import getCondVisibility [as 别名]
def __init__(self):
# Class initialisation. Fails with a RuntimeError exception if VPN Manager add-on is not available, or too old
self.filtered_addons = []
self.filtered_windows = []
self.primary_vpns = []
self.last_updated = 0
self.refreshLists()
self.default = self.getConnected()
xbmc.log("VPN Mgr API : Default is " + self.default, level=xbmc.LOGDEBUG)
self.timeout = 30
if not xbmc.getCondVisibility("System.HasAddon(service.vpn.manager)"):
xbmc.log("VPN Mgr API : VPN Manager is not installed, cannot use filtering", level=xbmc.LOGERROR)
raise RuntimeError("VPN Manager is not installed")
else:
v = int((xbmcaddon.Addon("service.vpn.manager").getAddonInfo("version").strip()).replace(".",""))
if v < 310:
raise RuntimeError("VPN Manager " + str(v) + " installed, but needs to be v3.1.0 or later")
示例6: current_os
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import getCondVisibility [as 别名]
def current_os():
cos = ''
# FIXME TODO Add other platforms
# Map between Kodi's platform name (defined in http://kodi.wiki/view/List_of_boolean_conditions)
# and the os name in emu_autoconfig.xml
platforms = ('System.Platform.Android',
'System.Platform.OSX',
'System.Platform.Windows',
'System.Platform.Linux')
for platform in platforms:
if xbmc.getCondVisibility(platform):
cos = platform.split('.')[-1]
break
return cos
示例7: set_acestream_engine_cache_folder
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import getCondVisibility [as 别名]
def set_acestream_engine_cache_folder(url):
if not xbmc.getCondVisibility('system.platform.windows'):
opcao= xbmcgui.Dialog().yesno(translate(40000), translate(70011))
else: opcao = ''
if opcao:
if not xbmc.getCondVisibility('system.platform.Android'):
acestream_settings_file = os.path.join(os.getenv("HOME"),'.ACEStream','playerconf.pickle')
else:
acestream_settings_file = os.path.join('/sdcard','.ACEStream','playerconf.pickle')
settings_content = readfile(acestream_settings_file)
cachefolder = xbmcgui.Dialog().browse(3, translate(70012) , 'myprograms','')
if cachefolder:
settings_content = settings_content.replace(url,cachefolder)
save(acestream_settings_file, settings_content)
settings.setSetting('acestream_cachefolder',cachefolder)
xbmc.executebuiltin("Notification(%s,%s,%i,%s)" % (translate(40000), translate(600026), 1,addonpath+"/icon.png"))
xbmc.executebuiltin("Container.Refresh")
示例8: get_system_platform
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import getCondVisibility [as 别名]
def get_system_platform():
if not hasattr(get_system_platform, 'cached'):
platform = "unknown"
if xbmc.getCondVisibility('system.platform.linux') and not xbmc.getCondVisibility('system.platform.android'):
if xbmc.getCondVisibility('system.platform.linux.raspberrypi'):
platform = "linux raspberrypi"
else:
platform = "linux"
elif xbmc.getCondVisibility('system.platform.linux') and xbmc.getCondVisibility('system.platform.android'):
platform = "android"
elif xbmc.getCondVisibility('system.platform.uwp'):
platform = "uwp"
elif xbmc.getCondVisibility('system.platform.windows'):
platform = "windows"
elif xbmc.getCondVisibility('system.platform.osx'):
platform = "osx"
elif xbmc.getCondVisibility('system.platform.ios'):
platform = "ios"
elif xbmc.getCondVisibility('system.platform.tvos'): # Supported only on Kodi 19.x
platform = "tvos"
get_system_platform.cached = platform
return get_system_platform.cached
示例9: run_addon_configuration
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import getCondVisibility [as 别名]
def run_addon_configuration(show_end_msg=False):
"""
Add-on configuration wizard,
automatically configures profiles and add-ons dependencies, based on user-supplied data and device characteristics
"""
system = get_system_platform()
debug('Running add-on configuration wizard ({})', system)
g.settings_monitor_suspend(True, False)
is_4k_capable = is_device_4k_capable()
_set_profiles(system, is_4k_capable)
_set_kodi_settings(system)
_set_isa_addon_settings(is_4k_capable, system == 'android')
# This settings for now used only with android devices and it should remain disabled (keep it for test),
# in the future it may be useful for other platforms or it may be removed
g.ADDON.setSettingBool('enable_force_hdcp', False)
# Enable UpNext if it is installed and enabled
g.ADDON.setSettingBool('UpNextNotifier_enabled', getCondVisibility('System.AddonIsEnabled(service.upnext)'))
g.settings_monitor_suspend(False)
if show_end_msg:
show_ok_dialog(get_local_string(30154), get_local_string(30157))
示例10: __init__
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import getCondVisibility [as 别名]
def __init__(self):
# Class initialisation. Fails with a RuntimeError exception if add-on is not available, or too old
self.filtered_addons = []
self.filtered_windows = []
self.primary_vpns = []
self.last_updated = 0
self.addon_name = ""
self.timeout = 30
if xbmc.getCondVisibility("System.HasAddon(service.vpn.manager)"):
self.addon_name = "service.vpn.manager"
elif xbmc.getCondVisibility("System.HasAddon(service.nord.vpn)"):
self.addon_name = "service.nord.vpn"
if self.addon_name == "":
xbmc.log("VPN API : A VPN add-on is not installed, cannot use filtering", level=xbmc.LOGERROR)
raise RuntimeError("VPN add-on is not installed")
else:
v = int((xbmcaddon.Addon(self.addon_name).getAddonInfo("version").strip()).replace(".",""))
if v < 310:
raise RuntimeError("VPN add-on version " + str(v) + " installed, but needs to be v3.1.0 or later")
self.refreshLists()
self.default = self.getConnected()
xbmc.log("VPN API : Default is " + self.default, level=xbmc.LOGDEBUG)
示例11: __create_dialog
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import getCondVisibility [as 别名]
def __create_dialog(self, line1, line2, line3):
if self.background:
pd = xbmcgui.DialogProgressBG()
msg = line1 + line2 + line3
pd.create(self.heading, msg)
else:
if xbmc.getCondVisibility('Window.IsVisible(progressdialog)'):
pd = CustomProgressDialog.ProgressDialog()
else:
pd = xbmcgui.DialogProgress()
if six.PY2:
pd.create(self.heading, line1, line2, line3)
else:
pd.create(self.heading,
line1 + '\n'
+ line2 + '\n'
+ line3)
return pd
示例12: __init__
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import getCondVisibility [as 别名]
def __init__(self, heading, line1='', line2='', line3='', active=True, countdown=60, interval=5):
self.heading = heading
self.countdown = countdown
self.interval = interval
self.line1 = line1
self.line2 = line2
self.line3 = line3
if active:
if xbmc.getCondVisibility('Window.IsVisible(progressdialog)'):
pd = CustomProgressDialog.ProgressDialog()
else:
pd = xbmcgui.DialogProgress()
if not self.line3:
line3 = 'Expires in: %s seconds' % countdown
if six.PY2:
pd.create(self.heading, line1, line2, line3)
else:
pd.create(self.heading,
line1 + '\n'
+ line2 + '\n'
+ line3)
pd.update(100)
self.pd = pd
else:
self.pd = None
示例13: update_info
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import getCondVisibility [as 别名]
def update_info(self, force):
cur_playback = self.__sp.current_playback()
if cur_playback:
if cur_playback["is_playing"] and (not xbmc.getCondVisibility("Player.Paused") or force):
player_title = None
if self.isPlaying():
player_title = self.getMusicInfoTag().getTitle().decode("utf-8")
trackdetails = cur_playback["item"]
if trackdetails is not None and (not player_title or player_title != trackdetails["name"]):
log_msg("Next track requested by Spotify Connect player")
self.start_playback(trackdetails["id"])
elif cur_playback["is_playing"] and xbmc.getCondVisibility("Player.Paused"):
log_msg("Playback resumed from pause requested by Spotify Connect")
self.__skip_events = True
self.play()
elif not xbmc.getCondVisibility("Player.Paused"):
log_msg("Pause requested by Spotify Connect")
self.__skip_events = True
self.pause()
else:
self.__skip_events = True
self.stop()
示例14: clear_function_cache
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import getCondVisibility [as 别名]
def clear_function_cache(over=False):
dialog = xbmcgui.Dialog()
if not over:
if dialog.yesno(CONFIG.ADDONTITLE,
'[COLOR {0}]Would you like to clear resolver function caches?[/COLOR]'.format(CONFIG.COLOR2),
nolabel='[B][COLOR red]No, Cancel[/COLOR][/B]',
yeslabel='[B][COLOR springgreen]Clear Cache[/COLOR][/B]'):
clear = True
else:
clear = True
if clear:
if xbmc.getCondVisibility('System.HasAddon(script.module.resolveurl)'):
xbmc.executebuiltin('RunPlugin(plugin://script.module.resolveurl/?mode=reset_cache)')
if xbmc.getCondVisibility('System.HasAddon(script.module.urlresolver)'):
xbmc.executebuiltin('RunPlugin(plugin://script.module.urlresolver/?mode=reset_cache)')
示例15: platform
# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import getCondVisibility [as 别名]
def platform():
if xbmc.getCondVisibility('system.platform.android'):
return 'android'
elif xbmc.getCondVisibility('system.platform.linux'):
return 'linux'
elif xbmc.getCondVisibility('system.platform.linux.Raspberrypi'):
return 'linux'
elif xbmc.getCondVisibility('system.platform.windows'):
return 'windows'
elif xbmc.getCondVisibility('system.platform.osx'):
return 'osx'
elif xbmc.getCondVisibility('system.platform.atv2'):
return 'atv2'
elif xbmc.getCondVisibility('system.platform.ios'):
return 'ios'
elif xbmc.getCondVisibility('system.platform.darwin'):
return 'ios'