本文整理汇总了Python中xbmcplugin.getSetting函数的典型用法代码示例。如果您正苦于以下问题:Python getSetting函数的具体用法?Python getSetting怎么用?Python getSetting使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getSetting函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_sb_url
def get_sb_url():
prot = xbmcplugin.getSetting(handle, "prot")
if(prot == "0"):
sbUrl = "http://"
elif(prot == "1"):
sbUrl = "https://"
host = xbmcplugin.getSetting(handle, "host")
sbUrl += host
port = xbmcplugin.getSetting(handle, "port")
sbUrl += ":" + port
web_root = xbmcplugin.getSetting(handle, "web_root")
if (web_root!="/"):
sbUrl += web_root
sbUrl += "/api/"
guid = xbmcplugin.getSetting(handle, "guid")
sbUrl += guid + "/"
return sbUrl
示例2: __init__
def __init__( self ) :
#
# Constants
#
self.DEBUG = False
#
# Parse parameters...
#
params = dict(part.split('=') for part in sys.argv[ 2 ][ 1: ].split('&'))
self.video_page_url = urllib.unquote_plus( params[ "video_page_url" ] )
#
# Settings
#
self.video_players = { "0" : xbmc.PLAYER_CORE_AUTO,
"1" : xbmc.PLAYER_CORE_DVDPLAYER,
"2" : xbmc.PLAYER_CORE_MPLAYER }
self.video_player = xbmcplugin.getSetting ("video_player")
self.english = xbmc.Language (os.getcwd(), "English")
self.video_format = xbmcplugin.getSetting ("video_format")
self.pref_video_format = (self.english.getLocalizedString(30301),
self.english.getLocalizedString(30302),
self.english.getLocalizedString(30303)) [int(self.video_format)]
#
# Play video...
#
self.playVideo()
示例3: getHTML
def getHTML(url, enableproxy=False):
try:
if enableproxy == True:
us_proxy = (
"http://"
+ xbmcplugin.getSetting(pluginhandle, "us_proxy")
+ ":"
+ xbmcplugin.getSetting(pluginhandle, "us_proxy_port")
)
print "Using proxy: " + us_proxy
proxy_handler = urllib2.ProxyHandler({"http": us_proxy})
opener = urllib2.build_opener(proxy_handler)
urllib2.install_opener(opener)
print "CBS --> common :: getHTML :: url = " + url
req = urllib2.Request(url)
req.add_header(
"User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3"
)
response = urllib2.urlopen(req)
link = response.read()
response.close()
except urllib2.URLError, e:
print "Error reason: ", e.reason
return False
示例4: _get_user
def _get_user( self ):
try:
self.user_id = ""
self.user_nsid = ""
# if this is first run open settings and authorize
self._run_once()
# get the users id and token
userid = xbmcplugin.getSetting( "user_id" )
self.authtoken = xbmcplugin.getSetting( "authtoken" )
# if user did not edit settings, return
if ( userid == "" ): return True
# flickr client
client = FlickrClient( True )
# find the user Id of the person
if ( "@" in userid ):
user = client.flickr_people_findByEmail( find_email=userid )
else:
user = client.flickr_people_findByUsername( username=userid )
# if user id is valid and no error occurred return True
ok = user[ "stat" ] != "fail"
# if successful, set our user id and nsid
if ( ok ):
self.user_id = user[ "user" ][ "id" ]
self.user_nsid = user[ "user" ][ "nsid" ]
except:
# oops print error message
print "ERROR: %s::%s (%d) - %s" % ( self.__class__.__name__, sys.exc_info()[ 2 ].tb_frame.f_code.co_name, sys.exc_info()[ 2 ].tb_lineno, sys.exc_info()[ 1 ], )
ok = False
# if an error or an invalid id was entered, notify the user
if ( not ok ):
xbmcgui.Dialog().ok( xbmc.getLocalizedString( 30900 ), xbmc.getLocalizedString( 30901 ), xbmc.getLocalizedString( 30902 ) )
return ok
示例5: LIBRARY_LIST_TV
def LIBRARY_LIST_TV():
url = common.args.url
data = common.getURL(url,useCookie=True)
scripts = re.compile(r'<script.*?script>',re.DOTALL)
data = scripts.sub('', data)
style = re.compile(r'<style.*?style>',re.DOTALL)
data = style.sub('', data)
tree = BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES)
videos = tree.findAll('div',attrs={'class':'lib-item','asin':True})
totalItems = len(videos)
for video in videos:
xbmcplugin.setContent(int(sys.argv[1]), 'tvshows')
asin = video['asin']
name = video.find('',attrs={'class':'title'}).a.string
thumb = video.find('img')['src'].replace('._SS160_','')
if '[HD]' in name: isHD = True
else: isHD = False
url = common.BASE_URL+video.find('div',attrs={'class':'title'}).a['href']
#if xbmcplugin.getSetting(pluginhandle,'enablelibrarymeta') == 'true':
# asin2,season,episodes,plot,creator,runtime,year,network,actors,genres,stars,votes,HD,TVDBbanner,TVDBposter,TVDBfanart = getShowInfo(url,asin,isHD)
# actors = actors.split(',')
# infoLabels={'Title': name,'Plot':plot,'year':year,'rating':stars,'votes':votes,
# 'Genre':genres,'Season':season,'episode':episodes,'studio':network,
# 'duration':runtime,'cast':actors,'TVShowTitle':name,'credits':creator}
# if year <> 0: infoLabels['premiered'] = str(year)
#else:
infoLabels = { 'Title':name}
common.addDir(name,'library','LIBRARY_EPISODES',url,thumb,thumb,infoLabels,totalItems)
viewenable=xbmcplugin.getSetting(pluginhandle,"viewenable")
if viewenable == 'true':
view=int(xbmcplugin.getSetting(pluginhandle,"showview"))
xbmc.executebuiltin("Container.SetViewMode("+str(confluence_views[view])+")")
xbmcplugin.endOfDirectory(pluginhandle)
示例6: openSettings
def openSettings( self ):
# is this the first time plugin was run and user has not set email
if ( not sys.argv[ 2 ] and xbmcplugin.getSetting( "username" ) == "" and xbmcplugin.getSetting( "runonce" ) == "" ):
# set runonce
xbmcplugin.setSetting( "runonce", "1" )
# sleep for xbox so dialogs don't clash. (TODO: report this as a bug?)
if ( os.environ.get( "OS", "n/a" ) == "xbox" ):
示例7: _get_settings
def _get_settings( self ):
self.settings = {}
self.settings[ "download_mode" ] = int( xbmcplugin.getSetting( "download_mode" ) )
self.settings[ "download_path" ] = xbmcplugin.getSetting( "download_path" )
self.settings[ "use_title" ] = ( xbmcplugin.getSetting( "use_title" ) == "true" )
self.settings[ "username" ] = xbmcplugin.getSetting( "username" )
self.settings[ "password" ] = xbmcplugin.getSetting( "password" )
示例8: load_page
def load_page(url, proxy=False, getRedirect=False):
print url
if proxy == True:
proxy = False
proxy_address = xbmcplugin.getSetting(thisPlugin,'proxy_address')
proxy_port = xbmcplugin.getSetting(thisPlugin,'proxy_port')
if len(proxy_address):
proxy = True
us_proxy = "http://"+proxy_address+":"+proxy_port
print 'Using proxy: ' + us_proxy
proxy_handler = urllib2.ProxyHandler({'http':us_proxy})
opener = urllib2.build_opener(proxy_handler, RTMPHandler)
if not proxy:
opener = urllib2.build_opener(RTMPHandler)
urllib2.install_opener(opener)
req = urllib2.Request(url)
req.add_header('Accept-encoding', 'gzip')
response = urllib2.urlopen(req)
if getRedirect:
return response.geturl()
if response.info().get('Content-Encoding') == 'gzip':
buf = StringIO( response.read())
f = gzip.GzipFile(fileobj=buf)
link = f.read()
else:
link = response.read()
response.close()
return link
示例9: http_request_with_login
def http_request_with_login(url):
username = xbmcplugin.getSetting(int(sys.argv[1]), 'username')
password = xbmcplugin.getSetting(int(sys.argv[1]), 'password')
ADDON_USERDATA_FOLDER = xbmc.translatePath(ADDON.getAddonInfo('profile'))
COOKIE_FILE = os.path.join(ADDON_USERDATA_FOLDER, 'cookies')
return HTTPInterface.http_get(url, COOKIE_FILE,username, password)
示例10: _checkSettings
def _checkSettings():
# check mandatory settings are set
self.email = xbmcplugin.getSetting( "user_email" )
self.password = xbmcplugin.getSetting( "user_password" )
ok = bool( self.email and self.password )
log(" _checkSettings() ok=%s" % ok)
return ok
示例11: __init__
def __init__( self ):
self._parse_argv() # parse sys.argv
if not self.loadSettings():
return
if ( not sys.argv[ 2 ] ):
# cleanup for new start
deleteFile(self.TAGS_FILENAME)
deleteFile(self.SUBS_FILENAME)
files = os.listdir(TEMP_DIR)
for f in files:
if f.startswith(__plugin__+"_items_"):
deleteFile(os.path.join(TEMP_DIR, f))
self.client = grc.GoogleReaderClient()
if not self.authenticate(): # authenticate user
return
ok = self.get_categories( )
else:
# not first run
# load saved google authkey
SID = xbmcplugin.getSetting( "authkey" )
log("loaded SID=%s" % SID)
# create client with known key
self.client = grc.GoogleReaderClient(SID, \
pagesize=xbmcplugin.getSetting( "pagesize" ), \
show_read=bool(xbmcplugin.getSetting( "show_read" ) == "true"))
exec "ok = self.%s()" % ( self.args.category, )
xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=ok)
示例12: createDate
def createDate(): ##core module
archiveMonth = xbmcplugin.getSetting('archiveMonth')
archiveDay = xbmcplugin.getSetting('archiveDay')
archiveYear = xbmcplugin.getSetting('archiveYear')
archiveMonth = str(int(archiveMonth)+1)
archiveDay = str(int(archiveDay)+1)
if len(archiveMonth) == 1:
archiveMonth = '0' + str(archiveMonth)
elif len(archiveMonth) == 2:
archiveMonth = archiveMonth
if len(archiveDay) == 1:
archiveDay = '0' + str(archiveDay)
elif len(archiveMonth) == 2:
archiveDay = str(archiveDay)
if archiveYear == int('0') or '0':
archiveYear = '2009'
elif archiveYear == int('1') or '1':
archiveYear = '2010'
archiveDate = '/' + archiveMonth + '-' + archiveDay + '-' + archiveYear + '/'
return archiveDate
示例13: getPage
def getPage(url, showMessage = True, cookies = False):
global cookieJar
if(showMessage):
handle = int(sys.argv[1])
username=xbmcplugin.getSetting(handle, 'username')
password=xbmcplugin.getSetting(handle, 'password')
logged = login(username, password)
if logged is not None:
url = url+login
try:
req = urllib2.Request(url)
req.add_header('User-Agent', 'Mozilla/5.0 (Windows NT 6.3; WOW64; rv:36.0) Gecko/20100101 Firefox/36.0')
if(cookies == True):
req.add_header('Cookie', cookieJar)
response = urllib2.urlopen(req)
if(cookies == True):
cookieJar = response.info().getheader('Set-Cookie')
if response.info().get('Content-Encoding') == 'gzip':
buf = StringIO( response.read())
f = gzip.GzipFile(fileobj=buf)
data = f.read()
else:
data = response.read()
response.close()
return data
except urllib2.URLError, e:
if showMessage:
line1 = "Fehler!"
line2 = "bs.to nicht erreichbar"
xbmcgui.Dialog().ok(line1, line2)
sys.exit()
return ""
示例14: gethighurl
def gethighurl(code):
xbmc.output("[megavideo.py] Usa modo premium")
code = getcode(code)
megavideocookie = xbmcplugin.getSetting("megavideocookie")
xbmc.output("[megavideo.py] megavideocookie=#"+megavideocookie+"#")
#if megavideocookie=="":
xbmc.output("[megavideo.py] Averiguando cookie...")
megavideologin = xbmcplugin.getSetting("megavideouser")
xbmc.output("[megavideo.py] megavideouser=#"+megavideologin+"#")
megavideopassword = xbmcplugin.getSetting("megavideopassword")
xbmc.output("[megavideo.py] megavideopassword=#"+megavideopassword+"#")
megavideocookie = GetMegavideoUser(megavideologin, megavideopassword)
xbmc.output("[megavideo.py] megavideocookie=#"+megavideocookie+"#")
#xbmcplugin.setSetting("megavideocookie",megavideocookie)
req = urllib2.Request("http://www.megavideo.com/xml/player_login.php?u="+megavideocookie+"&v="+code)
req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
response = urllib2.urlopen(req)
data=response.read()
response.close()
# saca los enlaces
patronvideos = 'downloadurl="([^"]+)"'
matches = re.compile(patronvideos,re.DOTALL).findall(data)
movielink = matches[0]
movielink = movielink.replace("%3A",":")
movielink = movielink.replace("%2F","/")
movielink = movielink.replace("%20"," ")
return movielink
示例15: SITE
def SITE(dur):
if xbmcplugin.getSetting("site : GOOGLE") == "true":
site="+site%3Avideo.google.com"
GOOGLESEARCH(dur,site)
elif xbmcplugin.getSetting("site : YOUTUBE") == "true":
site="+site%3Ayoutube.com"
GOOGLESEARCH(dur,site)
elif xbmcplugin.getSetting("site : GUBA") == "true":
site="+site%3Aguba.com"
GOOGLESEARCH(dur,site)
elif xbmcplugin.getSetting("site : YOUKU") == "true":
site="+site%3Ayouku.com"
GOOGLESEARCH(dur,site)
elif xbmcplugin.getSetting("site : TUDOU") == "true":
site="+site%3Atudou.com"
GOOGLESEARCH(dur,site)
elif xbmcplugin.getSetting("site : VEOH") == "true":
site="+site%3Aveoh.com"
GOOGLESEARCH(dur,site)
elif xbmcplugin.getSetting("site : MYSPACE") == "true":
site="+site%3Amyspace.com"
GOOGLESEARCH(dur,site)
elif xbmcplugin.getSetting("site : DAILYMOTION") == "true":
site="+site%3Adailymotion.com"
GOOGLESEARCH(dur,site)
elif xbmcplugin.getSetting("site : TRILULILU") == "true":
site="+site%3Atrilulilu.ro"
GOOGLESEARCH(dur,site)
elif xbmcplugin.getSetting("site : CLIPVN") == "true":
site="+site%3Aclip.vn"
GOOGLESEARCH(dur,site)
else:
site=""
GOOGLESEARCH(dur,site)