本文整理汇总了Python中DownloadUtils.DownloadUtils.getUserId方法的典型用法代码示例。如果您正苦于以下问题:Python DownloadUtils.getUserId方法的具体用法?Python DownloadUtils.getUserId怎么用?Python DownloadUtils.getUserId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DownloadUtils.DownloadUtils
的用法示例。
在下文中一共展示了DownloadUtils.getUserId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getLatestEpisodes
# 需要导入模块: from DownloadUtils import DownloadUtils [as 别名]
# 或者: from DownloadUtils.DownloadUtils import getUserId [as 别名]
def getLatestEpisodes(self, fullinfo = False, itemList = []):
result = None
addon = xbmcaddon.Addon(id='plugin.video.emby')
port = addon.getSetting('port')
host = addon.getSetting('ipaddress')
server = host + ":" + port
downloadUtils = DownloadUtils()
userid = downloadUtils.getUserId()
limitString = "Limit=20&SortBy=DateCreated&"
if(len(itemList) > 0): # if we want a certain list specify it
limitString = "Ids=" + ",".join(itemList) + "&"
if fullinfo:
url = server + '/mediabrowser/Users/' + userid + '/Items?' + limitString + 'IsVirtualUnaired=false&IsMissing=False&Fields=ParentId,Path,Genres,SortName,Studios,Writer,ProductionYear,Taglines,CommunityRating,OfficialRating,CumulativeRunTimeTicks,Metascore,AirTime,DateCreated,MediaStreams,People,Overview&Recursive=true&SortOrder=Descending&IncludeItemTypes=Episode&format=json&ImageTypeLimit=1'
else:
url = server + '/mediabrowser/Users/' + userid + '/Items?' + limitString + 'IsVirtualUnaired=false&IsMissing=False&Fields=ParentId,Name,SortName,CumulativeRunTimeTicks&Recursive=true&SortOrder=Descending&IncludeItemTypes=Episode&format=json&ImageTypeLimit=1'
jsonData = downloadUtils.downloadUrl(url, suppress=False, popup=0)
if jsonData != None and jsonData != "":
result = json.loads(jsonData)
if(result.has_key('Items')):
result = result['Items']
return result
示例2: getMusicVideos
# 需要导入模块: from DownloadUtils import DownloadUtils [as 别名]
# 或者: from DownloadUtils.DownloadUtils import getUserId [as 别名]
def getMusicVideos(self, fullinfo = False, fullSync = True):
result = None
addon = xbmcaddon.Addon(id='plugin.video.emby')
port = addon.getSetting('port')
host = addon.getSetting('ipaddress')
server = host + ":" + port
downloadUtils = DownloadUtils()
userid = downloadUtils.getUserId()
if not fullSync:
sortstring = "&Limit=20&SortBy=DateCreated"
else:
sortstring = "&SortBy=SortName"
if fullinfo:
url = server + '/mediabrowser/Users/' + userid + '/items?' + sortstring + '&Fields=Path,Genres,SortName,Studios,Writer,ProductionYear,Taglines,CommunityRating,OfficialRating,CumulativeRunTimeTicks,Metascore,AirTime,DateCreated,MediaStreams,People,Overview&Recursive=true&SortOrder=Descending&IncludeItemTypes=MusicVideo&format=json&ImageTypeLimit=1'
else:
url = server + '/mediabrowser/Users/' + userid + '/items?' + sortstring + '&Fields=CumulativeRunTimeTicks&Recursive=true&SortOrder=Descending&IncludeItemTypes=MusicVideo&CollapseBoxSetItems=false&format=json&ImageTypeLimit=1'
jsonData = downloadUtils.downloadUrl(url, suppress=False, popup=0)
if jsonData != None and jsonData != "":
result = json.loads(jsonData)
if(result.has_key('Items')):
result = result['Items']
return result
示例3: getItem
# 需要导入模块: from DownloadUtils import DownloadUtils [as 别名]
# 或者: from DownloadUtils.DownloadUtils import getUserId [as 别名]
def getItem(self, id):
result = None
addon = xbmcaddon.Addon(id='plugin.video.emby')
port = addon.getSetting('port')
host = addon.getSetting('ipaddress')
server = host + ":" + port
downloadUtils = DownloadUtils()
userid = downloadUtils.getUserId()
jsonData = downloadUtils.downloadUrl("http://" + server + "/mediabrowser/Users/" + userid + "/Items/" + id + "?format=json&ImageTypeLimit=1", suppress=False, popup=1 )
if jsonData != None and jsonData != "":
result = json.loads(jsonData)
return result
示例4: getMoviesInBoxSet
# 需要导入模块: from DownloadUtils import DownloadUtils [as 别名]
# 或者: from DownloadUtils.DownloadUtils import getUserId [as 别名]
def getMoviesInBoxSet(self,boxsetId):
result = None
addon = xbmcaddon.Addon(id='plugin.video.emby')
port = addon.getSetting('port')
host = addon.getSetting('ipaddress')
server = host + ":" + port
downloadUtils = DownloadUtils()
userid = downloadUtils.getUserId()
url = server + '/mediabrowser/Users/' + userid + '/Items?ParentId=' + boxsetId + '&Fields=ItemCounts&format=json&ImageTypeLimit=1'
jsonData = downloadUtils.downloadUrl(url, suppress=False, popup=0)
if jsonData != None and jsonData != "":
result = json.loads(jsonData)
if(result.has_key('Items')):
result = result['Items']
return result
示例5: getBoxSets
# 需要导入模块: from DownloadUtils import DownloadUtils [as 别名]
# 或者: from DownloadUtils.DownloadUtils import getUserId [as 别名]
def getBoxSets(self):
result = None
addon = xbmcaddon.Addon(id='plugin.video.emby')
port = addon.getSetting('port')
host = addon.getSetting('ipaddress')
server = host + ":" + port
downloadUtils = DownloadUtils()
userid = downloadUtils.getUserId()
url = server + '/mediabrowser/Users/' + userid + '/Items?SortBy=SortName&IsVirtualUnaired=false&IsMissing=False&Fields=Name,SortName,CumulativeRunTimeTicks&Recursive=true&SortOrder=Ascending&IncludeItemTypes=BoxSet&format=json&ImageTypeLimit=1'
jsonData = downloadUtils.downloadUrl(url, suppress=False, popup=0)
if jsonData != None and jsonData != "":
result = json.loads(jsonData)
if(result.has_key('Items')):
result = result['Items']
return result
示例6: getTVShowSeasons
# 需要导入模块: from DownloadUtils import DownloadUtils [as 别名]
# 或者: from DownloadUtils.DownloadUtils import getUserId [as 别名]
def getTVShowSeasons(self, tvShowId):
result = None
addon = xbmcaddon.Addon(id='plugin.video.emby')
port = addon.getSetting('port')
host = addon.getSetting('ipaddress')
server = host + ":" + port
downloadUtils = DownloadUtils()
userid = downloadUtils.getUserId()
url = 'http://' + server + '/Shows/' + tvShowId + '/Seasons?UserId=' + userid + '&format=json&ImageTypeLimit=1'
jsonData = downloadUtils.downloadUrl(url, suppress=False, popup=0)
if jsonData != None and jsonData != "":
result = json.loads(jsonData)
if(result.has_key('Items')):
result = result['Items']
return result
示例7: getMovies
# 需要导入模块: from DownloadUtils import DownloadUtils [as 别名]
# 或者: from DownloadUtils.DownloadUtils import getUserId [as 别名]
def getMovies(self, id, fullinfo = False, fullSync = True, itemList = []):
result = None
addon = xbmcaddon.Addon(id='plugin.video.emby')
port = addon.getSetting('port')
host = addon.getSetting('ipaddress')
server = host + ":" + port
downloadUtils = DownloadUtils()
userid = downloadUtils.getUserId()
if fullSync:
sortstring = "&SortBy=SortName"
else:
if(len(itemList) > 0): # if we want a certain list specify it
#sortstring = "&Ids=" + ",".join(itemList)
sortstring = "" # work around for now until ParetnId and Id work together
else: # just get the last 20 created items
sortstring = "&Limit=20&SortBy=DateCreated"
if fullinfo:
url = server + '/mediabrowser/Users/' + userid + '/items?ParentId=' + id + sortstring + '&Fields=Path,Genres,SortName,Studios,Writer,ProductionYear,Taglines,CommunityRating,OfficialRating,CumulativeRunTimeTicks,Metascore,AirTime,DateCreated,MediaStreams,People,Overview&Recursive=true&SortOrder=Descending&IncludeItemTypes=Movie&CollapseBoxSetItems=false&format=json&ImageTypeLimit=1'
else:
url = server + '/mediabrowser/Users/' + userid + '/items?ParentId=' + id + sortstring + '&Fields=CumulativeRunTimeTicks&Recursive=true&SortOrder=Descending&IncludeItemTypes=Movie&CollapseBoxSetItems=false&format=json&ImageTypeLimit=1'
jsonData = downloadUtils.downloadUrl(url, suppress=False, popup=0)
if jsonData != None and jsonData != "":
result = json.loads(jsonData)
if(result.has_key('Items')):
result = result['Items']
# work around for now until ParetnId and Id work together
if(result != None and len(result) > 0 and len(itemList) > 0):
newResult = []
for item in result:
if(item.get("Id") in itemList):
newResult.append(item)
result = newResult
return result
示例8: updateRandom
# 需要导入模块: from DownloadUtils import DownloadUtils [as 别名]
# 或者: from DownloadUtils.DownloadUtils import getUserId [as 别名]
def updateRandom(self):
self.logMsg("updateRandomMovies Called")
useBackgroundData = xbmcgui.Window(10000).getProperty("BackgroundDataLoaded") == "true"
addonSettings = xbmcaddon.Addon(id='plugin.video.xbmb3c')
mb3Host = addonSettings.getSetting('ipaddress')
mb3Port = addonSettings.getSetting('port')
userName = addonSettings.getSetting('username')
downloadUtils = DownloadUtils()
userid = downloadUtils.getUserId()
self.logMsg("updateRandomMovies UserID : " + userid)
self.logMsg("Updating Random Movie List")
randomUrl = "http://" + mb3Host + ":" + mb3Port + "/mediabrowser/Users/" + userid + "/Items?Limit=30&Recursive=true&SortBy=Random&Fields=Path,Genres,MediaStreams,Overview,ShortOverview,CriticRatingSummary&SortOrder=Descending&Filters=IsUnplayed,IsNotFolder&IncludeItemTypes=Movie&format=json"
jsonData = downloadUtils.downloadUrl(randomUrl, suppress=True, popup=1)
if(jsonData == ""):
return
result = json.loads(jsonData)
self.logMsg("Random Movie Json Data : " + str(result), level=2)
result = result.get("Items")
if(result == None):
result = []
db = Database()
WINDOW = xbmcgui.Window(10000)
item_count = 1
for item in result:
title = "Missing Title"
if(item.get("Name") != None):
title = item.get("Name").encode('utf-8')
rating = item.get("CommunityRating")
criticrating = item.get("CriticRating")
officialrating = item.get("OfficialRating")
criticratingsummary = ""
if(item.get("CriticRatingSummary") != None):
criticratingsummary = item.get("CriticRatingSummary").encode('utf-8')
plot = item.get("Overview")
if plot == None:
plot = ''
plot = plot.encode('utf-8')
shortplot = item.get("ShortOverview")
if shortplot == None:
shortplot = ''
shortplot = shortplot.encode('utf-8')
year = item.get("ProductionYear")
if(item.get("RunTimeTicks") != None):
runtime = str(int(item.get("RunTimeTicks")) / (10000000 * 60))
else:
runtime = "0"
item_id = item.get("Id")
if useBackgroundData != True:
poster = downloadUtils.getArtwork(item, "Primary3")
thumbnail = downloadUtils.getArtwork(item, "Primary")
logo = downloadUtils.getArtwork(item, "Logo")
fanart = downloadUtils.getArtwork(item, "Backdrop")
landscape = downloadUtils.getArtwork(item, "Thumb3")
discart = downloadUtils.getArtwork(item, "Disc")
medium_fanart = downloadUtils.getArtwork(item, "Backdrop3")
if item.get("ImageTags").get("Thumb") != None:
realthumb = downloadUtils.getArtwork(item, "Thumb3")
else:
realthumb = medium_fanart
else:
poster = db.get(item_id +".Primary3")
thumbnail = db.get(item_id +".Primary")
logo = db.get(item_id +".Logo")
fanart = db.get(item_id +".Backdrop")
landscape = db.get(item_id +".Thumb3")
discart = db.get(item_id +".Disc")
medium_fanart = db.get(item_id +".Backdrop3")
if item.get("ImageTags").get("Thumb") != None:
realthumb = db.get(item_id +".Thumb3")
else:
realthumb = medium_fanart
url = mb3Host + ":" + mb3Port + ',;' + item_id
# play or show info
selectAction = addonSettings.getSetting('selectAction')
if(selectAction == "1"):
playUrl = "plugin://plugin.video.xbmb3c/?id=" + item_id + '&mode=' + str(_MODE_ITEM_DETAILS)
else:
playUrl = "plugin://plugin.video.xbmb3c/?url=" + url + '&mode=' + str(_MODE_BASICPLAY)
playUrl = playUrl.replace("\\\\", "smb://")
playUrl = playUrl.replace("\\", "/")
self.logMsg("RandomMovieMB3." + str(item_count) + ".Title = " + title, level=2)
self.logMsg("RandomMovieMB3." + str(item_count) + ".Thumb = " + thumbnail, level=2)
self.logMsg("RandomMovieMB3." + str(item_count) + ".Path = " + playUrl, level=2)
#.........这里部分代码省略.........
示例9: onInit
# 需要导入模块: from DownloadUtils import DownloadUtils [as 别名]
# 或者: from DownloadUtils.DownloadUtils import getUserId [as 别名]
def onInit(self):
self.action_exitkeys_id = [10, 13]
__settings__ = xbmcaddon.Addon(id='plugin.video.xbmb3c')
port = __settings__.getSetting('port')
host = __settings__.getSetting('ipaddress')
server = host + ":" + port
downloadUtils = DownloadUtils()
userid = downloadUtils.getUserId()
jsonData = downloadUtils.downloadUrl("http://" + server + "/mediabrowser/Persons/" + self.personName + "?format=json", suppress=False, popup=1 )
result = json.loads(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
imageTag = ""
if(result.get("ImageTags") != None and result.get("ImageTags").get("Primary") != None):
imageTag = result.get("ImageTags").get("Primary")
image = "http://localhost:15001/?id=" + id + "&type=" + "Primary" + "&tag=" + imageTag
#get other movies
encoded = name.encode("utf-8")
encoded = urllib.quote(encoded)
url = "http://" + server + "/mediabrowser/Users/" + userid + "/Items/?Recursive=True&Person=" + encoded + "&format=json"
xbmc.log("URL: " + url)
jsonData = downloadUtils.downloadUrl(url, suppress=False, popup=1 )
otherMovieResult = json.loads(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)
#.........这里部分代码省略.........
示例10: Player
# 需要导入模块: from DownloadUtils import DownloadUtils [as 别名]
# 或者: from DownloadUtils.DownloadUtils import getUserId [as 别名]
class Player( xbmc.Player ):
logLevel = 0
played_information = {}
downloadUtils = None
settings = None
playStats = {}
def __init__( self, *args ):
self.settings = xbmcaddon.Addon(id='plugin.video.emby')
self.downloadUtils = DownloadUtils()
try:
self.logLevel = int(self.settings.getSetting('logLevel'))
except:
pass
self.printDebug("emby Service -> starting playback monitor service",1)
self.played_information = {}
pass
def printDebug(self, msg, level = 1):
if(self.logLevel >= level):
if(self.logLevel == 2):
try:
xbmc.log("emby " + str(level) + " -> " + inspect.stack()[1][3] + " : " + str(msg))
except UnicodeEncodeError:
xbmc.log("emby " + str(level) + " -> " + inspect.stack()[1][3] + " : " + str(msg.encode('utf-8')))
else:
try:
xbmc.log("emby " + str(level) + " -> " + str(msg))
except UnicodeEncodeError:
xbmc.log("emby " + str(level) + " -> " + str(msg.encode('utf-8')))
def hasData(self, data):
if(data == None or len(data) == 0 or data == "None"):
return False
else:
return True
def stopAll(self):
if(len(self.played_information) == 0):
return
addonSettings = xbmcaddon.Addon(id='plugin.video.emby')
self.printDebug("emby Service -> played_information : " + str(self.played_information))
for item_url in self.played_information:
data = self.played_information.get(item_url)
if(data != None):
self.printDebug("emby Service -> item_url : " + item_url)
self.printDebug("emby Service -> item_data : " + str(data))
runtime = data.get("runtime")
currentPosition = data.get("currentPosition")
item_id = data.get("item_id")
refresh_id = data.get("refresh_id")
currentFile = data.get("currentfile")
type = data.get("Type")
if(currentPosition != None and self.hasData(runtime)):
runtimeTicks = int(runtime)
self.printDebug("emby Service -> runtimeticks:" + str(runtimeTicks))
percentComplete = (currentPosition * 10000000) / runtimeTicks
markPlayedAt = float(90) / 100
self.printDebug("emby Service -> Percent Complete:" + str(percentComplete) + " Mark Played At:" + str(markPlayedAt))
self.stopPlayback(data)
if(refresh_id != None):
#report updates playcount and resume status to Kodi and MB3
librarySync.updatePlayCount(item_id,type)
# if its an episode see if autoplay is enabled
if addonSettings.getSetting("autoPlaySeason")=="true" and type=="Episode":
port = addonSettings.getSetting('port')
host = addonSettings.getSetting('ipaddress')
server = host + ":" + port
userid = self.downloadUtils.getUserId()
# add remaining unplayed episodes if applicable
MB3Episode = ReadEmbyDB().getItem(item_id)
userData = MB3Episode["UserData"]
if userData!=None and userData["Played"]==True:
pDialog = xbmcgui.DialogProgress()
pDialog.create("Auto Play","Further Episode(s) in "+MB3Episode["SeasonName"]+" for "+MB3Episode["SeriesName"]+ " found","Cancel to stop automatic play of remaining episodes")
count = 0
while(pDialog.iscanceled==False or count < 10):
xbmc.sleep(1000)
count += 1
progress = count * 10
remainingsecs = 10 - count
pDialog.update(progress,"Further Episode(s) in "+MB3Episode["SeasonName"]+" for "+MB3Episode["SeriesName"]+ " found","Cancel to stop automatic play of remaining episodes", str(remainingsecs) + " second(s) until auto dismiss")
if pDialog.iscanceled()==False:
seasonId = MB3Episode["SeasonId"]
jsonData = self.downloadUtils.downloadUrl("http://" + server + "/mediabrowser/Users/" + userid + "/Items?ParentId=" + seasonId + "&ImageTypeLimit=1&SortBy=SortName&SortOrder=Ascending&Filters=IsUnPlayed&IncludeItemTypes=Episode&IsVirtualUnaired=false&Recursive=true&IsMissing=False&format=json", suppress=False, popup=1 )
if(jsonData != ""):
seasonData = json.loads(jsonData)
#.........这里部分代码省略.........
示例11: updateSuggested
# 需要导入模块: from DownloadUtils import DownloadUtils [as 别名]
# 或者: from DownloadUtils.DownloadUtils import getUserId [as 别名]
def updateSuggested(self):
self.logMsg("updateSuggested Called")
useBackgroundData = xbmcgui.Window(10000).getProperty("BackgroundDataLoaded") == "true"
addonSettings = xbmcaddon.Addon(id='plugin.video.xbmb3c')
mb3Host = addonSettings.getSetting('ipaddress')
mb3Port = addonSettings.getSetting('port')
userName = addonSettings.getSetting('username')
downloadUtils = DownloadUtils()
db = Database()
userid = downloadUtils.getUserId()
self.logMsg("updateSuggested UserID : " + userid)
self.logMsg("Updating Suggested List")
suggestedUrl = "http://" + mb3Host + ":" + mb3Port + "/mediabrowser/Movies/Recommendations?UserId=" + userid + "&categoryLimit=2&ItemLimit=20&Fields=Overview,ShortOverview,CriticRatingSummary&format=json"
jsonData = downloadUtils.downloadUrl(suggestedUrl, suppress=True, popup=1 )
if(jsonData == ""):
return
allresult = json.loads(jsonData)
self.logMsg("Suggested Movie Json Data : " + str(allresult), level=2)
basemovie = "Missing Base Title"
if(allresult == None or len(allresult) == 0):
return
if (allresult[0].get("BaselineItemName") != None):
basemovie = allresult[0].get("BaselineItemName").encode('utf-8')
result = allresult[0].get("Items")
WINDOW = xbmcgui.Window( 10000 )
if(result == None):
result = []
item_count = 1
for item in result:
if item.get("Type") == "Movie":
title = "Missing Title"
if(item.get("Name") != None):
title = item.get("Name").encode('utf-8')
rating = item.get("CommunityRating")
criticrating = item.get("CriticRating")
officialrating = item.get("OfficialRating")
criticratingsummary = ""
if(item.get("CriticRatingSummary") != None):
criticratingsummary = item.get("CriticRatingSummary").encode('utf-8')
plot = item.get("Overview")
if plot == None:
plot=''
plot=plot.encode('utf-8')
shortplot = item.get("ShortOverview")
if shortplot == None:
shortplot = ''
shortplot = shortplot.encode('utf-8')
year = item.get("ProductionYear")
if(item.get("RunTimeTicks") != None):
runtime = str(int(item.get("RunTimeTicks"))/(10000000*60))
else:
runtime = "0"
item_id = item.get("Id")
if useBackgroundData != True:
poster = downloadUtils.getArtwork(item, "Primary3")
thumbnail = downloadUtils.getArtwork(item, "Primary")
logo = downloadUtils.getArtwork(item, "Logo")
fanart = downloadUtils.getArtwork(item, "Backdrop")
landscape = downloadUtils.getArtwork(item, "Thumb3")
discart = downloadUtils.getArtwork(item, "Disc")
medium_fanart = downloadUtils.getArtwork(item, "Backdrop3")
if item.get("ImageTags").get("Thumb") != None:
realthumbnail = downloadUtils.getArtwork(item, "Thumb3")
else:
realthumbnail = medium_fanart
else:
poster = db.get(item_id +".Primary3")
thumbnail = db.get(item_id +".Primary")
logo = db.get(item_id +".Logo")
fanart = db.get(item_id +".Backdrop")
landscape = db.get(item_id +".Thumb3")
discart = db.get(item_id +".Disc")
medium_fanart = db.get(item_id +".Backdrop3")
if item.get("ImageTags").get("Thumb") != None:
realthumbnail = db.get(item_id +".Thumb3")
else:
realthumbnail = medium_fanart
url = mb3Host + ":" + mb3Port + ',;' + item_id
# play or show info
selectAction = addonSettings.getSetting('selectAction')
if(selectAction == "1"):
playUrl = "plugin://plugin.video.xbmb3c/?id=" + item_id + '&mode=' + str(_MODE_ITEM_DETAILS)
else:
#.........这里部分代码省略.........
示例12: onInit
# 需要导入模块: from DownloadUtils import DownloadUtils [as 别名]
# 或者: from DownloadUtils.DownloadUtils import getUserId [as 别名]
def onInit(self):
self.action_exitkeys_id = [10, 13]
__settings__ = xbmcaddon.Addon(id='plugin.video.xbmb3c')
port = __settings__.getSetting('port')
host = __settings__.getSetting('ipaddress')
server = host + ":" + port
downloadUtils = DownloadUtils()
userid = downloadUtils.getUserId()
jsonData = downloadUtils.downloadUrl("http://" + server + "/mediabrowser/Users/" + userid + "/Items/" + self.id + "?format=json", suppress=False, popup=1 )
item = json.loads(jsonData)
id = item.get("Id")
name = item.get("Name")
image = downloadUtils.getArtwork(item, "Primary")
fanArt = downloadUtils.getArtwork(item, "Backdrop")
# calculate the percentage complete
userData = item.get("UserData")
cappedPercentage = None
if(userData != None):
playBackTicks = float(userData.get("PlaybackPositionTicks"))
if(playBackTicks != None and playBackTicks > 0):
runTimeTicks = float(item.get("RunTimeTicks", "0"))
if(runTimeTicks > 0):
percentage = int((playBackTicks / runTimeTicks) * 100.0)
cappedPercentage = percentage - (percentage % 10)
if(cappedPercentage == 0):
cappedPercentage = 10
if(cappedPercentage == 100):
cappedPercentage = 90
episodeInfo = ""
type = item.get("Type")
if(type == "Episode" or type == "Season"):
name = item.get("SeriesName") + ": " + name
season = str(item.get("ParentIndexNumber")).zfill(2)
episodeNum = str(item.get("IndexNumber")).zfill(2)
episodeInfo = "S" + season + "xE" + episodeNum
url = server + ',;' + id
url = urllib.quote(url)
self.playUrl = "plugin://plugin.video.xbmb3c/?url=" + url + '&mode=' + str(_MODE_BASICPLAY)
self.peopleUrl = "XBMC.Container.Update(plugin://plugin.video.xbmb3c?mode=" + str(_MODE_CAST_LIST) + "&id=" + id + ")"
#self.peopleUrl = "XBMC.RunPlugin(plugin://plugin.video.xbmb3c?mode=" + str(_MODE_CAST_LIST) + "&id=" + id + ")"
# all all the media stream info
mediaList = self.getControl(3220)
mediaStreams = item.get("MediaStreams")
if(mediaStreams != None):
for mediaStream in mediaStreams:
if(mediaStream.get("Type") == "Video"):
videocodec = mediaStream.get("Codec")
if(videocodec == "mpeg2video"):
videocodec = "mpeg2"
height = str(mediaStream.get("Height"))
width = str(mediaStream.get("Width"))
aspectratio = mediaStream.get("AspectRatio")
fr = mediaStream.get("RealFrameRate")
videoInfo = width + "x" + height + " " + videocodec + " " + str(round(fr, 2))
listItem = xbmcgui.ListItem("Video:", videoInfo)
mediaList.addItem(listItem)
if(mediaStream.get("Type") == "Audio"):
audiocodec = mediaStream.get("Codec")
channels = mediaStream.get("Channels")
lang = mediaStream.get("Language")
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")
#.........这里部分代码省略.........
示例13: updateNextUp
# 需要导入模块: from DownloadUtils import DownloadUtils [as 别名]
# 或者: from DownloadUtils.DownloadUtils import getUserId [as 别名]
def updateNextUp(self):
self.logMsg("updateNextUp Called")
useBackgroundData = xbmcgui.Window(10000).getProperty("BackgroundDataLoaded") == "true"
addonSettings = xbmcaddon.Addon(id='plugin.video.xbmb3c')
mb3Host = addonSettings.getSetting('ipaddress')
mb3Port = addonSettings.getSetting('port')
userName = addonSettings.getSetting('username')
downloadUtils = DownloadUtils()
userid = downloadUtils.getUserId()
self.logMsg("updateNextUp UserID : " + userid)
self.logMsg("Updating NextUp List")
nextUpUrl = "http://" + mb3Host + ":" + mb3Port + "/mediabrowser/Shows/NextUp?UserId=" + userid + "&Fields=Path,Genres,MediaStreams,Overview,ShortOverview&format=json&ImageTypeLimit=1"
jsonData = downloadUtils.downloadUrl(nextUpUrl, suppress=True, popup=1 )
if(jsonData == ""):
return
result = json.loads(jsonData)
self.logMsg("NextUP TV Show Json Data : " + str(result), level=2)
result = result.get("Items")
WINDOW = xbmcgui.Window( 10000 )
if(result == None):
result = []
db = Database()
item_count = 1
for item in result:
title = "Missing Title"
if(item.get("Name") != None):
title = item.get("Name").encode('utf-8')
seriesName = "Missing Name"
if(item.get("SeriesName") != None):
seriesName = item.get("SeriesName").encode('utf-8')
eppNumber = "X"
tempEpisodeNumber = "XX"
if(item.get("IndexNumber") != None):
eppNumber = item.get("IndexNumber")
if eppNumber < 10:
tempEpisodeNumber = "0" + str(eppNumber)
else:
tempEpisodeNumber = str(eppNumber)
seasonNumber = item.get("ParentIndexNumber")
tempSeasonNumber = "XX"
if seasonNumber < 10:
tempSeasonNumber = "0" + str(seasonNumber)
else:
tempSeasonNumber = str(seasonNumber)
rating = str(item.get("CommunityRating"))
plot = item.get("Overview")
if plot == None:
plot=''
plot=plot.encode('utf-8')
shortplot = item.get("ShortOverview")
if shortplot == None:
shortplot = ''
shortplot = shortplot.encode('utf-8')
year = item.get("ProductionYear")
item_id = item.get("Id")
seriesId = item.get("SeriesId")
seriesthumbnail = ""
if useBackgroundData != True:
seriesJsonData = downloadUtils.downloadUrl("http://" + mb3Host + ":" + mb3Port + "/mediabrowser/Users/" + userid + "/Items/" + seriesId + "?format=json", suppress=True, popup=1 )
if(seriesJsonData != ""):
seriesResult = json.loads(seriesJsonData)
officialrating = seriesResult.get("OfficialRating")
poster = downloadUtils.getArtwork(seriesResult, "Primary3")
small_poster = downloadUtils.getArtwork(seriesResult, "Primary2")
thumbnail = downloadUtils.getArtwork(item, "Primary")
logo = downloadUtils.getArtwork(seriesResult, "Logo")
fanart = downloadUtils.getArtwork(item, "Backdrop")
medium_fanart = downloadUtils.getArtwork(item, "Backdrop3")
banner = downloadUtils.getArtwork(item, "Banner")
if (seriesResult.get("ImageTags") != None and seriesResult.get("ImageTags").get("Thumb") != None):
seriesthumbnail = downloadUtils.getArtwork(seriesResult, "Thumb3")
else:
seriesthumbnail = fanart
else:
# get rid of the call below when we can get the series userdata
officialrating = db.get(seriesId + ".OfficialRating")
poster = db.get(seriesId + ".Primary3")
small_poster = db.get(seriesId + ".Primary2")
thumbnail = db.get(seriesId + ".Primary")
logo = db.get(seriesId + ".Logo")
fanart = db.get(seriesId + ".Backdrop")
medium_fanart = db.get(seriesId + ".Backdrop3")
banner = db.get(seriesId + ".Banner")
if (item.get("SeriesThumbImageTag") != None and item.get("SeriesThumbImageTag") != ""):
seriesthumbnail = db.get(seriesId + ".Thumb3")
else:
#.........这里部分代码省略.........
示例14: updateInProgress
# 需要导入模块: from DownloadUtils import DownloadUtils [as 别名]
# 或者: from DownloadUtils.DownloadUtils import getUserId [as 别名]
def updateInProgress(self):
self.logMsg("updateInProgress Called")
useBackgroundData = xbmcgui.Window(10000).getProperty("BackgroundDataLoaded") == "true"
addonSettings = xbmcaddon.Addon(id='plugin.video.xbmb3c')
mb3Host = addonSettings.getSetting('ipaddress')
mb3Port = addonSettings.getSetting('port')
userName = addonSettings.getSetting('username')
downloadUtils = DownloadUtils()
userid = downloadUtils.getUserId()
self.logMsg("InProgress UserName : " + userName + " UserID : " + userid)
self.logMsg("Updating In Progress Movie List")
recentUrl = "http://" + mb3Host + ":" + mb3Port + "/mediabrowser/Users/" + userid + "/Items?Limit=30&Recursive=true&SortBy=DatePlayed&SortOrder=Descending&Fields=Path,Genres,MediaStreams,Overview,ShortOverview,CriticRatingSummary&Filters=IsResumable&IncludeItemTypes=Movie&format=json"
jsonData = downloadUtils.downloadUrl(recentUrl, suppress=True, popup=1 )
if(jsonData == ""):
return
result = json.loads(jsonData)
result = result.get("Items")
if(result == None):
result = []
db = Database()
WINDOW = xbmcgui.Window( 10000 )
item_count = 1
for item in result:
title = "Missing Title"
if(item.get("Name") != None):
title = item.get("Name").encode('utf-8')
rating = item.get("CommunityRating")
criticrating = item.get("CriticRating")
officialrating = item.get("OfficialRating")
criticratingsummary = ""
if(item.get("CriticRatingSummary") != None):
criticratingsummary = item.get("CriticRatingSummary").encode('utf-8')
plot = item.get("Overview")
if plot == None:
plot=''
plot=plot.encode('utf-8')
shortplot = item.get("ShortOverview")
if shortplot == None:
shortplot = ''
shortplot = shortplot.encode('utf-8')
year = item.get("ProductionYear")
if(item.get("RunTimeTicks") != None):
runtime = str(int(item.get("RunTimeTicks"))/(10000000*60))
else:
runtime = "0"
userData = item.get("UserData")
if(userData != None):
reasonableTicks = int(userData.get("PlaybackPositionTicks")) / 1000
seekTime = reasonableTicks / 10000
duration = float(runtime)
resume = float(seekTime) / 60.0
if (duration == 0):
percentage=0
else:
percentage = (resume / duration) * 100.0
perasint = int(percentage)
title = str(perasint) + "% " + title
item_id = item.get("Id")
if useBackgroundData != True:
poster = downloadUtils.getArtwork(item, "Primary3")
thumbnail = downloadUtils.getArtwork(item, "Primary")
logo = downloadUtils.getArtwork(item, "Logo")
fanart = downloadUtils.getArtwork(item, "Backdrop")
landscape = downloadUtils.getArtwork(item, "Thumb3")
discart = downloadUtils.getArtwork(item, "Disc")
medium_fanart = downloadUtils.getArtwork(item, "Backdrop3")
if item.get("ImageTags").get("Thumb") != None:
realthumbnail = downloadUtils.getArtwork(item, "Thumb3")
else:
realthumbnail = medium_fanart
else:
poster = db.get(item_id +".Primary3")
thumbnail = db.get(item_id +".Primary")
logo = db.get(item_id +".Logo")
fanart = db.get(item_id +".Backdrop")
landscape = db.get(item_id +".Thumb3")
discart = db.get(item_id +".Disc")
medium_fanart = db.get(item_id +".Backdrop3")
if item.get("ImageTags").get("Thumb") != None:
realthumbnail = db.get(item_id +".Thumb3")
else:
realthumbnail = medium_fanart
url = mb3Host + ":" + mb3Port + ',;' + item_id
playUrl = "plugin://plugin.video.xbmb3c/?url=" + url + '&mode=' + str(_MODE_BASICPLAY)
playUrl = playUrl.replace("\\\\","smb://")
playUrl = playUrl.replace("\\","/")
#.........这里部分代码省略.........
示例15: updateInfo
# 需要导入模块: from DownloadUtils import DownloadUtils [as 别名]
# 或者: from DownloadUtils.DownloadUtils import getUserId [as 别名]
def updateInfo(self):
self.logMsg("updateInfo Called")
addonSettings = xbmcaddon.Addon(id='plugin.video.xbmb3c')
mb3Host = addonSettings.getSetting('ipaddress')
mb3Port = addonSettings.getSetting('port')
userName = addonSettings.getSetting('username')
downloadUtils = DownloadUtils()
userid = downloadUtils.getUserId()
self.logMsg("updateInfo UserID : " + userid)
self.logMsg("Updating info List")
infoUrl = "http://" + mb3Host + ":" + mb3Port + "/mediabrowser/Users/" + userid + "/Items?Fields=CollectionType&format=json"
jsonData = downloadUtils.downloadUrl(infoUrl, suppress=True, popup=1 )
if(jsonData == ""):
return
result = json.loads(jsonData)
result = result.get("Items")
WINDOW = xbmcgui.Window( 10000 )
if(result == None):
result = []
item_count = 1
movie_count = 0
movie_unwatched_count = 0
tv_count = 0
episode_count = 0
episode_unwatched_count = 0
tv_unwatched_count = 0
music_count = 0
music_songs_count = 0
music_songs_unplayed_count = 0
musicvideos_count = 0
musicvideos_unwatched_count = 0
trailers_count = 0
trailers_unwatched_count = 0
photos_count = 0
channels_count = 0
for item in result:
collectionType = item.get("CollectionType")
if collectionType==None:
collectionType="unknown"
self.logMsg("collectionType " + collectionType)
userData = item.get("UserData")
if(collectionType == "movies"):
movie_count = movie_count + item.get("RecursiveItemCount")
movie_unwatched_count = movie_unwatched_count + userData.get("UnplayedItemCount")
if(collectionType == "musicvideos"):
musicvideos_count = musicvideos_count + item.get("RecursiveItemCount")
musicvideos_unwatched_count = musicvideos_unwatched_count + userData.get("UnplayedItemCount")
if(collectionType == "tvshows"):
tv_count = tv_count + item.get("ChildCount")
episode_count = episode_count + item.get("RecursiveItemCount")
episode_unwatched_count = episode_unwatched_count + userData.get("UnplayedItemCount")
if(collectionType == "music"):
music_count = music_count + item.get("ChildCount")
music_songs_count = music_songs_count + item.get("RecursiveItemCount")
music_songs_unplayed_count = music_songs_unplayed_count + userData.get("UnplayedItemCount")
if(collectionType == "photos"):
photos_count = photos_count + item.get("RecursiveItemCount")
if(item.get("Name") == "Trailers"):
trailers_count = trailers_count + item.get("RecursiveItemCount")
trailers_unwatched_count = trailers_unwatched_count + userData.get("UnplayedItemCount")
self.logMsg("MoviesCount " + str(movie_count), level=2)
self.logMsg("MoviesUnWatchedCount " + str(movie_unwatched_count), level=2)
self.logMsg("MusicVideosCount " + str(musicvideos_count), level=2)
self.logMsg("MusicVideosUnWatchedCount " + str(musicvideos_unwatched_count), level=2)
self.logMsg("TVCount " + str(tv_count), level=2)
self.logMsg("EpisodeCount " + str(episode_count), level=2)
self.logMsg("EpisodeUnWatchedCount " + str(episode_unwatched_count), level=2)
self.logMsg("MusicCount " + str(music_count), level=2)
self.logMsg("SongsCount " + str(music_songs_count), level=2)
self.logMsg("SongsUnPlayedCount " + str(music_songs_unplayed_count), level=2)
self.logMsg("TrailersCount" + str(trailers_count), level=2)
self.logMsg("TrailersUnWatchedCount" + str(trailers_unwatched_count), level=2)
self.logMsg("PhotosCount" + str(photos_count), level=2)
#item_count = item_count + 1
movie_watched_count = movie_count - movie_unwatched_count
musicvideos_watched_count = musicvideos_count - musicvideos_unwatched_count
episode_watched_count = episode_count - episode_unwatched_count
music_songs_played_count = music_songs_count - music_songs_unplayed_count
trailers_watched_count = trailers_count - trailers_unwatched_count
WINDOW.setProperty("MB3TotalMovies", str(movie_count))
WINDOW.setProperty("MB3TotalUnWatchedMovies", str(movie_unwatched_count))
WINDOW.setProperty("MB3TotalWatchedMovies", str(movie_watched_count))
WINDOW.setProperty("MB3TotalMusicVideos", str(musicvideos_count))
#.........这里部分代码省略.........