本文整理汇总了Python中xbmcplugin.getSetting函数的典型用法代码示例。如果您正苦于以下问题:Python getSetting函数的具体用法?Python getSetting怎么用?Python getSetting使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getSetting函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
开发者ID:h4wkmoon,项目名称:SBView,代码行数:25,代码来源:default.py
示例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()
开发者ID:abellujan,项目名称:xbmc4xbox-addons,代码行数:31,代码来源:ms_channel9_play.py
示例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
开发者ID:nmatthews,项目名称:BlueCop-XBMC-Plugins,代码行数:25,代码来源:common.py
示例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
开发者ID:nuka1195,项目名称:plugin.image.flickr,代码行数:32,代码来源:categories.py
示例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)
开发者ID:devicenull,项目名称:XBMC-Amazon.com-Prime-Streaming,代码行数:33,代码来源:library.py
示例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" ):
开发者ID:nuka1195,项目名称:plugin.video.youtube,代码行数:7,代码来源:categories.py
示例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" )
开发者ID:drrlramsey,项目名称:xbmc-addons,代码行数:7,代码来源:xbmcplugin_download.py
示例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
开发者ID:dethfeet,项目名称:plugin.video.kidsplace,代码行数:34,代码来源:helper.py
示例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)
开发者ID:kevintone,项目名称:tdbaddon,代码行数:7,代码来源:default.py
示例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
开发者ID:drrlramsey,项目名称:xbmc-addons,代码行数:7,代码来源:xbmcplugin_categories.py
示例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)
开发者ID:drrlramsey,项目名称:xbmc-addons,代码行数:31,代码来源:xbmcplugin_categories.py
示例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
开发者ID:BGCX067,项目名称:f3ar007-svn-to-git,代码行数:25,代码来源:default.py
示例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 ""
开发者ID:Grabber66,项目名称:Repo,代码行数:34,代码来源:site.py
示例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
开发者ID:hmemar,项目名称:xbmc-tvalacarta,代码行数:32,代码来源:megavideo.py
示例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)
开发者ID:drrlramsey,项目名称:xbmc-addons,代码行数:35,代码来源:default.py
示例16: playRTMP
def playRTMP():
vid=re.compile('id=(\d+)').findall(common.args.url)[0]
smilurl = getsmil(vid)
rtmpurl = str(getrtmp())
swfUrl = getswfUrl()
link = str(common.getHTML(smilurl))
match=re.compile('<video src="(.+?)"').findall(link)
if (common.settings['quality'] == '0'):
dia = xbmcgui.Dialog()
ret = dia.select(xbmc.getLocalizedString(30004), [xbmc.getLocalizedString(30016),xbmc.getLocalizedString(30017),xbmc.getLocalizedString(30018)])
if (ret == 2):
return
else:
ret = None
for playpath in match:
playpath = playpath.replace('.flv','')
if '_0700' in playpath and (xbmcplugin.getSetting(pluginhandle,"quality") == '1' or '_0700' in playpath and (ret == 0)):
item=xbmcgui.ListItem(common.args.name, iconImage='', thumbnailImage='')
item.setInfo( type="Video",infoLabels={ "Title": common.args.name})
item.setProperty("SWFPlayer", swfUrl)
item.setProperty("PlayPath", playpath)
elif '_0500' in playpath and (xbmcplugin.getSetting(pluginhandle,"quality") == '2') or '_0500' in playpath and (ret == 1):
item=xbmcgui.ListItem(common.args.name, iconImage='', thumbnailImage='')
item.setInfo( type="Video",infoLabels={ "Title": common.args.name})
item.setProperty("SWFPlayer", swfUrl)
item.setProperty("PlayPath", playpath)
xbmc.Player(xbmc.PLAYER_CORE_DVDPLAYER).play(rtmpurl, item)
开发者ID:AbsMate,项目名称:bluecop-xbmc-repo,代码行数:30,代码来源:scifi_tv.py
示例17: _fill_media_list
def _fill_media_list( self, categories ):
try:
ok = True
# enumerate through the list of categories and add the item to the media list
for ( ltitle, method, userid_required, pq, gq, uq, issearch, thumbnail, authtoken_required, ) in categories:
# if a user id is required for category and none supplied, skip category
if ( userid_required and self.user_id == "" ): continue
if ( authtoken_required and self.authtoken == "" ): continue
# set the callback url with all parameters
url = '%s?title=%s&category=%s&userid=%s&usernsid=%s&photosetid=""&photoid=""&groupid=""&primary=""&secret=""&server=""&photos=0&page=1&prevpage=0&pq=%s&gq=%s&uq=%s&issearch=%d&update_listing=%d&' % ( sys.argv[ 0 ], quote_plus( repr( ltitle ) ), repr( method ), repr( self.user_id ), repr( self.user_nsid ), quote_plus( repr( pq ) ), quote_plus( repr( gq ) ), quote_plus( repr( uq ) ), issearch, False, )
# check for a valid custom thumbnail for the current method
thumbnail = thumbnail or self._get_thumbnail( method )
# set the default icon
icon = "DefaultFolder.png"
# only need to add label, icon and thumbnail, setInfo() and addSortMethod() takes care of label2
listitem=xbmcgui.ListItem( ltitle, iconImage=icon, thumbnailImage=thumbnail )
# add the item to the media list
ok = xbmcplugin.addDirectoryItem( handle=int( sys.argv[ 1 ] ), url=url, listitem=listitem, isFolder=True, totalItems=len( categories ) )
# if user cancels, call raise to exit loop
if ( not ok ): raise
# we do not want to sort queries list
if ( "category='presets_photos'" in sys.argv[ 2 ] or "category='presets_groups'" in sys.argv[ 2 ] or "category='presets_users'" in sys.argv[ 2 ] ):
xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_NONE )
# set our plugin category
xbmcplugin.setPluginCategory( handle=int( sys.argv[ 1 ] ), category=self.args.title )
# set our fanart from user setting
if ( xbmcplugin.getSetting( "fanart_image" ) ):
xbmcplugin.setPluginFanart( handle=int( sys.argv[ 1 ] ), image=xbmcplugin.getSetting( "fanart_image" ) )
except:
# user cancelled dialog or an error occurred
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
return ok
开发者ID:nuka1195,项目名称:plugin.image.flickr,代码行数:33,代码来源:categories.py
示例18: SEARCH
def SEARCH(dur):
keyb = xbmc.Keyboard('', 'Search Veoh')
keyb.doModal()
if (keyb.isConfirmed()):
search = keyb.getText()
encode=urllib.quote_plus(search)
if xbmcplugin.getSetting("Open Veoh Search") == "true":
url='http://www.veoh.com/rest/v2/execute.xml?method=veoh.search.video&userQuery='+encode+'&contentSource=veoh'+dur+'&safe=false&maxResults=100&apiKey=08344E97-13CE-E0BE-28AA-B8F7D686DD07'
f = open(os.getcwd().replace(";","")+'/search.veoh', 'a');f.write('<URL>'+url+'</URL><NAME>'+search+'</NAME>');f.close()
elif xbmcplugin.getSetting("Specific Veoh Search") == "true":
url='http://www.veoh.com/rest/v2/execute.xml?method=veoh.search.video&userQuery="'+encode+'"&contentSource=veoh'+dur+'&safe=false&maxResults=100&apiKey=08344E97-13CE-E0BE-28AA-B8F7D686DD07'
f = open(os.getcwd().replace(";","")+'/search.veoh', 'a');f.write('<URL>'+url+'</URL><NAME>'+search+'</NAME>');f.close()
else:
url='http://www.veoh.com/rest/v2/execute.xml?method=veoh.search.video&userQuery="'+encode+'"&contentSource=veoh'+dur+'&safe=false&maxResults=100&apiKey=08344E97-13CE-E0BE-28AA-B8F7D686DD07'
req = urllib2.Request(url)
req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14')
response = urllib2.urlopen(req)
link=response.read()
response.close()
lastresult=re.compile('items="(.+?)"').findall(link);last=int(lastresult[0])
perma=re.compile('permalinkId="(.+?)"').findall(link)
length=re.compile('length="(.+?)"').findall(link)
purl=re.compile('fullPreviewHashPath="(.+?)"').findall(link)
thumbnail=re.compile('fullHighResImagePath="(.+?)"').findall(link)
name=re.compile('\r\n\ttitle="(.+?)"\r\n\tdateAdded=".+?"').findall(link)
ipod=re.compile('ipodUrl="(.+?)"').findall(link)
for i in range(0,len(perma)):
addLink('%s Dur: %s '%(name[i],length[i]),purl[i],thumbnail[i])
addDir('%s - FULL MP4'%name[i],ipod[i],4,'')
if last>100: addDir(" NEXT PAGE",'http://www.veoh.com/rest/v2/execute.xml?method=veoh.search.video&userQuery="'+encode+'"&contentSource=veoh'+dur+'&offset=100&safe=false&maxResults=100&apiKey=08344E97-13CE-E0BE-28AA-B8F7D686DD07',3,"")
else: pass
开发者ID:drrlramsey,项目名称:xbmc-addons,代码行数:31,代码来源:default.py
示例19: __init__
def __init__( self ):
computers = int ( xbmcplugin.getSetting("computers") ) + 1
#
# List computers...
#
for i in range(computers) :
computer_name = xbmcplugin.getSetting("comp_%u_name" % ( i + 1 ))
computer_mac = xbmcplugin.getSetting("comp_%u_mac" % ( i + 1 ))
listitem = xbmcgui.ListItem( xbmc.getLocalizedString(30901) % computer_name, iconImage="DefaultProgram.png" )
xbmcplugin.addDirectoryItem( handle = int(sys.argv[ 1] ),
url = sys.argv[ 0 ] + '?action=wake&name=%s&mac=%s' % ( computer_name, computer_mac ),
listitem=listitem,
isFolder=False)
#
# Disable sorting...
#
xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_NONE )
#
# End of list...
#
xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=True )
开发者ID:abellujan,项目名称:xbmc4xbox-addons,代码行数:25,代码来源:xbmcplugin_main.py
示例20: download_button
def download_button(url,name):
print url
req = urllib2.Request(url)
req.add_header('User-Agent', HEADER)
f=urllib2.urlopen(req)
a=f.read()
f.close()
p=re.compile('<param name="movie" value="http://www.traileraddict.com/emb/(.+?)">')
info=p.findall(a)
url='http://www.traileraddict.com/fvar.php?tid='+info[0]
#print url
req = urllib2.Request(url)
req.add_header('User-Agent', HEADER)
f=urllib2.urlopen(req)
a=f.read()
f.close()
p=re.compile('fileurl=(.+?)&vidwidth')
info=p.findall(a)
z=re.compile('&image=(.+?)').findall(a)
url=info[0]
thumb=z[0]
#print thumb
#print url
title=name
name=clean_file(name)
name=name[:+32]
if (xbmcplugin.getSetting('ask_filename') == 'true'):
searchStr = name
keyboard = xbmc.Keyboard(searchStr, "Save as:")
keyboard.doModal()
if (keyboard.isConfirmed() == False):
return
searchstring = keyboard.getText()
name=searchstring
def Download(url,dest):
dp = xbmcgui.DialogProgress()
dp.create('Downloading',title,'Filename: '+name+ '.flv')
urllib.urlretrieve(url,dest,lambda nb, bs, fs, url=url: _pbhook(nb,bs,fs,url,dp))
def _pbhook(numblocks, blocksize, filesize, url=None,dp=None):
try:
percent = min((numblocks*blocksize*100)/filesize, 100)
dp.update(percent)
except:
percent = 100
dp.update(percent)
if dp.iscanceled():
dp.close()
flv_file = xbmc.translatePath(os.path.join(xbmcplugin.getSetting('download_Path'), name + '.flv' ))
Download(url,flv_file)
if xbmcplugin.getSetting("dvdplayer") == "true":
player_type = xbmc.PLAYER_CORE_DVDPLAYER
else:
player_type = xbmc.PLAYER_CORE_MPLAYER
g_thumbnail = xbmc.getInfoImage( "ListItem.Thumb" )
listitem=xbmcgui.ListItem(title ,iconImage="DefaultVideo.png", thumbnailImage=g_thumbnail)
if (os.path.isfile(flv_file)):
dia = xbmcgui.Dialog()
if dia.yesno('Download Complete', 'Do you want to play this video?'):
xbmc.Player(player_type).play(flv_file, listitem)
开发者ID:drrlramsey,项目名称:xbmc-addons,代码行数:59,代码来源:default.py
注:本文中的xbmcplugin.getSetting函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论