本文整理汇总了Python中xbmc.getCondVisibility函数的典型用法代码示例。如果您正苦于以下问题:Python getCondVisibility函数的具体用法?Python getCondVisibility怎么用?Python getCondVisibility使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getCondVisibility函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_spotty_binary
def get_spotty_binary(self):
'''find the correct spotty binary belonging to the platform'''
sp_binary = None
if xbmc.getCondVisibility("System.Platform.Windows"):
sp_binary = os.path.join(os.path.dirname(__file__), "spotty", "windows", "spotty.exe")
elif xbmc.getCondVisibility("System.Platform.OSX"):
# macos binary is x86_64 intel
sp_binary = os.path.join(os.path.dirname(__file__), "spotty", "darwin", "spotty")
elif xbmc.getCondVisibility("System.Platform.Linux + !System.Platform.Android"):
# try to find out the correct architecture by trial and error
import platform
architecture = platform.machine()
log_msg("reported architecture: %s" % architecture)
if architecture.startswith('AMD64') or architecture.startswith('x86_64'):
# generic linux x86_64 binary
sp_binary = os.path.join(os.path.dirname(__file__), "spotty", "x86-linux", "spotty-x86_64")
else:
# just try to get the correct binary path if we're unsure about the platform/cpu
paths = []
paths.append(os.path.join(os.path.dirname(__file__), "spotty", "arm-linux", "spotty-muslhf"))
paths.append(os.path.join(os.path.dirname(__file__), "spotty", "arm-linux", "spotty-hf"))
paths.append(os.path.join(os.path.dirname(__file__), "spotty", "arm-linux", "spotty"))
paths.append(os.path.join(os.path.dirname(__file__), "spotty", "x86-linux", "spotty"))
for binary_path in paths:
if self.test_spotty(binary_path):
sp_binary = binary_path
break
if sp_binary:
st = os.stat(sp_binary)
os.chmod(sp_binary, st.st_mode | stat.S_IEXEC)
log_msg("Architecture detected. Using spotty binary %s" % sp_binary)
else:
log_msg("Failed to detect architecture or platform not supported ! Local playback will not be available.")
return sp_binary
示例2: onPlayBackStopped
def onPlayBackStopped(self):
log('player stops')
type = 'unkown'
if (self.isPlayingAudio()):
type = "music"
else:
if xbmc.getCondVisibility('VideoPlayer.Content(movies)'):
filename = ''
isMovie = True
try:
filename = self.getPlayingFile()
except:
pass
if filename != '':
for string in self.substrings:
if string in filename:
isMovie = False
break
if isMovie:
type = "movie"
elif xbmc.getCondVisibility('VideoPlayer.Content(episodes)'):
# Check for tv show title and season to make sure it's really an episode
if xbmc.getInfoLabel('VideoPlayer.Season') != "" and xbmc.getInfoLabel('VideoPlayer.TVShowTitle') != "":
type = "episode"
typevar=type
if typevar!="music":
global script_playerV_stops
log('Going to execute script = "' + script_playerV_stops + '"')
xbmc.executebuiltin('XBMC.RunScript('+script_playerV_stops+ ", " + self.playing_type()+')')
if typevar=="music":
global script_playerA_stops
log('Going to execute script = "' + script_playerA_stops + '"')
xbmc.executebuiltin('XBMC.RunScript('+script_playerA_stops+ ", " + self.playing_type()+')')
示例3: myPlayerChanged
def myPlayerChanged(state):
log('PlayerChanged(%s)' % state)
xbmc.sleep(100)
if state == 'stop':
ret = "static"
else:
currentPlayingFile = xbmc.Player().getPlayingFile()
if re.search(r'3D Movies', currentPlayingFile, re.I):
if re.search(r'OU', currentPlayingFile, re.I):
ret = "3dTAB"
elif re.search(r'SBS', currentPlayingFile, re.I):
ret = "3dSBS"
else:
ret = "movie"
elif xbmc.getCondVisibility("VideoPlayer.Content(musicvideos)"):
ret = "musicvideo"
elif xbmc.getCondVisibility("Player.HasAudio()"):
ret = "static"
else:
ret = "movie"
if settings.overwrite_cat: # fix his out when other isn't
if settings.overwrite_cat_val == 0 and ret != "3dTAB" and ret != "3dSBS": # the static light anymore
ret = "movie"
elif ret != "3dTAB" and ret != "3dSBS":
ret = "musicvideo"
settings.handleCategory(ret)
示例4: __init__
def __init__(self):
footprints()
self.WINDOW = xbmcgui.Window(10000)
self.date = date.today()
self.datestr = str(self.date)
self.weekday = date.today().weekday()
self.days = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
self.ampm = xbmc.getCondVisibility("substring(System.Time,Am)") or xbmc.getCondVisibility(
"substring(System.Time,Pm)"
)
self._parse_argv()
# if __settings__.getSetting( "AddonVersion" ) != __version__:
# __settings__.setSetting ( id = "AddonVersion", value = "%s" % __version__ )
# self.FORCEUPDATE = True
if self.BACKEND:
self.run_backend()
else:
self.update_data()
if self.SILENT == "":
self.show_gui()
else:
oldweekday = date.today().weekday()
while not xbmc.abortRequested:
xbmc.sleep(1000)
newweekday = date.today().weekday()
if newweekday != oldweekday:
oldweekday = newweekday
self.FORCEUPDATE = True
log("### it's midnight, force update")
self.update_data()
self.close("xbmc is closing, stop script")
示例5: APP_LAUNCH
def APP_LAUNCH():
if xbmc.getCondVisibility('system.platform.osx'):
if xbmc.getCondVisibility('system.platform.atv2'):
log_path = '/var/mobile/Library/Preferences'
log = os.path.join(log_path, 'xbmc.log')
logfile = open(log, 'r').read()
else:
log_path = os.path.join(os.path.expanduser('~'), 'Library/Logs')
log = os.path.join(log_path, 'xbmc.log')
logfile = open(log, 'r').read()
elif xbmc.getCondVisibility('system.platform.ios'):
log_path = '/var/mobile/Library/Preferences'
log = os.path.join(log_path, 'xbmc.log')
logfile = open(log, 'r').read()
elif xbmc.getCondVisibility('system.platform.windows'):
log_path = xbmc.translatePath('special://home')
log = os.path.join(log_path, 'xbmc.log')
logfile = open(log, 'r').read()
elif xbmc.getCondVisibility('system.platform.linux'):
log_path = xbmc.translatePath('special://home/temp')
log = os.path.join(log_path, 'xbmc.log')
logfile = open(log, 'r').read()
else:
logfile='Starting XBMC (Unknown Git:.+?Platform: Unknown. Built.+?'
print '========================== '+PATH+' '+VERSION+' =========================='
try:
from hashlib import md5
except:
from md5 import md5
from random import randint
import time
from urllib import unquote, quote
from os import environ
from hashlib import sha1
import platform
VISITOR = ADDON.getSetting('visitor_ga')
match=re.compile('Starting XBMC \((.+?) Git:.+?Platform: (.+?)\. Built.+?').findall(logfile)
for build, PLATFORM in match:
if re.search('12.0',build,re.IGNORECASE):
build="Frodo"
if re.search('11.0',build,re.IGNORECASE):
build="Eden"
if re.search('13.0',build,re.IGNORECASE):
build="Gotham"
print build
print PLATFORM
utm_gif_location = "http://www.google-analytics.com/__utm.gif"
utm_track = utm_gif_location + "?" + \
"utmwv=" + VERSION + \
"&utmn=" + str(randint(0, 0x7fffffff)) + \
"&utmt=" + "event" + \
"&utme="+ quote("5(APP LAUNCH*"+build+"*"+PLATFORM+")")+\
"&utmp=" + quote(PATH) + \
"&utmac=" + UATRACK + \
"&utmcc=__utma=%s" % ".".join(["1", VISITOR, VISITOR, VISITOR,VISITOR,"2"])
try:
print "============================ POSTING APP LAUNCH TRACK EVENT ============================"
send_request_to_google_analytics(utm_track)
except:
print "============================ CANNOT POST APP LAUNCH TRACK EVENT ============================"
示例6: onPlayBackStarted
def onPlayBackStarted(self):
xbmc.sleep(1000)
# Set values based on the file content
if (self.isPlayingAudio()):
self.type = "music"
else:
if xbmc.getCondVisibility('VideoPlayer.Content(movies)'):
filename = ''
isMovie = True
try:
filename = self.getPlayingFile()
except:
pass
if filename != '':
for string in self.substrings:
if string in filename:
isMovie = False
break
if isMovie:
self.type = "movie"
elif xbmc.getCondVisibility('VideoPlayer.Content(episodes)'):
# Check for tv show title and season
# to make sure it's really an episode
if xbmc.getInfoLabel('VideoPlayer.Season') != "" and xbmc.getInfoLabel('VideoPlayer.TVShowTitle') != "":
self.type = "episode"
elif xbmc.getCondVisibility('VideoPlayer.Content(musicvideos)'):
self.type = "musicvideo"
示例7: set_linux_engine_setting
def set_linux_engine_setting(url):
if xbmc.getCondVisibility('system.platform.linux') and not xbmc.getCondVisibility('system.platform.Android'):
acestream_settings_file = os.path.join(os.getenv("HOME"),'.ACEStream','playerconf.pickle')
elif xbmc.getCondVisibility('system.platform.Android'):
acestream_settings_file = os.path.join('/sdcard','.ACEStream','playerconf.pickle')
elif xbmc.getCondVisibility('system.platform.windows'):
acestream_settings_file = os.path.join(os.getenv("APPDATA"),".ACEStream","playerconf.pickle")
settings_content = readfile(acestream_settings_file)
keyb = xbmc.Keyboard('',translate(600024))
keyb.doModal()
if (keyb.isConfirmed()):
search = keyb.getText()
try:
int(search)
integer = True
except: integer = False
if integer == True:
if len(url.split('|')) == 3:
settings_content = settings_content.replace('p'+str(eval(url.split('|')[1])[0][0])+'\nI'+str(eval(url.split('|')[1])[0][1]),'p'+str(eval(url.split('|')[1])[0][0])+'\nI'+search)
save(acestream_settings_file, settings_content)
xbmc.executebuiltin("Notification(%s,%s,%i,%s)" % (translate(40000), translate(600026), 1,addonpath+"/icon.png"))
xbmc.executebuiltin("Container.Refresh")
else:
settings_content = settings_content.replace('s.',"sS'"+url.split('|')[0]+"'\np"+url.split('|')[1]+"\nI"+search+"\ns.")
save(acestream_settings_file, settings_content)
xbmc.executebuiltin("Notification(%s,%s,%i,%s)" % (translate(40000), translate(600026), 1,addonpath+"/icon.png"))
xbmc.executebuiltin("Container.Refresh")
if 'total_max_download_rate' in url: settings.setSetting('total_max_download_rate',value=search)
if 'total_max_upload_rate' in url: settings.setSetting('total_max_upload_rate',value=search)
else:
mensagemok(translate(40000),translate(600025))
sys.exit(0)
示例8: run
def run( self ):
try:
while not self._stop: # le code
if not xbmc.getCondVisibility( "Window.IsVisible(10025)"): self.stop() #destroy threading
if xbmc.getCondVisibility( "Container.Content(Seasons)" ) or xbmc.getCondVisibility( "Container.Content(Episodes)" ) and not xbmc.Player().isPlaying() and "plugin://" not in xbmc.getInfoLabel( "ListItem.Path" ) and not xbmc.getInfoLabel( "container.folderpath" ) == "videodb://5/":
self.newpath = xbmc.getInfoLabel( "ListItem.Path" )
if not self.newpath == self.oldpath and not self.newpath == "" and not self.newpath == "videodb://2/2/":
print "### old path: %s" % self.oldpath
print "### new path: %s" % self.newpath
self.oldpath = self.newpath
if not xbmc.Player().isPlaying() : self.start_playing()
else: print "### player already playing"
if xbmc.getInfoLabel( "Window(10025).Property(TvTunesIsAlive)" ) == "true" and not xbmc.Player().isPlaying():
print "### playing ends"
if self.loud: self.raise_volume()
xbmcgui.Window( 10025 ).clearProperty('TvTunesIsAlive')
if xbmc.getCondVisibility( "Container.Content(tvshows)" ) and self.playpath and not xbmc.getCondVisibility( "Window.IsVisible(12003)" ):
print "### reinit condition"
self.newpath = ""
self.oldpath = ""
self.playpath = ""
print "### stop playing"
xbmc.Player().stop()
if self.loud: self.raise_volume()
xbmcgui.Window( 10025 ).clearProperty('TvTunesIsAlive')
time.sleep( .5 )
except:
print_exc()
self.stop()
示例9: run
def run(self):
try:
while not self._stop: # the code
if not xbmc.getCondVisibility("Window.IsVisible(10025)"):
self.stop() # destroy threading
if (
xbmc.getCondVisibility("Container.Content(Seasons)")
or xbmc.getCondVisibility("Container.Content(Episodes)")
and not xbmc.Player().isPlaying()
and "plugin://" not in xbmc.getInfoLabel("ListItem.Path")
and not xbmc.getInfoLabel("container.folderpath") == "videodb://5/"
):
if self.enable_custom_path == "true":
self.newpath = self.custom_path + xbmc.getInfoLabel("ListItem.TVShowTitle")
else:
self.newpath = xbmc.getInfoLabel("ListItem.Path")
if (
not self.newpath == self.oldpath
and not self.newpath == ""
and not self.newpath == "videodb://2/2/"
):
log("### old path: %s" % self.oldpath)
log("### new path: %s" % self.newpath)
self.oldpath = self.newpath
if not xbmc.Player().isPlaying():
self.start_playing()
else:
log("### player already playing")
if (
xbmc.getInfoLabel("Window(10025).Property(TvTunesIsAlive)") == "true"
and not xbmc.Player().isPlaying()
):
log("### playing ends")
if self.loud:
self.raise_volume()
xbmcgui.Window(10025).clearProperty("TvTunesIsAlive")
if (
xbmc.getCondVisibility("Container.Content(tvshows)")
and self.playpath
and not xbmc.getCondVisibility("Window.IsVisible(12003)")
):
log("### reinit condition")
self.newpath = ""
self.oldpath = ""
self.playpath = ""
log("### stop playing")
if __addon__.getSetting("fade") == "true":
self.fade_out()
else:
xbmc.Player().stop()
if self.loud:
self.raise_volume()
xbmcgui.Window(10025).clearProperty("TvTunesIsAlive")
time.sleep(0.5)
except:
print_exc()
self.stop()
示例10: main
def main():
if xbmc.getCondVisibility('Container.Content(tvshows)'):
mediatype = 'tvshow'
elif xbmc.getCondVisibility('Container.Content(movies)'):
mediatype = 'movie'
elif xbmc.getCondVisibility('Container.Content(episodes)'):
mediatype = 'episode'
elif xbmc.getCondVisibility('Container.Content(musicvideos)'):
mediatype = 'musicvideo'
else:
xbmc.executebuiltin('Notification(Select Artwork to Download cannot proceed, "Got an unexpected content type. Try again, it will probably work.", 6000, DefaultIconWarning.png)')
return
infolabel = xbmc.getInfoLabel('ListItem.Label')
truelabel = sys.listitem.getLabel()
mismatch = infolabel != truelabel
if mismatch:
log("InfoLabel does not match selected item: InfoLabel('ListItem.Label'): '%s', sys.listitem '%s'" % (infolabel, truelabel), xbmc.LOGWARNING)
dbid = get_realdbid(sys.listitem)
else:
dbid = xbmc.getInfoLabel('ListItem.DBID')
artworkaddon = xbmcaddon.Addon().getSetting('artwork_addon')
if not xbmc.getCondVisibility('System.HasAddon({0})'.format(artworkaddon)):
xbmcgui.Dialog().ok('Select Artwork to Download', "The add-on {0} is not installed. Please install it or configure this context item to use another add-on.".format(artworkaddon))
return
xbmc.executebuiltin('RunScript({0}, mode=gui, mediatype={1}, dbid={2})'.format(artworkaddon, mediatype, dbid))
示例11: _set_languages
def _set_languages( self, dbid, dbtype ):
try:
if xbmc.getCondVisibility('Container.Content(movies)') or self.type == "movie" or dbtype == "movie":
json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovieDetails", "params": {"properties": ["streamdetails"], "movieid":%s }, "id": 1}' % dbid)
json_query = unicode(json_query, 'utf-8', errors='ignore')
log(json_query)
json_response = simplejson.loads(json_query)
if json_response['result'].has_key('moviedetails'):
self._set_properties(json_response['result']['moviedetails']['streamdetails']['audio'], json_response['result']['moviedetails']['streamdetails']['subtitle'])
elif xbmc.getCondVisibility('Container.Content(episodes)') or self.type == "episode" or dbtype == "episode":
json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetEpisodeDetails", "params": {"properties": ["streamdetails"], "episodeid":%s }, "id": 1}' % dbid)
json_query = unicode(json_query, 'utf-8', errors='ignore')
log(json_query)
json_response = simplejson.loads(json_query)
if json_response['result'].has_key('episodedetails'):
self._set_properties(json_response['result']['episodedetails']['streamdetails']['audio'], json_response['result']['episodedetails']['streamdetails']['subtitle'])
elif xbmc.getCondVisibility('Container.Content(musicvideos)') or self.type == "musicvideo" or dbtype == "musicvideo":
json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetMusicVideoDetails", "params": {"properties": ["streamdetails"], "musicvideoid":%s }, "id": 1}' % dbid)
json_query = unicode(json_query, 'utf-8', errors='ignore')
log(json_query)
json_response = simplejson.loads(json_query)
if json_response['result'].has_key('musicvideodetails'):
self._set_properties(json_response['result']['musicvideodetails']['streamdetails']['audio'], json_response['result']['musicvideodetails']['streamdetails']['subtitle'])
except:
pass
示例12: stop_any_sop_traces
def stop_any_sop_traces(pid=None):
if not xbmc.getCondVisibility('system.platform.windows'):
try: os.kill(pid,9)
except: pass
xbmc.sleep(100)
try:os.system("killall -9 "+SPSC_BINARY)
except:pass
xbmc.sleep(100)
try:spsc.kill()
except:pass
xbmc.sleep(100)
try:spsc.wait()
except:pass
if xbmc.getCondVisibility('system.platform.OSX'):
try:xbmcvfs.delete(os.path.join(pastaperfil,'sopcast.avi'))
except:pass
else:
cmd = ['sc','stop','sopcastp2p']
import subprocess
proc = subprocess.Popen(cmd,stdout=subprocess.PIPE,shell=True)
servicecreator = False
for line in proc.stdout:
print("result line" + line.rstrip())
#dirty hack to break sopcast.exe player codec - renaming the file now!
break_sopcast()
return
示例13: _get_query
def _get_query(dbtype, dbid):
if not dbtype:
if xbmc.getCondVisibility("VideoPlayer.Content(movies)"):
dbtype = 'movie'
elif xbmc.getCondVisibility("VideoPlayer.Content(episodes)"):
dbtype = 'episode'
elif xbmc.getCondVisibility("VideoPlayer.Content(musicvideos)"):
dbtype = 'musicvideo'
if dbtype == "movie":
method = '"VideoLibrary.GetMovieDetails"'
param = '"movieid"'
elif dbtype == "tvshow":
method = '"VideoLibrary.GetTVShowDetails"'
param = '"tvshowid"'
elif dbtype == "episode":
method = '"VideoLibrary.GetEpisodeDetails"'
param = '"episodeid"'
elif dbtype == "musicvideo":
method = '"VideoLibrary.GetMusicVideoDetails"'
param = '"musicvideoid"'
elif dbtype == "song":
method = '"AudioLibrary.GetSongDetails"'
param = '"songid"'
json_query = xbmc.executeJSONRPC('''{ "jsonrpc": "2.0", "method": %s,
"params": {%s: %d,
"properties": ["title", "file", "cast"]},
"id": 1 }''' % (method, param, int(dbid)))
return json_query
示例14: cacheAllExtras
def cacheAllExtras(self):
if not (xbmc.abortRequested or xbmc.getCondVisibility("Window.IsVisible(shutdownmenu)")):
self.createExtrasCache('GetMovies', Settings.MOVIES, 'movieid')
if not (xbmc.abortRequested or xbmc.getCondVisibility("Window.IsVisible(shutdownmenu)")):
self.createExtrasCache('GetTVShows', Settings.TVSHOWS, 'tvshowid')
if not (xbmc.abortRequested or xbmc.getCondVisibility("Window.IsVisible(shutdownmenu)")):
self.createExtrasCache('GetMusicVideos', Settings.MUSICVIDEOS, 'musicvideoid')
示例15: main
def main():
if xbmc.getCondVisibility("Container.Content(movies)"):
xbmc.executebuiltin("RunScript(script.extendedinfo,info=ratemedia,type=movie,dbid=%s,id=%s)" % (xbmc.getInfoLabel("ListItem.DBID"), xbmc.getInfoLabel("ListItem.Property(id)")))
elif xbmc.getCondVisibility("Container.Content(tvshows)"):
xbmc.executebuiltin("RunScript(script.extendedinfo,info=ratemedia,type=tv,dbid=%s,id=%s)" % (xbmc.getInfoLabel("ListItem.DBID"), xbmc.getInfoLabel("ListItem.Property(id)")))
elif xbmc.getCondVisibility("Container.Content(episodes)"):
xbmc.executebuiltin("RunScript(script.extendedinfo,info=ratemedia,type=episode,tvshow=%s,season=%s)" % (xbmc.getInfoLabel("ListItem.TVShowTitle"), xbmc.getInfoLabel("ListItem.Season")))