本文整理汇总了Python中DownloadUtils.DownloadUtils.imageUrl方法的典型用法代码示例。如果您正苦于以下问题:Python DownloadUtils.imageUrl方法的具体用法?Python DownloadUtils.imageUrl怎么用?Python DownloadUtils.imageUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DownloadUtils.DownloadUtils
的用法示例。
在下文中一共展示了DownloadUtils.imageUrl方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: onInit
# 需要导入模块: from DownloadUtils import DownloadUtils [as 别名]
# 或者: from DownloadUtils.DownloadUtils import imageUrl [as 别名]
#.........这里部分代码省略.........
audioInfo = audiocodec + " " + str(channels)
if(lang != None and len(lang) > 0 and lang != "und"):
audioInfo = audioInfo + " " + lang
listItem = xbmcgui.ListItem("Audio:", audioInfo)
mediaList.addItem(listItem)
if(mediaStream.get("Type") == "Subtitle"):
lang = mediaStream.get("Language")
codec = mediaStream.get("Codec")
subInfo = codec
if(lang != None and len(lang) > 0 and lang != "und"):
subInfo = subInfo + " " + lang
listItem = xbmcgui.ListItem("Sub:", subInfo)
mediaList.addItem(listItem)
#for x in range(0, 10):
# listItem = xbmcgui.ListItem("Test:", "Test 02 " + str(x))
# mediaList.addItem(listItem)
# add overview
overview = item.get("Overview")
self.getControl(3223).setText(overview)
# add people
peopleList = self.getControl(3230)
people = item.get("People")
for person in people:
displayName = person.get("Name")
role = person.get("Role")
id = person.get("Id")
tag = person.get("PrimaryImageTag")
baseName = person.get("Name")
baseName = baseName.replace(" ", "+")
baseName = baseName.replace("&", "_")
baseName = baseName.replace("?", "_")
baseName = baseName.replace("=", "_")
actionUrl = "plugin://plugin.video.xbmb3c?mode=" + str(_MODE_PERSON_DETAILS) +"&name=" + baseName
if(tag != None and len(tag) > 0):
thumbPath = downloadUtils.imageUrl(id, "Primary", 0, 400, 400)
listItem = xbmcgui.ListItem(label=displayName, label2=role, iconImage=thumbPath, thumbnailImage=thumbPath)
else:
listItem = xbmcgui.ListItem(label=displayName, label2=role)
listItem.setProperty("ActionUrl", actionUrl)
peopleList.addItem(listItem)
# add general info
infoList = self.getControl(3226)
listItem = xbmcgui.ListItem("Year:", str(item.get("ProductionYear")))
infoList.addItem(listItem)
listItem = xbmcgui.ListItem("Rating:", str(item.get("CommunityRating")))
infoList.addItem(listItem)
listItem = xbmcgui.ListItem("MPAA:", str(item.get("OfficialRating")))
infoList.addItem(listItem)
duration = str(int(item.get("RunTimeTicks", "0"))/(10000000*60))
listItem = xbmcgui.ListItem("RunTime:", str(duration) + " Minutes")
infoList.addItem(listItem)
genre = ""
genres = item.get("Genres")
if(genres != None):
for genre_string in genres:
if genre == "": #Just take the first genre
genre = genre_string
else:
genre = genre + " / " + genre_string
listItem = xbmcgui.ListItem("Genre:", genre)
infoList.addItem(listItem)
path = item.get('Path')
listItem = xbmcgui.ListItem("Path:", path)
infoList.addItem(listItem)
# add resume percentage text to name
addResumePercent = __settings__.getSetting('addResumePercent') == 'true'
if (addResumePercent and cappedPercentage != None):
name = name + " (" + str(cappedPercentage) + "%)"
self.getControl(3000).setLabel(name)
self.getControl(3003).setLabel(episodeInfo)
self.getControl(3001).setImage(fanArt)
if(type == "Episode"):
self.getControl(3009).setImage(image)
if(cappedPercentage != None):
self.getControl(3010).setImage("Progress\progress_" + str(cappedPercentage) + ".png")
else:
self.getControl(3011).setImage(image)
if(cappedPercentage != None):
self.getControl(3012).setImage("Progress\progress_" + str(cappedPercentage) + ".png")
# disable play button
if(type == "Season" or type == "Series"):
self.setFocusId(3226)
self.getControl(3002).setEnabled(False)
示例2: onInit
# 需要导入模块: from DownloadUtils import DownloadUtils [as 别名]
# 或者: from DownloadUtils.DownloadUtils import imageUrl [as 别名]
def onInit(self):
self.action_exitkeys_id = [10, 13]
downloadUtils = DownloadUtils()
url = "{server}/mediabrowser/Persons/" + self.personName + "?format=json"
jsonData = downloadUtils.downloadUrl(url )
result = jsonData
name = result.get("Name")
id = result.get("Id")
# other lib items count
contentCounts = ""
if(result.get("AdultVideoCount") != None and result.get("AdultVideoCount") > 0):
contentCounts = contentCounts + "\nAdult Count : " + str(result.get("AdultVideoCount"))
if(result.get("MovieCount") != None and result.get("MovieCount") > 0):
contentCounts = contentCounts + "\nMovie Count : " + str(result.get("MovieCount"))
if(result.get("SeriesCount") != None and result.get("SeriesCount") > 0):
contentCounts = contentCounts + "\nSeries Count : " + str(result.get("SeriesCount"))
if(result.get("EpisodeCount") != None and result.get("EpisodeCount") > 0):
contentCounts = contentCounts + "\nEpisode Count : " + str(result.get("EpisodeCount"))
if(len(contentCounts) > 0):
contentCounts = "Total Library Counts:" + contentCounts
#overview
overview = ""
if(len(contentCounts) > 0):
overview = contentCounts + "\n\n"
over = result.get("Overview")
if(over == None or over == ""):
overview = overview + "No details available"
else:
overview = overview + over
#person image
image = API().getArtwork(result, "Primary")
#get other movies
encoded = name.encode("utf-8")
encoded = urllib.quote(encoded)
url = "{server}/mediabrowser/Users/{UserId}/Items/?Recursive=True&Person=" + encoded + "&format=json"
jsonData = downloadUtils.downloadUrl(url)
otherMovieResult = jsonData
baseName = name.replace(" ", "+")
baseName = baseName.replace("&", "_")
baseName = baseName.replace("?", "_")
baseName = baseName.replace("=", "_")
#detailsString = getDetailsString()
#search_url = "http://" + host + ":" + port + "/mediabrowser/Users/" + userid + "/Items/?Recursive=True&Person=PERSON_NAME&Fields=" + detailsString + "&format=json"
#search_url = "http://" + host + ":" + port + "/mediabrowser/Users/" + userid + "/Items/?Recursive=True&Person=PERSON_NAME&format=json"
#search_url = urllib.quote(search_url)
#search_url = search_url.replace("PERSON_NAME", baseName)
#self.pluginCastLink = "XBMC.Container.Update(plugin://plugin.video.xbmb3c?mode=" + str(_MODE_GETCONTENT) + "&url=" + search_url + ")"
otherItemsList = None
try:
otherItemsList = self.getControl(3010)
items = otherMovieResult.get("Items")
if(items == None):
items = []
for item in items:
item_id = item.get("Id")
item_name = item.get("Name")
type_info = ""
image_id = item_id
item_type = item.get("Type")
if(item_type == "Season"):
image_id = item.get("SeriesId")
season = item.get("IndexNumber")
type_info = "Season " + str(season).zfill(2)
elif(item_type == "Series"):
image_id = item.get("Id")
type_info = "Series"
elif(item_type == "Movie"):
image_id = item.get("Id")
type_info = "Movie"
elif(item_type == "Episode"):
image_id = item.get("SeriesId")
season = item.get("ParentIndexNumber")
eppNum = item.get("IndexNumber")
type_info = "S" + str(season).zfill(2) + "E" + str(eppNum).zfill(2)
thumbPath = downloadUtils.imageUrl(image_id, "Primary", 0, 200, 200)
fanArt = downloadUtils.imageUrl(image_id, "Backdrop",0,10000,10000)
listItem = xbmcgui.ListItem(label=item_name, label2=type_info, iconImage=thumbPath, thumbnailImage=thumbPath)
listItem.setArt({"fanart":fanArt})
actionUrl = "plugin://plugin.video.emby?id=" + item_id + "&mode=play"
listItem.setProperty("ActionUrl", actionUrl)
otherItemsList.addItem(listItem)
except Exception, e:
#.........这里部分代码省略.........
示例3: doSearch
# 需要导入模块: from DownloadUtils import DownloadUtils [as 别名]
# 或者: from DownloadUtils.DownloadUtils import imageUrl [as 别名]
def doSearch(self, searchTerm):
movieResultsList = self.searchDialog.getControl(3110)
while(movieResultsList.size() > 0):
movieResultsList.removeItem(0)
#movieResultsList.reset()
seriesResultsList = self.searchDialog.getControl(3111)
while(seriesResultsList.size() > 0):
seriesResultsList.removeItem(0)
#seriesResultsList.reset()
episodeResultsList = self.searchDialog.getControl(3112)
while(episodeResultsList.size() > 0):
episodeResultsList.removeItem(0)
#episodeResultsList.reset()
if(len(searchTerm) == 0):
return
__settings__ = xbmcaddon.Addon(id='plugin.video.xbmb3c')
port = __settings__.getSetting('port')
host = __settings__.getSetting('ipaddress')
server = host + ":" + port
downloadUtils = DownloadUtils()
#
# Process movies
#
search = urllib.quote(searchTerm)
url = "http://" + server + "/mediabrowser/Search/Hints?SearchTerm=" + search + "&Limit=10&IncludeItemTypes=Movie&format=json"
jsonData = downloadUtils.downloadUrl(url, suppress=False, popup=1)
result = json.loads(jsonData)
items = result.get("SearchHints")
if(items == None or len(items) == 0):
item = []
for item in items:
xbmc.log(str(item))
item_id = item.get("ItemId")
item_name = item.get("Name")
item_type = item.get("Type")
typeLabel = "Movie"
thumbPath = downloadUtils.imageUrl(item_id, "Primary", 0, 200, 200)
xbmc.log(thumbPath)
listItem = xbmcgui.ListItem(label=item_name, label2=typeLabel, iconImage=thumbPath, thumbnailImage=thumbPath)
actionUrl = "plugin://plugin.video.xbmb3c?id=" + item_id + "&mode=" + str(_MODE_ITEM_DETAILS)
listItem.setProperty("ActionUrl", actionUrl)
movieResultsList.addItem(listItem)
#
# Process series
#
search = urllib.quote(searchTerm)
url = "http://" + server + "/mediabrowser/Search/Hints?SearchTerm=" + search + "&Limit=10&IncludeItemTypes=Series&format=json"
jsonData = downloadUtils.downloadUrl(url, suppress=False, popup=1 )
result = json.loads(jsonData)
items = result.get("SearchHints")
if(items == None or len(items) == 0):
item = []
for item in items:
xbmc.log(str(item))
item_id = item.get("ItemId")
item_name = item.get("Name")
item_type = item.get("Type")
typeLabel = ""
image_id = ""
image_id = item.get("ItemId")
typeLabel = "Series"
thumbPath = downloadUtils.imageUrl(image_id, "Primary", 0, 200, 200)
xbmc.log(thumbPath)
listItem = xbmcgui.ListItem(label=item_name, label2=typeLabel, iconImage=thumbPath, thumbnailImage=thumbPath)
actionUrl = "plugin://plugin.video.xbmb3c?id=" + item_id + "&mode=" + str(_MODE_ITEM_DETAILS)
listItem.setProperty("ActionUrl", actionUrl)
seriesResultsList.addItem(listItem)
#
# Process episodes
#
search = urllib.quote(searchTerm)
#.........这里部分代码省略.........