mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-11-10 04:06:11 +00:00
Add https support
This commit is contained in:
parent
d737af606b
commit
5f91d49f3f
9 changed files with 218 additions and 267 deletions
|
@ -327,17 +327,17 @@ class API():
|
||||||
if totalbackdrops != 0:
|
if totalbackdrops != 0:
|
||||||
index = str(randrange(0,totalbackdrops))
|
index = str(randrange(0,totalbackdrops))
|
||||||
# use the local image proxy server that is made available by this addons service
|
# use the local image proxy server that is made available by this addons service
|
||||||
|
# Load user information set by UserClient
|
||||||
port = addonSettings.getSetting('port')
|
WINDOW = xbmcgui.Window(10000)
|
||||||
host = addonSettings.getSetting('ipaddress')
|
username = WINDOW.getProperty('currUser')
|
||||||
server = host + ":" + port
|
server = WINDOW.getProperty('server%s' % username)
|
||||||
|
|
||||||
if addonSettings.getSetting('compressArt')=='true':
|
if addonSettings.getSetting('compressArt')=='true':
|
||||||
query = query + "&Quality=90"
|
query = query + "&Quality=90"
|
||||||
|
|
||||||
if imageTag == None:
|
if imageTag == None:
|
||||||
imageTag = "e3ab56fe27d389446754d0fb04910a34"
|
imageTag = "e3ab56fe27d389446754d0fb04910a34"
|
||||||
artwork = "http://" + server + "/mediabrowser/Items/" + str(id) + "/Images/" + type + "/" + index + "/" + imageTag + "/original/" + width + "/" + height + "/" + played + "?" + query
|
artwork = "%s/mediabrowser/Items/%s/Images/%s/%s/%s/original/%s/%s/%s?%s" % (server, id, type, index, imageTag, width, height, played, query)
|
||||||
if addonSettings.getSetting('disableCoverArt')=='true':
|
if addonSettings.getSetting('disableCoverArt')=='true':
|
||||||
artwork = artwork + "&EnableImageEnhancers=false"
|
artwork = artwork + "&EnableImageEnhancers=false"
|
||||||
|
|
||||||
|
@ -353,12 +353,13 @@ class API():
|
||||||
|
|
||||||
def getUserArtwork(self, data, type, index = "0"):
|
def getUserArtwork(self, data, type, index = "0"):
|
||||||
|
|
||||||
addonSettings = xbmcaddon.Addon(id='plugin.video.emby')
|
# Load user information set by UserClient
|
||||||
|
WINDOW = xbmcgui.Window(10000)
|
||||||
|
username = WINDOW.getProperty('currUser')
|
||||||
|
server = WINDOW.getProperty('server%s' % username)
|
||||||
id = data.get("Id")
|
id = data.get("Id")
|
||||||
port = addonSettings.getSetting('port')
|
|
||||||
host = addonSettings.getSetting('ipaddress')
|
artwork = "%s/mediabrowser/Users/%s/Images/%s?Format=original" % (server, id, type)
|
||||||
server = host + ":" + port
|
|
||||||
artwork = "http://" + server + "/mediabrowser/Users/" + str(id) + "/Images/" + type + "?Format=original"
|
|
||||||
|
|
||||||
return artwork
|
return artwork
|
||||||
|
|
|
@ -101,13 +101,12 @@ class DownloadUtils():
|
||||||
self.logMsg("postcapabilities called")
|
self.logMsg("postcapabilities called")
|
||||||
|
|
||||||
# Set Capabilities
|
# Set Capabilities
|
||||||
mb3Port = self.addonSettings.getSetting('port')
|
server = self.getServer()
|
||||||
mb3Host = self.addonSettings.getSetting('ipaddress')
|
|
||||||
clientInfo = ClientInformation()
|
clientInfo = ClientInformation()
|
||||||
machineId = clientInfo.getMachineId()
|
machineId = clientInfo.getMachineId()
|
||||||
|
|
||||||
# get session id
|
# get session id
|
||||||
url = "http://" + mb3Host + ":" + mb3Port + "/mediabrowser/Sessions?DeviceId=" + machineId + "&format=json"
|
url = "%s/mediabrowser/Sessions?DeviceId=%s&format=json" % (server, machineId)
|
||||||
self.logMsg("Session URL : " + url);
|
self.logMsg("Session URL : " + url);
|
||||||
jsonData = self.downloadUrl(url)
|
jsonData = self.downloadUrl(url)
|
||||||
self.logMsg("Session JsonData : " + jsonData)
|
self.logMsg("Session JsonData : " + jsonData)
|
||||||
|
@ -122,7 +121,7 @@ class DownloadUtils():
|
||||||
#supportedCommands = "Play,Playstate,DisplayContent,GoHome,SendString,GoToSettings,DisplayMessage,PlayNext"
|
#supportedCommands = "Play,Playstate,DisplayContent,GoHome,SendString,GoToSettings,DisplayMessage,PlayNext"
|
||||||
supportedCommands = "Play,Playstate,SendString,DisplayMessage,PlayNext"
|
supportedCommands = "Play,Playstate,SendString,DisplayMessage,PlayNext"
|
||||||
|
|
||||||
url = "http://" + mb3Host + ":" + mb3Port + "/mediabrowser/Sessions/Capabilities?Id=" + sessionId + "&PlayableMediaTypes=" + playableMediaTypes + "&SupportedCommands=" + supportedCommands + "&SupportsMediaControl=True"
|
url = "%s/mediabrowser/Sessions/Capabilities?Id=%s&PlayableMediaTypes=%s&SupportedCommands=%s&SupportsMediaControl=True" % (server, sessionId, playableMediaTypes, supportedCommands)
|
||||||
postData = {}
|
postData = {}
|
||||||
#postData["Id"] = sessionId;
|
#postData["Id"] = sessionId;
|
||||||
#postData["PlayableMediaTypes"] = "Video";
|
#postData["PlayableMediaTypes"] = "Video";
|
||||||
|
@ -133,89 +132,6 @@ class DownloadUtils():
|
||||||
|
|
||||||
self.downloadUrl(url, postBody=stringdata, type="POST")
|
self.downloadUrl(url, postBody=stringdata, type="POST")
|
||||||
|
|
||||||
'''def authenticate(self, retreive=True):
|
|
||||||
|
|
||||||
WINDOW = xbmcgui.Window(10000)
|
|
||||||
self.addonSettings = xbmcaddon.Addon(id='plugin.video.emby')
|
|
||||||
username = self.addonSettings.getSetting('username')
|
|
||||||
|
|
||||||
token = WINDOW.getProperty("AccessToken" + username)
|
|
||||||
if(token != None and token != ""):
|
|
||||||
self.logMsg("DownloadUtils -> Returning saved (WINDOW) AccessToken for user:" + username + " token:" + token,2)
|
|
||||||
return token
|
|
||||||
|
|
||||||
token = self.addonSettings.getSetting("AccessToken" + username)
|
|
||||||
if(token != None and token != ""):
|
|
||||||
WINDOW.setProperty("AccessToken" + username, token)
|
|
||||||
self.logMsg("DownloadUtils -> Returning saved (SETTINGS) AccessToken for user:" + username + " token:" + token,2)
|
|
||||||
return token
|
|
||||||
|
|
||||||
port = self.addonSettings.getSetting("port")
|
|
||||||
host = self.addonSettings.getSetting("ipaddress")
|
|
||||||
if(host == None or host == "" or host == "<none>" or port == None or port == ""):
|
|
||||||
return ""
|
|
||||||
|
|
||||||
if(retreive == False):
|
|
||||||
return ""
|
|
||||||
|
|
||||||
url = "http://" + host + ":" + port + "/mediabrowser/Users/AuthenticateByName?format=json"
|
|
||||||
|
|
||||||
clientInfo = ClientInformation()
|
|
||||||
txt_mac = clientInfo.getMachineId()
|
|
||||||
version = clientInfo.getVersion()
|
|
||||||
|
|
||||||
# get user info
|
|
||||||
jsonData = self.downloadUrl("http://" + host + ":" + port + "/mediabrowser/Users/Public?format=json", authenticate=False)
|
|
||||||
users = []
|
|
||||||
if(jsonData != ""):
|
|
||||||
users = json.loads(jsonData)
|
|
||||||
userHasPassword = False
|
|
||||||
for user in users:
|
|
||||||
name = user.get("Name")
|
|
||||||
if(username == name):
|
|
||||||
if(user.get("HasPassword") == True):
|
|
||||||
userHasPassword = True
|
|
||||||
break
|
|
||||||
|
|
||||||
password = ""
|
|
||||||
if(userHasPassword):
|
|
||||||
password = xbmcgui.Dialog().input("Enter Password for user : " + username)
|
|
||||||
|
|
||||||
if (password != ""):
|
|
||||||
sha1 = hashlib.sha1(password)
|
|
||||||
sha1 = sha1.hexdigest()
|
|
||||||
else:
|
|
||||||
sha1 = 'da39a3ee5e6b4b0d3255bfef95601890afd80709'
|
|
||||||
|
|
||||||
messageData = "username=" + username + "&password=" + sha1
|
|
||||||
|
|
||||||
resp = self.downloadUrl(url, postBody=messageData, type="POST", authenticate=False)
|
|
||||||
|
|
||||||
result = None
|
|
||||||
accessToken = None
|
|
||||||
try:
|
|
||||||
xbmc.log("Auth_Reponce: " + str(resp))
|
|
||||||
result = json.loads(resp)
|
|
||||||
accessToken = result.get("AccessToken")
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
if(result != None and accessToken != None):
|
|
||||||
userID = result.get("User").get("Id")
|
|
||||||
self.logMsg("User Authenticated : " + accessToken)
|
|
||||||
WINDOW.setProperty("AccessToken" + username, accessToken)
|
|
||||||
WINDOW.setProperty("userid" + username, userID)
|
|
||||||
self.addonSettings.setSetting("AccessToken" + username, accessToken)
|
|
||||||
self.addonSettings.setSetting("userid" + username, userID)
|
|
||||||
return accessToken
|
|
||||||
else:
|
|
||||||
self.logMsg("User NOT Authenticated")
|
|
||||||
WINDOW.setProperty("AccessToken" + username, "")
|
|
||||||
WINDOW.setProperty("userid" + username, "")
|
|
||||||
self.addonSettings.setSetting("AccessToken" + username, "")
|
|
||||||
self.addonSettings.setSetting("userid" + username, "")
|
|
||||||
return "" '''
|
|
||||||
|
|
||||||
def imageUrl(self, id, type, index, width, height):
|
def imageUrl(self, id, type, index, width, height):
|
||||||
|
|
||||||
server = self.getServer()
|
server = self.getServer()
|
||||||
|
|
|
@ -25,9 +25,6 @@ class Kodi_Monitor(xbmc.Monitor):
|
||||||
#as well as detect when a library item has been deleted to pass the delete to the Emby server
|
#as well as detect when a library item has been deleted to pass the delete to the Emby server
|
||||||
def onNotification (self,sender,method,data):
|
def onNotification (self,sender,method,data):
|
||||||
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
port = addon.getSetting('port')
|
|
||||||
host = addon.getSetting('ipaddress')
|
|
||||||
server = host + ":" + port
|
|
||||||
downloadUtils = DownloadUtils()
|
downloadUtils = DownloadUtils()
|
||||||
print "onNotification:" + method + ":" + sender + ":" + str(data)
|
print "onNotification:" + method + ":" + sender + ":" + str(data)
|
||||||
#player started playing an item -
|
#player started playing an item -
|
||||||
|
@ -45,16 +42,20 @@ class Kodi_Monitor(xbmc.Monitor):
|
||||||
|
|
||||||
WINDOW = xbmcgui.Window( 10000 )
|
WINDOW = xbmcgui.Window( 10000 )
|
||||||
|
|
||||||
userid = downloadUtils.getUserId()
|
username = WINDOW.getProperty('currUser')
|
||||||
jsonData = downloadUtils.downloadUrl("http://" + server + "/mediabrowser/Users/" + userid + "/Items/" + embyid + "?format=json&ImageTypeLimit=1", suppress=False, popup=1 )
|
userid = WINDOW.getProperty('userId%s' % username)
|
||||||
|
server = WINDOW.getProperty('server%s' % username)
|
||||||
|
|
||||||
|
url = "%s/mediabrowser/Users/%s/Items/%s?format=json&ImageTypeLimit=1" % (server, userid, embyid)
|
||||||
|
jsonData = downloadUtils.downloadUrl(url, suppress=False, popup=1 )
|
||||||
result = json.loads(jsonData)
|
result = json.loads(jsonData)
|
||||||
userData = result.get("UserData")
|
userData = result.get("UserData")
|
||||||
|
|
||||||
playurl = PlayUtils().getPlayUrl(server, embyid, result)
|
playurl = PlayUtils().getPlayUrl(server, embyid, result)
|
||||||
|
|
||||||
watchedurl = 'http://' + server + '/mediabrowser/Users/'+ userid + '/PlayedItems/' + embyid
|
watchedurl = "%s/mediabrowser/Users/%s/PlayedItems/%s" % (server, userid, embyid)
|
||||||
positionurl = 'http://' + server + '/mediabrowser/Users/'+ userid + '/PlayingItems/' + embyid
|
positionurl = "%s/mediabrowser/Users/%s/PlayingItems/%s" % (server, userid, embyid)
|
||||||
deleteurl = 'http://' + server + '/mediabrowser/Items/' + embyid
|
deleteurl = "%s/mediabrowser/Items/%s" % (server, embyid)
|
||||||
|
|
||||||
# set the current playing info
|
# set the current playing info
|
||||||
WINDOW.setProperty(playurl+"watchedurl", watchedurl)
|
WINDOW.setProperty(playurl+"watchedurl", watchedurl)
|
||||||
|
|
|
@ -23,7 +23,11 @@ clientInfo = ClientInformation()
|
||||||
class PlayUtils():
|
class PlayUtils():
|
||||||
|
|
||||||
def getPlayUrl(self, server, id, result):
|
def getPlayUrl(self, server, id, result):
|
||||||
|
|
||||||
|
WINDOW = xbmcgui.Window(10000)
|
||||||
|
username = WINDOW.getProperty('currUser')
|
||||||
|
server = WINDOW.getProperty('server%s' % username)
|
||||||
|
|
||||||
addonSettings = xbmcaddon.Addon(id='plugin.video.emby')
|
addonSettings = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
# if the path is local and depending on the video quality play we can direct play it do so-
|
# if the path is local and depending on the video quality play we can direct play it do so-
|
||||||
if self.isDirectPlay(result) == True:
|
if self.isDirectPlay(result) == True:
|
||||||
|
@ -47,7 +51,7 @@ class PlayUtils():
|
||||||
if ("apple.com" in playurl):
|
if ("apple.com" in playurl):
|
||||||
playurl += '?|User-Agent=%s' % USER_AGENT
|
playurl += '?|User-Agent=%s' % USER_AGENT
|
||||||
if addonSettings.getSetting('playFromStream') == "true":
|
if addonSettings.getSetting('playFromStream') == "true":
|
||||||
playurl = 'http://' + server + '/mediabrowser/Videos/' + id + '/stream?static=true'
|
playurl = "%s/mediabrowser/Videos/%s/stream?static=true" % (server, id)
|
||||||
mediaSources = result.get("MediaSources")
|
mediaSources = result.get("MediaSources")
|
||||||
if(mediaSources != None):
|
if(mediaSources != None):
|
||||||
if mediaSources[0].get('DefaultAudioStreamIndex') != None:
|
if mediaSources[0].get('DefaultAudioStreamIndex') != None:
|
||||||
|
@ -58,10 +62,10 @@ class PlayUtils():
|
||||||
else:
|
else:
|
||||||
#No path or has a path but not sufficient network so transcode
|
#No path or has a path but not sufficient network so transcode
|
||||||
if result.get("Type") == "Audio":
|
if result.get("Type") == "Audio":
|
||||||
playurl = 'http://' + server + '/mediabrowser/Audio/' + id + '/stream.mp3'
|
playurl = "%s/mediabrowser/Audio/%s/stream.mp3" % (server, id)
|
||||||
else:
|
else:
|
||||||
txt_mac = clientInfo.getMachineId()
|
txt_mac = clientInfo.getMachineId()
|
||||||
playurl = 'http://' + server + '/mediabrowser/Videos/' + id + '/master.m3u8?mediaSourceId=' + id
|
playurl = "%s/mediabrowser/Videos/%s/master.m3u8?mediaSourceId=%s" % (server, id, id)
|
||||||
playurl = playurl + '&videoCodec=h264'
|
playurl = playurl + '&videoCodec=h264'
|
||||||
playurl = playurl + '&AudioCodec=aac,ac3'
|
playurl = playurl + '&AudioCodec=aac,ac3'
|
||||||
playurl = playurl + '&deviceId=' + txt_mac
|
playurl = playurl + '&deviceId=' + txt_mac
|
||||||
|
@ -87,7 +91,7 @@ class PlayUtils():
|
||||||
#xbmc.log("emby isDirectPlay MediaStreams codecs: %s forceTranscodingCodecs: %s, common: %s" % (codecs, forceTranscodingCodecsSet, commonCodecs))
|
#xbmc.log("emby isDirectPlay MediaStreams codecs: %s forceTranscodingCodecs: %s, common: %s" % (codecs, forceTranscodingCodecsSet, commonCodecs))
|
||||||
if commonCodecs:
|
if commonCodecs:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if (self.fileExists(result) or (result.get("LocationType") == "FileSystem" and self.isNetworkQualitySufficient(result) == True and self.isLocalPath(result) == False)):
|
if (self.fileExists(result) or (result.get("LocationType") == "FileSystem" and self.isNetworkQualitySufficient(result) == True and self.isLocalPath(result) == False)):
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
|
@ -178,5 +182,4 @@ class PlayUtils():
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# default to not local
|
# default to not local
|
||||||
return False
|
return False
|
||||||
|
|
|
@ -37,12 +37,14 @@ class PlaybackUtils():
|
||||||
|
|
||||||
def PLAY(self, id):
|
def PLAY(self, id):
|
||||||
xbmc.log("PLAY Called")
|
xbmc.log("PLAY Called")
|
||||||
port = addon.getSetting('port')
|
WINDOW = xbmcgui.Window(10000)
|
||||||
host = addon.getSetting('ipaddress')
|
|
||||||
server = host + ":" + port
|
username = WINDOW.getProperty('currUser')
|
||||||
|
userid = WINDOW.getProperty('userId%s' % username)
|
||||||
|
server = WINDOW.getProperty('server%s' % username)
|
||||||
|
|
||||||
userid = self.downloadUtils.getUserId()
|
url = "%s/mediabrowser/Users/%s/Items/%s?format=json&ImageTypeLimit=1" % (server, userid, id)
|
||||||
jsonData = self.downloadUtils.downloadUrl("http://" + server + "/mediabrowser/Users/" + userid + "/Items/" + id + "?format=json&ImageTypeLimit=1", suppress=False, popup=1 )
|
jsonData = self.downloadUtils.downloadUrl(url, suppress=False, popup=1 )
|
||||||
result = json.loads(jsonData)
|
result = json.loads(jsonData)
|
||||||
|
|
||||||
userData = result.get("UserData")
|
userData = result.get("UserData")
|
||||||
|
@ -85,9 +87,9 @@ class PlaybackUtils():
|
||||||
if (result.get("LocationType") == "Virtual"):
|
if (result.get("LocationType") == "Virtual"):
|
||||||
xbmcgui.Dialog().ok(self.language(30128), self.language(30129))
|
xbmcgui.Dialog().ok(self.language(30128), self.language(30129))
|
||||||
|
|
||||||
watchedurl = 'http://' + server + '/mediabrowser/Users/'+ userid + '/PlayedItems/' + id
|
watchedurl = "%s/mediabrowser/Users/%s/PlayedItems/%s" % (server, userid, id)
|
||||||
positionurl = 'http://' + server + '/mediabrowser/Users/'+ userid + '/PlayingItems/' + id
|
positionurl = "%s/mediabrowser/Users/%s/PlayingItems/%s" % (server, userid, id)
|
||||||
deleteurl = 'http://' + server + '/mediabrowser/Items/' + id
|
deleteurl = "%s/mediabrowser/Items/%s" % (server, id)
|
||||||
|
|
||||||
# set the current playing info
|
# set the current playing info
|
||||||
WINDOW.setProperty(playurl+"watchedurl", watchedurl)
|
WINDOW.setProperty(playurl+"watchedurl", watchedurl)
|
||||||
|
@ -201,7 +203,7 @@ class PlaybackUtils():
|
||||||
details["season"] = str(seasonNum)
|
details["season"] = str(seasonNum)
|
||||||
|
|
||||||
if tvshowTitle != None:
|
if tvshowTitle != None:
|
||||||
details["TVShowTitle"] = tvshowTitle
|
details["TVShowTitle"] = tvshowTitle
|
||||||
|
|
||||||
listItem.setInfo( "Video", infoLabels=details )
|
listItem.setInfo( "Video", infoLabels=details )
|
||||||
|
|
||||||
|
@ -241,8 +243,11 @@ class PlaybackUtils():
|
||||||
def PLAYAllItems(self, items, startPositionTicks):
|
def PLAYAllItems(self, items, startPositionTicks):
|
||||||
utils.logMsg("PlayBackUtils", "== ENTER: PLAYAllItems ==")
|
utils.logMsg("PlayBackUtils", "== ENTER: PLAYAllItems ==")
|
||||||
utils.logMsg("PlayBackUtils", "Items : " + str(items))
|
utils.logMsg("PlayBackUtils", "Items : " + str(items))
|
||||||
userid = self.downloadUtils.getUserId()
|
WINDOW = xbmcgui.Window(10000)
|
||||||
server = self.downloadUtils.getServer()
|
|
||||||
|
username = WINDOW.getProperty('currUser')
|
||||||
|
userid = WINDOW.getProperty('userId%s' % username)
|
||||||
|
server = WINDOW.getProperty('server%s' % username)
|
||||||
|
|
||||||
playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
|
playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
|
||||||
playlist.clear()
|
playlist.clear()
|
||||||
|
@ -251,9 +256,9 @@ class PlaybackUtils():
|
||||||
for itemID in items:
|
for itemID in items:
|
||||||
|
|
||||||
utils.logMsg("PlayBackUtils", "Adding Item to Playlist : " + itemID)
|
utils.logMsg("PlayBackUtils", "Adding Item to Playlist : " + itemID)
|
||||||
item_url = server + "/mediabrowser/Users/" + userid + "/Items/" + itemID + "?format=json"
|
item_url = "%s/mediabrowser/Users/%s/Items/%s?format=json" % (server, userid, itemID)
|
||||||
jsonData = self.downloadUtils.downloadUrl(item_url, suppress=False, popup=1 )
|
jsonData = self.downloadUtils.downloadUrl(item_url, suppress=False, popup=1 )
|
||||||
|
|
||||||
item_data = json.loads(jsonData)
|
item_data = json.loads(jsonData)
|
||||||
added = self.addPlaylistItem(playlist, item_data, server, userid)
|
added = self.addPlaylistItem(playlist, item_data, server, userid)
|
||||||
if(added and started == False):
|
if(added and started == False):
|
||||||
|
@ -274,15 +279,18 @@ class PlaybackUtils():
|
||||||
self.seekToPosition(seekTime)
|
self.seekToPosition(seekTime)
|
||||||
|
|
||||||
def PLAYAllEpisodes(self, items):
|
def PLAYAllEpisodes(self, items):
|
||||||
userid = self.downloadUtils.getUserId()
|
WINDOW = xbmcgui.Window(10000)
|
||||||
server = self.downloadUtils.getServer()
|
|
||||||
|
username = WINDOW.getProperty('currUser')
|
||||||
|
userid = WINDOW.getProperty('userId%s' % username)
|
||||||
|
server = WINDOW.getProperty('server%s' % username)
|
||||||
|
|
||||||
playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
|
playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
|
||||||
playlist.clear()
|
playlist.clear()
|
||||||
|
|
||||||
for item in items:
|
for item in items:
|
||||||
|
|
||||||
item_url = server + "/mediabrowser/Users/" + userid + "/Items/" + item["Id"] + "?format=json&ImageTypeLimit=1"
|
item_url = "%s/mediabrowser/Users/%s/Items/%s?format=json&ImageTypeLimit=1" % (server, userid, item["Id"])
|
||||||
jsonData = self.downloadUtils.downloadUrl(item_url, suppress=False, popup=1 )
|
jsonData = self.downloadUtils.downloadUrl(item_url, suppress=False, popup=1 )
|
||||||
|
|
||||||
item_data = json.loads(jsonData)
|
item_data = json.loads(jsonData)
|
||||||
|
@ -292,15 +300,18 @@ class PlaybackUtils():
|
||||||
|
|
||||||
def AddToPlaylist(self, itemIds):
|
def AddToPlaylist(self, itemIds):
|
||||||
utils.logMsg("PlayBackUtils", "== ENTER: PLAYAllItems ==")
|
utils.logMsg("PlayBackUtils", "== ENTER: PLAYAllItems ==")
|
||||||
userid = self.downloadUtils.getUserId()
|
WINDOW = xbmcgui.Window(10000)
|
||||||
server = self.downloadUtils.getServer()
|
|
||||||
|
username = WINDOW.getProperty('currUser')
|
||||||
|
userid = WINDOW.getProperty('userId%s' % username)
|
||||||
|
server = WINDOW.getProperty('server%s' % username)
|
||||||
|
|
||||||
playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
|
playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
|
||||||
|
|
||||||
for itemID in itemIds:
|
for itemID in itemIds:
|
||||||
|
|
||||||
utils.logMsg("PlayBackUtils", "Adding Item to Playlist : " + itemID)
|
utils.logMsg("PlayBackUtils", "Adding Item to Playlist : " + itemID)
|
||||||
item_url = server + "/mediabrowser/Users/" + userid + "/Items/" + itemID + "?format=json"
|
item_url = "%s/mediabrowser/Users/%s/Items/%s?format=json" % (server, userid, itemID)
|
||||||
jsonData = self.downloadUtils.downloadUrl(item_url, suppress=False, popup=1 )
|
jsonData = self.downloadUtils.downloadUrl(item_url, suppress=False, popup=1 )
|
||||||
|
|
||||||
item_data = json.loads(jsonData)
|
item_data = json.loads(jsonData)
|
||||||
|
@ -318,6 +329,12 @@ class PlaybackUtils():
|
||||||
listItem = xbmcgui.ListItem(path=playurl, iconImage=thumbPath, thumbnailImage=thumbPath)
|
listItem = xbmcgui.ListItem(path=playurl, iconImage=thumbPath, thumbnailImage=thumbPath)
|
||||||
self.setListItemProps(server, id, listItem, item)
|
self.setListItemProps(server, id, listItem, item)
|
||||||
|
|
||||||
|
WINDOW = xbmcgui.Window(10000)
|
||||||
|
|
||||||
|
username = WINDOW.getProperty('currUser')
|
||||||
|
userid = WINDOW.getProperty('userId%s' % username)
|
||||||
|
server = WINDOW.getProperty('server%s' % username)
|
||||||
|
|
||||||
# Can not play virtual items
|
# Can not play virtual items
|
||||||
if (item.get("LocationType") == "Virtual") or (item.get("IsPlaceHolder") == True):
|
if (item.get("LocationType") == "Virtual") or (item.get("IsPlaceHolder") == True):
|
||||||
|
|
||||||
|
@ -326,9 +343,9 @@ class PlaybackUtils():
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
||||||
watchedurl = 'http://' + server + '/mediabrowser/Users/'+ userid + '/PlayedItems/' + id
|
watchedurl = "%s/mediabrowser/Users/%s/PlayedItems/%s" % (server, userid, id)
|
||||||
positionurl = 'http://' + server + '/mediabrowser/Users/'+ userid + '/PlayingItems/' + id
|
positionurl = "%s/mediabrowser/Users/%s/PlayingItems/%s" % (server, userid, id)
|
||||||
deleteurl = 'http://' + server + '/mediabrowser/Items/' + id
|
deleteurl = "%s/mediabrowser/Items/%s" % (server, id)
|
||||||
|
|
||||||
# set the current playing info
|
# set the current playing info
|
||||||
WINDOW = xbmcgui.Window( 10000 )
|
WINDOW = xbmcgui.Window( 10000 )
|
||||||
|
|
|
@ -94,11 +94,14 @@ class Player( xbmc.Player ):
|
||||||
|
|
||||||
|
|
||||||
self.played_information.clear()
|
self.played_information.clear()
|
||||||
|
WINDOW = xbmcgui.Window(10000)
|
||||||
|
username = WINDOW.getProperty('currUser')
|
||||||
|
server = WINDOW.getProperty('server%s' % username)
|
||||||
|
|
||||||
# stop transcoding - todo check we are actually transcoding?
|
# stop transcoding - todo check we are actually transcoding?
|
||||||
clientInfo = ClientInformation()
|
clientInfo = ClientInformation()
|
||||||
txt_mac = clientInfo.getMachineId()
|
txt_mac = clientInfo.getMachineId()
|
||||||
url = ("http://%s:%s/mediabrowser/Videos/ActiveEncodings" % (addonSettings.getSetting('ipaddress'), addonSettings.getSetting('port')))
|
url = "%s/mediabrowser/Videos/ActiveEncodings" % server
|
||||||
url = url + '?DeviceId=' + txt_mac
|
url = url + '?DeviceId=' + txt_mac
|
||||||
self.downloadUtils.downloadUrl(url, type="DELETE")
|
self.downloadUtils.downloadUrl(url, type="DELETE")
|
||||||
|
|
||||||
|
@ -112,8 +115,12 @@ class Player( xbmc.Player ):
|
||||||
playMethod = data.get("playmethod")
|
playMethod = data.get("playmethod")
|
||||||
currentPosition = data.get("currentPosition")
|
currentPosition = data.get("currentPosition")
|
||||||
positionTicks = str(int(currentPosition * 10000000))
|
positionTicks = str(int(currentPosition * 10000000))
|
||||||
|
|
||||||
url = ("http://%s:%s/mediabrowser/Sessions/Playing/Stopped" % (addonSettings.getSetting('ipaddress'), addonSettings.getSetting('port')))
|
WINDOW = xbmcgui.Window(10000)
|
||||||
|
username = WINDOW.getProperty('currUser')
|
||||||
|
server = WINDOW.getProperty('server%s' % username)
|
||||||
|
|
||||||
|
url = "%s/mediabrowser/Sessions/Playing/Stopped" % server
|
||||||
|
|
||||||
url = url + "?itemId=" + item_id
|
url = url + "?itemId=" + item_id
|
||||||
|
|
||||||
|
@ -150,8 +157,12 @@ class Player( xbmc.Player ):
|
||||||
subtitleindex = data.get("SubtitleStreamIndex")
|
subtitleindex = data.get("SubtitleStreamIndex")
|
||||||
playMethod = data.get("playmethod")
|
playMethod = data.get("playmethod")
|
||||||
paused = data.get("paused")
|
paused = data.get("paused")
|
||||||
|
|
||||||
|
WINDOW = xbmcgui.Window(10000)
|
||||||
|
username = WINDOW.getProperty('currUser')
|
||||||
|
server = WINDOW.getProperty('server%s' % username)
|
||||||
|
|
||||||
url = ("http://%s:%s/mediabrowser/Sessions/Playing/Progress" % (addonSettings.getSetting('ipaddress'), addonSettings.getSetting('port')))
|
url = "%s/mediabrowser/Sessions/Playing/Progress" % server
|
||||||
|
|
||||||
url = url + "?itemId=" + item_id
|
url = url + "?itemId=" + item_id
|
||||||
|
|
||||||
|
@ -229,9 +240,12 @@ class Player( xbmc.Player ):
|
||||||
if(item_id == None or len(item_id) == 0):
|
if(item_id == None or len(item_id) == 0):
|
||||||
self.printDebug("emby Service -> onPlayBackStarted : No info for current playing file", 0)
|
self.printDebug("emby Service -> onPlayBackStarted : No info for current playing file", 0)
|
||||||
return
|
return
|
||||||
|
|
||||||
url = ("http://%s:%s/mediabrowser/Sessions/Playing" % (addonSettings.getSetting('ipaddress'), addonSettings.getSetting('port')))
|
username = WINDOW.getProperty('currUser')
|
||||||
|
server = WINDOW.getProperty('server%s' % username)
|
||||||
|
|
||||||
|
url = "%s/mediabrowser/Sessions/Playing" % server
|
||||||
|
|
||||||
url = url + "?itemId=" + item_id
|
url = url + "?itemId=" + item_id
|
||||||
|
|
||||||
url = url + "&canSeek=true"
|
url = url + "&canSeek=true"
|
||||||
|
@ -296,11 +310,10 @@ class Player( xbmc.Player ):
|
||||||
id = WINDOW.getProperty("virtualstrm")
|
id = WINDOW.getProperty("virtualstrm")
|
||||||
type = WINDOW.getProperty("virtualstrmtype")
|
type = WINDOW.getProperty("virtualstrmtype")
|
||||||
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
port = addon.getSetting('port')
|
username = WINDOW.getProperty('currUser')
|
||||||
host = addon.getSetting('ipaddress')
|
userid = WINDOW.getProperty('userId%s' % username)
|
||||||
server = host + ":" + port
|
server = WINDOW.getProperty('server%s' % username)
|
||||||
userid = self.downloadUtils.getUserId()
|
watchedurl = "%s/mediabrowser/Users/%s/PlayedItems/%s" % (server, userid, id)
|
||||||
watchedurl = 'http://' + server + '/mediabrowser/Users/' + userid + '/PlayedItems/' + id
|
|
||||||
self.downloadUtils.downloadUrl(watchedurl, postBody="", type="POST")
|
self.downloadUtils.downloadUrl(watchedurl, postBody="", type="POST")
|
||||||
librarySync.updatePlayCount(id,type)
|
librarySync.updatePlayCount(id,type)
|
||||||
except: pass
|
except: pass
|
||||||
|
@ -327,17 +340,18 @@ class Player( xbmc.Player ):
|
||||||
|
|
||||||
# if its an episode see if autoplay is enabled
|
# if its an episode see if autoplay is enabled
|
||||||
if addonSettings.getSetting("autoPlaySeason")=="true" and type=="Episode":
|
if addonSettings.getSetting("autoPlaySeason")=="true" and type=="Episode":
|
||||||
port = addonSettings.getSetting('port')
|
WINDOW = xbmcgui.Window( 10000 )
|
||||||
host = addonSettings.getSetting('ipaddress')
|
username = WINDOW.getProperty('currUser')
|
||||||
server = host + ":" + port
|
userid = WINDOW.getProperty('userId%s' % username)
|
||||||
userid = self.downloadUtils.getUserId()
|
server = WINDOW.getProperty('server%s' % username)
|
||||||
# add remaining unplayed episodes if applicable
|
# add remaining unplayed episodes if applicable
|
||||||
MB3Episode = ReadEmbyDB().getItem(item_id)
|
MB3Episode = ReadEmbyDB().getItem(item_id)
|
||||||
userData = MB3Episode["UserData"]
|
userData = MB3Episode["UserData"]
|
||||||
if userData!=None and userData["Played"]==True:
|
if userData!=None and userData["Played"]==True:
|
||||||
pDialog = xbmcgui.DialogProgress()
|
pDialog = xbmcgui.DialogProgress()
|
||||||
seasonId = MB3Episode["SeasonId"]
|
seasonId = MB3Episode["SeasonId"]
|
||||||
jsonData = self.downloadUtils.downloadUrl("http://" + server + "/mediabrowser/Users/" + userid + "/Items?ParentId=" + seasonId + "&ImageTypeLimit=1&Limit=1&SortBy=SortName&SortOrder=Ascending&Filters=IsUnPlayed&IncludeItemTypes=Episode&IsVirtualUnaired=false&Recursive=true&IsMissing=False&format=json", suppress=False, popup=1 )
|
url = "%s/mediabrowser/Users/%s/Items?ParentId=%s&ImageTypeLimit=1&Limit=1&SortBy=SortName&SortOrder=Ascending&Filters=IsUnPlayed&IncludeItemTypes=Episode&IsVirtualUnaired=false&Recursive=true&IsMissing=False&format=json" % (server, userid, seasonId)
|
||||||
|
jsonData = self.downloadUtils.downloadUrl(url, suppress=False, popup=1 )
|
||||||
if(jsonData != ""):
|
if(jsonData != ""):
|
||||||
seasonData = json.loads(jsonData)
|
seasonData = json.loads(jsonData)
|
||||||
if seasonData.get("Items") != None:
|
if seasonData.get("Items") != None:
|
||||||
|
@ -361,6 +375,4 @@ class Player( xbmc.Player ):
|
||||||
playTime = xbmc.Player().getTime()
|
playTime = xbmc.Player().getTime()
|
||||||
totalTime = xbmc.Player().getTotalTime()
|
totalTime = xbmc.Player().getTotalTime()
|
||||||
|
|
||||||
PlaybackUtils().PLAYAllEpisodes(seasonData.get("Items"))
|
PlaybackUtils().PLAYAllEpisodes(seasonData.get("Items"))
|
||||||
|
|
||||||
|
|
|
@ -15,13 +15,12 @@ class ReadEmbyDB():
|
||||||
def getMovies(self, id, fullinfo = False, fullSync = True, itemList = []):
|
def getMovies(self, id, fullinfo = False, fullSync = True, itemList = []):
|
||||||
result = None
|
result = None
|
||||||
|
|
||||||
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
WINDOW = xbmcgui.Window(10000)
|
||||||
port = addon.getSetting('port')
|
username = WINDOW.getProperty('currUser')
|
||||||
host = addon.getSetting('ipaddress')
|
userid = WINDOW.getProperty('userId%s' % username)
|
||||||
server = host + ":" + port
|
server = WINDOW.getProperty('server%s' % username)
|
||||||
|
|
||||||
downloadUtils = DownloadUtils()
|
downloadUtils = DownloadUtils()
|
||||||
userid = downloadUtils.getUserId()
|
|
||||||
|
|
||||||
if fullSync:
|
if fullSync:
|
||||||
sortstring = "&SortBy=SortName"
|
sortstring = "&SortBy=SortName"
|
||||||
|
@ -33,9 +32,9 @@ class ReadEmbyDB():
|
||||||
sortstring = "&Limit=20&SortBy=DateCreated"
|
sortstring = "&Limit=20&SortBy=DateCreated"
|
||||||
|
|
||||||
if fullinfo:
|
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'
|
url = "%s/mediabrowser/Users/%s/items?ParentId=%s%s&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" % (server, userid, id, sortstring)
|
||||||
else:
|
else:
|
||||||
url = server + '/mediabrowser/Users/' + userid + '/items?ParentId=' + id + sortstring + '&Fields=CumulativeRunTimeTicks&Recursive=true&SortOrder=Descending&IncludeItemTypes=Movie&CollapseBoxSetItems=false&format=json&ImageTypeLimit=1'
|
url = "%s/mediabrowser/Users/%s/items?ParentId=%s%s&Fields=CumulativeRunTimeTicks&Recursive=true&SortOrder=Descending&IncludeItemTypes=Movie&CollapseBoxSetItems=false&format=json&ImageTypeLimit=1" % (server, userid, id, sortstring)
|
||||||
|
|
||||||
jsonData = downloadUtils.downloadUrl(url, suppress=False, popup=0)
|
jsonData = downloadUtils.downloadUrl(url, suppress=False, popup=0)
|
||||||
if jsonData != None and jsonData != "":
|
if jsonData != None and jsonData != "":
|
||||||
|
@ -56,13 +55,12 @@ class ReadEmbyDB():
|
||||||
def getMusicVideos(self, fullinfo = False, fullSync = True):
|
def getMusicVideos(self, fullinfo = False, fullSync = True):
|
||||||
result = None
|
result = None
|
||||||
|
|
||||||
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
WINDOW = xbmcgui.Window(10000)
|
||||||
port = addon.getSetting('port')
|
username = WINDOW.getProperty('currUser')
|
||||||
host = addon.getSetting('ipaddress')
|
userid = WINDOW.getProperty('userId%s' % username)
|
||||||
server = host + ":" + port
|
server = WINDOW.getProperty('server%s' % username)
|
||||||
|
|
||||||
downloadUtils = DownloadUtils()
|
downloadUtils = DownloadUtils()
|
||||||
userid = downloadUtils.getUserId()
|
|
||||||
|
|
||||||
if not fullSync:
|
if not fullSync:
|
||||||
sortstring = "&Limit=20&SortBy=DateCreated"
|
sortstring = "&Limit=20&SortBy=DateCreated"
|
||||||
|
@ -70,9 +68,9 @@ class ReadEmbyDB():
|
||||||
sortstring = "&SortBy=SortName"
|
sortstring = "&SortBy=SortName"
|
||||||
|
|
||||||
if fullinfo:
|
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'
|
url = "%s/mediabrowser/Users/%s/items?%s&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" % (server, userid, sortstring)
|
||||||
else:
|
else:
|
||||||
url = server + '/mediabrowser/Users/' + userid + '/items?' + sortstring + '&Fields=CumulativeRunTimeTicks&Recursive=true&SortOrder=Descending&IncludeItemTypes=MusicVideo&CollapseBoxSetItems=false&format=json&ImageTypeLimit=1'
|
url = "%s/mediabrowser/Users/%s/items?%s&Fields=CumulativeRunTimeTicks&Recursive=true&SortOrder=Descending&IncludeItemTypes=MusicVideo&CollapseBoxSetItems=false&format=json&ImageTypeLimit=1" % (server, userid, sortstring)
|
||||||
|
|
||||||
jsonData = downloadUtils.downloadUrl(url, suppress=False, popup=0)
|
jsonData = downloadUtils.downloadUrl(url, suppress=False, popup=0)
|
||||||
if jsonData != None and jsonData != "":
|
if jsonData != None and jsonData != "":
|
||||||
|
@ -85,15 +83,15 @@ class ReadEmbyDB():
|
||||||
def getItem(self, id):
|
def getItem(self, id):
|
||||||
result = None
|
result = None
|
||||||
|
|
||||||
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
WINDOW = xbmcgui.Window(10000)
|
||||||
port = addon.getSetting('port')
|
username = WINDOW.getProperty('currUser')
|
||||||
host = addon.getSetting('ipaddress')
|
userid = WINDOW.getProperty('userId%s' % username)
|
||||||
server = host + ":" + port
|
server = WINDOW.getProperty('server%s' % username)
|
||||||
|
|
||||||
downloadUtils = DownloadUtils()
|
downloadUtils = DownloadUtils()
|
||||||
userid = downloadUtils.getUserId()
|
|
||||||
|
|
||||||
jsonData = downloadUtils.downloadUrl("http://" + server + "/mediabrowser/Users/" + userid + "/Items/" + id + "?format=json&ImageTypeLimit=1", suppress=False, popup=1 )
|
url = "%s/mediabrowser/Users/%s/Items/%s?format=json&ImageTypeLimit=1" % (server, userid, id)
|
||||||
|
jsonData = downloadUtils.downloadUrl(url, suppress=False, popup=1 )
|
||||||
if jsonData != None and jsonData != "":
|
if jsonData != None and jsonData != "":
|
||||||
result = json.loads(jsonData)
|
result = json.loads(jsonData)
|
||||||
|
|
||||||
|
@ -102,15 +100,15 @@ class ReadEmbyDB():
|
||||||
def getFullItem(self, id):
|
def getFullItem(self, id):
|
||||||
result = None
|
result = None
|
||||||
|
|
||||||
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
WINDOW = xbmcgui.Window(10000)
|
||||||
port = addon.getSetting('port')
|
username = WINDOW.getProperty('currUser')
|
||||||
host = addon.getSetting('ipaddress')
|
userid = WINDOW.getProperty('userId%s' % username)
|
||||||
server = host + ":" + port
|
server = WINDOW.getProperty('server%s' % username)
|
||||||
|
|
||||||
downloadUtils = DownloadUtils()
|
downloadUtils = DownloadUtils()
|
||||||
userid = downloadUtils.getUserId()
|
|
||||||
|
|
||||||
jsonData = downloadUtils.downloadUrl("http://" + server + "/mediabrowser/Users/" + userid + "/Items/" + id + "?format=json", suppress=False, popup=1 )
|
url = "%s/mediabrowser/Users/%s/Items/%s?format=json" % (server, userid, id)
|
||||||
|
jsonData = downloadUtils.downloadUrl(url, suppress=False, popup=1 )
|
||||||
if jsonData != None and jsonData != "":
|
if jsonData != None and jsonData != "":
|
||||||
result = json.loads(jsonData)
|
result = json.loads(jsonData)
|
||||||
|
|
||||||
|
@ -119,13 +117,12 @@ class ReadEmbyDB():
|
||||||
def getTVShows(self, id, fullinfo = False, fullSync = False):
|
def getTVShows(self, id, fullinfo = False, fullSync = False):
|
||||||
result = None
|
result = None
|
||||||
|
|
||||||
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
WINDOW = xbmcgui.Window(10000)
|
||||||
port = addon.getSetting('port')
|
username = WINDOW.getProperty('currUser')
|
||||||
host = addon.getSetting('ipaddress')
|
userid = WINDOW.getProperty('userId%s' % username)
|
||||||
server = host + ":" + port
|
server = WINDOW.getProperty('server%s' % username)
|
||||||
|
|
||||||
downloadUtils = DownloadUtils()
|
downloadUtils = DownloadUtils()
|
||||||
userid = downloadUtils.getUserId()
|
|
||||||
|
|
||||||
if not fullSync:
|
if not fullSync:
|
||||||
sortstring = "&Limit=20&SortBy=DateCreated"
|
sortstring = "&Limit=20&SortBy=DateCreated"
|
||||||
|
@ -134,9 +131,9 @@ class ReadEmbyDB():
|
||||||
|
|
||||||
|
|
||||||
if fullinfo:
|
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=Series&format=json&ImageTypeLimit=1'
|
url = "%s/mediabrowser/Users/%s/Items?ParentId=%s%s&Fields=Path,Genres,SortName,Studios,Writer,ProductionYear,Taglines,CommunityRating,OfficialRating,CumulativeRunTimeTicks,Metascore,AirTime,DateCreated,MediaStreams,People,Overview&Recursive=true&SortOrder=Descending&IncludeItemTypes=Series&format=json&ImageTypeLimit=1" % (server, userid, id, sortstring)
|
||||||
else:
|
else:
|
||||||
url = server + '/mediabrowser/Users/' + userid + '/Items?ParentId=' + id + sortstring + '&Fields=CumulativeRunTimeTicks&Recursive=true&SortOrder=Descending&IncludeItemTypes=Series&format=json&ImageTypeLimit=1'
|
url = "%s/mediabrowser/Users/%s/Items?ParentId=%s%s&Fields=CumulativeRunTimeTicks&Recursive=true&SortOrder=Descending&IncludeItemTypes=Series&format=json&ImageTypeLimit=1" % (server, userid, id, sortstring)
|
||||||
|
|
||||||
jsonData = downloadUtils.downloadUrl(url, suppress=False, popup=0)
|
jsonData = downloadUtils.downloadUrl(url, suppress=False, popup=0)
|
||||||
if jsonData != None and jsonData != "":
|
if jsonData != None and jsonData != "":
|
||||||
|
@ -149,15 +146,14 @@ class ReadEmbyDB():
|
||||||
def getTVShowSeasons(self, tvShowId):
|
def getTVShowSeasons(self, tvShowId):
|
||||||
result = None
|
result = None
|
||||||
|
|
||||||
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
WINDOW = xbmcgui.Window(10000)
|
||||||
port = addon.getSetting('port')
|
username = WINDOW.getProperty('currUser')
|
||||||
host = addon.getSetting('ipaddress')
|
userid = WINDOW.getProperty('userId%s' % username)
|
||||||
server = host + ":" + port
|
server = WINDOW.getProperty('server%s' % username)
|
||||||
|
|
||||||
downloadUtils = DownloadUtils()
|
downloadUtils = DownloadUtils()
|
||||||
userid = downloadUtils.getUserId()
|
|
||||||
|
|
||||||
url = 'http://' + server + '/Shows/' + tvShowId + '/Seasons?UserId=' + userid + '&format=json&ImageTypeLimit=1'
|
url = "%s/Shows/%s/Seasons?UserId=%s&format=json&ImageTypeLimit=1" % (server, tvShowId, userid)
|
||||||
|
|
||||||
jsonData = downloadUtils.downloadUrl(url, suppress=False, popup=0)
|
jsonData = downloadUtils.downloadUrl(url, suppress=False, popup=0)
|
||||||
if jsonData != None and jsonData != "":
|
if jsonData != None and jsonData != "":
|
||||||
|
@ -191,18 +187,17 @@ class ReadEmbyDB():
|
||||||
def getEpisodes(self, showId, fullinfo = False):
|
def getEpisodes(self, showId, fullinfo = False):
|
||||||
result = None
|
result = None
|
||||||
|
|
||||||
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
WINDOW = xbmcgui.Window(10000)
|
||||||
port = addon.getSetting('port')
|
username = WINDOW.getProperty('currUser')
|
||||||
host = addon.getSetting('ipaddress')
|
userid = WINDOW.getProperty('userId%s' % username)
|
||||||
server = host + ":" + port
|
server = WINDOW.getProperty('server%s' % username)
|
||||||
|
|
||||||
downloadUtils = DownloadUtils()
|
downloadUtils = DownloadUtils()
|
||||||
userid = downloadUtils.getUserId()
|
|
||||||
|
|
||||||
if fullinfo:
|
if fullinfo:
|
||||||
url = server + '/mediabrowser/Users/' + userid + '/Items?ParentId=' + showId + '&IsVirtualUnaired=false&IsMissing=False&SortBy=SortName&Fields=Path,Genres,SortName,Studios,Writer,ProductionYear,Taglines,CommunityRating,OfficialRating,CumulativeRunTimeTicks,Metascore,AirTime,DateCreated,MediaStreams,People,Overview&Recursive=true&SortOrder=Ascending&IncludeItemTypes=Episode&format=json&ImageTypeLimit=1'
|
url = "%s/mediabrowser/Users/%s/Items?ParentId=%s&IsVirtualUnaired=false&IsMissing=False&SortBy=SortName&Fields=Path,Genres,SortName,Studios,Writer,ProductionYear,Taglines,CommunityRating,OfficialRating,CumulativeRunTimeTicks,Metascore,AirTime,DateCreated,MediaStreams,People,Overview&Recursive=true&SortOrder=Ascending&IncludeItemTypes=Episode&format=json&ImageTypeLimit=1" % (server, userid, showId)
|
||||||
else:
|
else:
|
||||||
url = server + '/mediabrowser/Users/' + userid + '/Items?ParentId=' + showId + '&IsVirtualUnaired=false&IsMissing=False&SortBy=SortName&Fields=Name,SortName,CumulativeRunTimeTicks&Recursive=true&SortOrder=Ascending&IncludeItemTypes=Episode&format=json&ImageTypeLimit=1'
|
url = "%s/mediabrowser/Users/%s/Items?ParentId=%s&IsVirtualUnaired=false&IsMissing=False&SortBy=SortName&Fields=Name,SortName,CumulativeRunTimeTicks&Recursive=true&SortOrder=Ascending&IncludeItemTypes=Episode&format=json&ImageTypeLimit=1" % (server, userid, showId)
|
||||||
|
|
||||||
jsonData = downloadUtils.downloadUrl(url, suppress=False, popup=0)
|
jsonData = downloadUtils.downloadUrl(url, suppress=False, popup=0)
|
||||||
|
|
||||||
|
@ -217,22 +212,21 @@ class ReadEmbyDB():
|
||||||
def getLatestEpisodes(self, fullinfo = False, itemList = []):
|
def getLatestEpisodes(self, fullinfo = False, itemList = []):
|
||||||
result = None
|
result = None
|
||||||
|
|
||||||
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
WINDOW = xbmcgui.Window(10000)
|
||||||
port = addon.getSetting('port')
|
username = WINDOW.getProperty('currUser')
|
||||||
host = addon.getSetting('ipaddress')
|
userid = WINDOW.getProperty('userId%s' % username)
|
||||||
server = host + ":" + port
|
server = WINDOW.getProperty('server%s' % username)
|
||||||
|
|
||||||
downloadUtils = DownloadUtils()
|
downloadUtils = DownloadUtils()
|
||||||
userid = downloadUtils.getUserId()
|
|
||||||
|
|
||||||
limitString = "Limit=20&SortBy=DateCreated&"
|
limitString = "Limit=20&SortBy=DateCreated&"
|
||||||
if(len(itemList) > 0): # if we want a certain list specify it
|
if(len(itemList) > 0): # if we want a certain list specify it
|
||||||
limitString = "Ids=" + ",".join(itemList) + "&"
|
limitString = "Ids=" + ",".join(itemList) + "&"
|
||||||
|
|
||||||
if fullinfo:
|
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'
|
url = "%s/mediabrowser/Users/%s/Items?%sIsVirtualUnaired=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" % (server, userid, limitString)
|
||||||
else:
|
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'
|
url = "%s/mediabrowser/Users/%s/Items?%sIsVirtualUnaired=false&IsMissing=False&Fields=ParentId,Name,SortName,CumulativeRunTimeTicks&Recursive=true&SortOrder=Descending&IncludeItemTypes=Episode&format=json&ImageTypeLimit=1" % (server, userid, limitString)
|
||||||
|
|
||||||
jsonData = downloadUtils.downloadUrl(url, suppress=False, popup=0)
|
jsonData = downloadUtils.downloadUrl(url, suppress=False, popup=0)
|
||||||
|
|
||||||
|
@ -246,15 +240,16 @@ class ReadEmbyDB():
|
||||||
|
|
||||||
def getCollections(self, type):
|
def getCollections(self, type):
|
||||||
#Build a list of the user views
|
#Build a list of the user views
|
||||||
userid = DownloadUtils().getUserId()
|
WINDOW = xbmcgui.Window(10000)
|
||||||
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
username = WINDOW.getProperty('currUser')
|
||||||
port = addon.getSetting('port')
|
userid = WINDOW.getProperty('userId%s' % username)
|
||||||
host = addon.getSetting('ipaddress')
|
server = WINDOW.getProperty('server%s' % username)
|
||||||
server = host + ":" + port
|
|
||||||
downloadUtils = DownloadUtils()
|
downloadUtils = DownloadUtils()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
jsonData = downloadUtils.downloadUrl("http://" + server + "/mediabrowser/Users/" + userid + "/Items/Root?format=json")
|
url = "%s/mediabrowser/Users/%s/Items/Root?format=json" % (server, userid)
|
||||||
|
jsonData = downloadUtils.downloadUrl(url)
|
||||||
except Exception, msg:
|
except Exception, msg:
|
||||||
error = "Get connect : " + str(msg)
|
error = "Get connect : " + str(msg)
|
||||||
xbmc.log (error)
|
xbmc.log (error)
|
||||||
|
@ -267,8 +262,8 @@ class ReadEmbyDB():
|
||||||
|
|
||||||
parentid = result.get("Id")
|
parentid = result.get("Id")
|
||||||
|
|
||||||
htmlpath = ("http://%s/mediabrowser/Users/" % server)
|
htmlpath = "%s/mediabrowser/Users/%s/items?ParentId=%s&Sortby=SortName&format=json" % (server, userid, parentid)
|
||||||
jsonData = downloadUtils.downloadUrl(htmlpath + userid + "/items?ParentId=" + parentid + "&Sortby=SortName&format=json")
|
jsonData = downloadUtils.downloadUrl(htmlpath)
|
||||||
collections=[]
|
collections=[]
|
||||||
|
|
||||||
if(jsonData == ""):
|
if(jsonData == ""):
|
||||||
|
@ -293,13 +288,12 @@ class ReadEmbyDB():
|
||||||
|
|
||||||
def getViewCollections(self, type):
|
def getViewCollections(self, type):
|
||||||
#Build a list of the user views
|
#Build a list of the user views
|
||||||
userid = DownloadUtils().getUserId()
|
WINDOW = xbmcgui.Window(10000)
|
||||||
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
username = WINDOW.getProperty('currUser')
|
||||||
port = addon.getSetting('port')
|
userid = WINDOW.getProperty('userId%s' % username)
|
||||||
host = addon.getSetting('ipaddress')
|
server = WINDOW.getProperty('server%s' % username)
|
||||||
server = host + ":" + port
|
|
||||||
|
|
||||||
viewsUrl = server + "/mediabrowser/Users/" + userid + "/Views?format=json&ImageTypeLimit=1"
|
viewsUrl = "%s/mediabrowser/Users/%s/Views?format=json&ImageTypeLimit=1" % (server, userid)
|
||||||
jsonData = DownloadUtils().downloadUrl(viewsUrl, suppress=False, popup=0 )
|
jsonData = DownloadUtils().downloadUrl(viewsUrl, suppress=False, popup=0 )
|
||||||
collections=[]
|
collections=[]
|
||||||
|
|
||||||
|
@ -309,7 +303,7 @@ class ReadEmbyDB():
|
||||||
|
|
||||||
for view in views:
|
for view in views:
|
||||||
if view.get("Type") == 'UserView': # Need to grab the real main node
|
if view.get("Type") == 'UserView': # Need to grab the real main node
|
||||||
newViewsUrl = server + '/mediabrowser/Users/' + userid + '/items?ParentId=' + view.get("Id") + '&SortBy=SortName&SortOrder=Ascending&format=json&ImageTypeLimit=1'
|
newViewsUrl = "%s/mediabrowser/Users/%s/items?ParentId=%s&SortBy=SortName&SortOrder=Ascending&format=json&ImageTypeLimit=1" % (server, userid, view.get("Id"))
|
||||||
jsonData = DownloadUtils().downloadUrl(newViewsUrl, suppress=False, popup=0 )
|
jsonData = DownloadUtils().downloadUrl(newViewsUrl, suppress=False, popup=0 )
|
||||||
if(jsonData != ""):
|
if(jsonData != ""):
|
||||||
newViews = json.loads(jsonData)
|
newViews = json.loads(jsonData)
|
||||||
|
@ -334,15 +328,14 @@ class ReadEmbyDB():
|
||||||
def getBoxSets(self):
|
def getBoxSets(self):
|
||||||
result = None
|
result = None
|
||||||
|
|
||||||
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
WINDOW = xbmcgui.Window(10000)
|
||||||
port = addon.getSetting('port')
|
username = WINDOW.getProperty('currUser')
|
||||||
host = addon.getSetting('ipaddress')
|
userid = WINDOW.getProperty('userId%s' % username)
|
||||||
server = host + ":" + port
|
server = WINDOW.getProperty('server%s' % username)
|
||||||
|
|
||||||
downloadUtils = DownloadUtils()
|
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'
|
url = "%s/mediabrowser/Users/%s/Items?SortBy=SortName&IsVirtualUnaired=false&IsMissing=False&Fields=Name,SortName,CumulativeRunTimeTicks&Recursive=true&SortOrder=Ascending&IncludeItemTypes=BoxSet&format=json&ImageTypeLimit=1" % (server, userid)
|
||||||
|
|
||||||
jsonData = downloadUtils.downloadUrl(url, suppress=False, popup=0)
|
jsonData = downloadUtils.downloadUrl(url, suppress=False, popup=0)
|
||||||
|
|
||||||
|
@ -355,15 +348,14 @@ class ReadEmbyDB():
|
||||||
def getMoviesInBoxSet(self,boxsetId):
|
def getMoviesInBoxSet(self,boxsetId):
|
||||||
result = None
|
result = None
|
||||||
|
|
||||||
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
WINDOW = xbmcgui.Window(10000)
|
||||||
port = addon.getSetting('port')
|
username = WINDOW.getProperty('currUser')
|
||||||
host = addon.getSetting('ipaddress')
|
userid = WINDOW.getProperty('userId%s' % username)
|
||||||
server = host + ":" + port
|
server = WINDOW.getProperty('server%s' % username)
|
||||||
|
|
||||||
downloadUtils = DownloadUtils()
|
downloadUtils = DownloadUtils()
|
||||||
userid = downloadUtils.getUserId()
|
|
||||||
|
|
||||||
url = server + '/mediabrowser/Users/' + userid + '/Items?ParentId=' + boxsetId + '&Fields=ItemCounts&format=json&ImageTypeLimit=1'
|
url = "%s/mediabrowser/Users/%s/Items?ParentId=%s&Fields=ItemCounts&format=json&ImageTypeLimit=1" % (server, userid, boxsetId)
|
||||||
|
|
||||||
jsonData = downloadUtils.downloadUrl(url, suppress=False, popup=0)
|
jsonData = downloadUtils.downloadUrl(url, suppress=False, popup=0)
|
||||||
|
|
||||||
|
@ -371,5 +363,4 @@ class ReadEmbyDB():
|
||||||
result = json.loads(jsonData)
|
result = json.loads(jsonData)
|
||||||
if(result.has_key('Items')):
|
if(result.has_key('Items')):
|
||||||
result = result['Items']
|
result = result['Items']
|
||||||
return result
|
return result
|
||||||
|
|
|
@ -275,8 +275,10 @@ class WebSocketThread(threading.Thread):
|
||||||
def run(self):
|
def run(self):
|
||||||
|
|
||||||
addonSettings = xbmcaddon.Addon(id='plugin.video.emby')
|
addonSettings = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
mb3Host = addonSettings.getSetting('ipaddress')
|
WINDOW = xbmcgui.Window(10000)
|
||||||
mb3Port = addonSettings.getSetting('port')
|
username = WINDOW.getProperty('currUser')
|
||||||
|
server = WINDOW.getProperty('server%s' % username)
|
||||||
|
host = WINDOW.getProperty('server_%s' % username)
|
||||||
|
|
||||||
if(self.logLevel >= 1):
|
if(self.logLevel >= 1):
|
||||||
websocket.enableTrace(True)
|
websocket.enableTrace(True)
|
||||||
|
@ -287,8 +289,12 @@ class WebSocketThread(threading.Thread):
|
||||||
self.logMsg("Could not retrieve WebSocket port, can not run WebScoket Client")
|
self.logMsg("Could not retrieve WebSocket port, can not run WebScoket Client")
|
||||||
return
|
return
|
||||||
'''
|
'''
|
||||||
|
if "https" in server:
|
||||||
|
webSocketUrl = "wss://%s/mediabrowser" % host
|
||||||
|
else:
|
||||||
|
webSocketUrl = "ws://%s/mediabrowser" % host
|
||||||
# Make a call to /System/Info. WebSocketPortNumber is the port hosting the web socket.
|
# Make a call to /System/Info. WebSocketPortNumber is the port hosting the web socket.
|
||||||
webSocketUrl = "ws://" + mb3Host + ":" + mb3Port + "/mediabrowser"
|
#webSocketUrl = "ws://" + host + "/mediabrowser"
|
||||||
self.logMsg("WebSocket URL : " + webSocketUrl)
|
self.logMsg("WebSocket URL : " + webSocketUrl)
|
||||||
self.client = websocket.WebSocketApp(webSocketUrl,
|
self.client = websocket.WebSocketApp(webSocketUrl,
|
||||||
on_message = self.on_message,
|
on_message = self.on_message,
|
||||||
|
|
|
@ -33,13 +33,14 @@ class WriteKodiDB():
|
||||||
|
|
||||||
if(mb3Id != None):
|
if(mb3Id != None):
|
||||||
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
port = addon.getSetting('port')
|
WINDOW = xbmcgui.Window(10000)
|
||||||
host = addon.getSetting('ipaddress')
|
username = WINDOW.getProperty('currUser')
|
||||||
server = host + ":" + port
|
userid = WINDOW.getProperty('userId%s' % username)
|
||||||
downloadUtils = DownloadUtils()
|
server = WINDOW.getProperty('server%s' % username)
|
||||||
userid = downloadUtils.getUserId()
|
|
||||||
|
downloadUtils = DownloadUtils()
|
||||||
|
|
||||||
watchedurl = 'http://' + server + '/mediabrowser/Users/' + userid + '/PlayedItems/' + mb3Id
|
watchedurl = "%s/mediabrowser/Users/%s/PlayedItems/%s" % (server, userid, mb3Id)
|
||||||
utils.logMsg("Emby","watchedurl -->" + watchedurl)
|
utils.logMsg("Emby","watchedurl -->" + watchedurl)
|
||||||
if playcount != 0:
|
if playcount != 0:
|
||||||
downloadUtils.downloadUrl(watchedurl, postBody="", type="POST")
|
downloadUtils.downloadUrl(watchedurl, postBody="", type="POST")
|
||||||
|
@ -48,11 +49,12 @@ class WriteKodiDB():
|
||||||
|
|
||||||
def updateMovieToKodiLibrary_Batched(self, MBitem, KodiItem,connection, cursor):
|
def updateMovieToKodiLibrary_Batched(self, MBitem, KodiItem,connection, cursor):
|
||||||
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
port = addon.getSetting('port')
|
WINDOW = xbmcgui.Window(10000)
|
||||||
host = addon.getSetting('ipaddress')
|
username = WINDOW.getProperty('currUser')
|
||||||
server = host + ":" + port
|
userid = WINDOW.getProperty('userId%s' % username)
|
||||||
|
server = WINDOW.getProperty('server%s' % username)
|
||||||
|
|
||||||
downloadUtils = DownloadUtils()
|
downloadUtils = DownloadUtils()
|
||||||
userid = downloadUtils.getUserId()
|
|
||||||
|
|
||||||
timeInfo = API().getTimeInfo(MBitem)
|
timeInfo = API().getTimeInfo(MBitem)
|
||||||
userData=API().getUserData(MBitem)
|
userData=API().getUserData(MBitem)
|
||||||
|
@ -111,7 +113,7 @@ class WriteKodiDB():
|
||||||
#trailer link
|
#trailer link
|
||||||
trailerUrl = None
|
trailerUrl = None
|
||||||
if MBitem.get("LocalTrailerCount") != None and MBitem.get("LocalTrailerCount") > 0:
|
if MBitem.get("LocalTrailerCount") != None and MBitem.get("LocalTrailerCount") > 0:
|
||||||
itemTrailerUrl = "http://" + server + "/mediabrowser/Users/" + userid + "/Items/" + MBitem.get("Id") + "/LocalTrailers?format=json"
|
itemTrailerUrl = "%s/mediabrowser/Users/%s/Items/%s/LocalTrailers?format=json" % (server, userid, MBitem.get("Id"))
|
||||||
jsonData = downloadUtils.downloadUrl(itemTrailerUrl, suppress=False, popup=0 )
|
jsonData = downloadUtils.downloadUrl(itemTrailerUrl, suppress=False, popup=0 )
|
||||||
if(jsonData != ""):
|
if(jsonData != ""):
|
||||||
trailerItem = json.loads(jsonData)
|
trailerItem = json.loads(jsonData)
|
||||||
|
@ -207,11 +209,12 @@ class WriteKodiDB():
|
||||||
def updateMovieToKodiLibrary(self, MBitem, KodiItem, connection, cursor):
|
def updateMovieToKodiLibrary(self, MBitem, KodiItem, connection, cursor):
|
||||||
|
|
||||||
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
port = addon.getSetting('port')
|
WINDOW = xbmcgui.Window(10000)
|
||||||
host = addon.getSetting('ipaddress')
|
username = WINDOW.getProperty('currUser')
|
||||||
server = host + ":" + port
|
userid = WINDOW.getProperty('userId%s' % username)
|
||||||
|
server = WINDOW.getProperty('server%s' % username)
|
||||||
|
|
||||||
downloadUtils = DownloadUtils()
|
downloadUtils = DownloadUtils()
|
||||||
userid = downloadUtils.getUserId()
|
|
||||||
|
|
||||||
timeInfo = API().getTimeInfo(MBitem)
|
timeInfo = API().getTimeInfo(MBitem)
|
||||||
userData=API().getUserData(MBitem)
|
userData=API().getUserData(MBitem)
|
||||||
|
@ -263,7 +266,7 @@ class WriteKodiDB():
|
||||||
#trailer link
|
#trailer link
|
||||||
trailerUrl = None
|
trailerUrl = None
|
||||||
if MBitem.get("LocalTrailerCount") != None and MBitem.get("LocalTrailerCount") > 0:
|
if MBitem.get("LocalTrailerCount") != None and MBitem.get("LocalTrailerCount") > 0:
|
||||||
itemTrailerUrl = "http://" + server + "/mediabrowser/Users/" + userid + "/Items/" + MBitem.get("Id") + "/LocalTrailers?format=json"
|
itemTrailerUrl = "%s/mediabrowser/Users/%s/Items/%s/LocalTrailers?format=json" % (server, userid, MBitem.get("Id"))
|
||||||
jsonData = downloadUtils.downloadUrl(itemTrailerUrl, suppress=False, popup=0 )
|
jsonData = downloadUtils.downloadUrl(itemTrailerUrl, suppress=False, popup=0 )
|
||||||
if(jsonData != ""):
|
if(jsonData != ""):
|
||||||
trailerItem = json.loads(jsonData)
|
trailerItem = json.loads(jsonData)
|
||||||
|
@ -684,11 +687,12 @@ class WriteKodiDB():
|
||||||
#TODO: PR at Kodi team for a addMovie endpoint on their API
|
#TODO: PR at Kodi team for a addMovie endpoint on their API
|
||||||
|
|
||||||
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
port = addon.getSetting('port')
|
WINDOW = xbmcgui.Window(10000)
|
||||||
host = addon.getSetting('ipaddress')
|
username = WINDOW.getProperty('currUser')
|
||||||
server = host + ":" + port
|
userid = WINDOW.getProperty('userId%s' % username)
|
||||||
|
server = WINDOW.getProperty('server%s' % username)
|
||||||
|
|
||||||
downloadUtils = DownloadUtils()
|
downloadUtils = DownloadUtils()
|
||||||
userid = downloadUtils.getUserId()
|
|
||||||
|
|
||||||
timeInfo = API().getTimeInfo(MBitem)
|
timeInfo = API().getTimeInfo(MBitem)
|
||||||
userData=API().getUserData(MBitem)
|
userData=API().getUserData(MBitem)
|
||||||
|
@ -752,7 +756,7 @@ class WriteKodiDB():
|
||||||
|
|
||||||
trailerUrl = None
|
trailerUrl = None
|
||||||
if MBitem.get("LocalTrailerCount") != None and MBitem.get("LocalTrailerCount") > 0:
|
if MBitem.get("LocalTrailerCount") != None and MBitem.get("LocalTrailerCount") > 0:
|
||||||
itemTrailerUrl = "http://" + server + "/mediabrowser/Users/" + userid + "/Items/" + MBitem.get("Id") + "/LocalTrailers?format=json"
|
itemTrailerUrl = "%s/mediabrowser/Users/%s/Items/%s/LocalTrailers?format=json" % (server, userid, MBitem.get("Id"))
|
||||||
jsonData = downloadUtils.downloadUrl(itemTrailerUrl, suppress=False, popup=0 )
|
jsonData = downloadUtils.downloadUrl(itemTrailerUrl, suppress=False, popup=0 )
|
||||||
if(jsonData != ""):
|
if(jsonData != ""):
|
||||||
trailerItem = json.loads(jsonData)
|
trailerItem = json.loads(jsonData)
|
||||||
|
|
Loading…
Reference in a new issue