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:
|
||||
index = str(randrange(0,totalbackdrops))
|
||||
# use the local image proxy server that is made available by this addons service
|
||||
|
||||
port = addonSettings.getSetting('port')
|
||||
host = addonSettings.getSetting('ipaddress')
|
||||
server = host + ":" + port
|
||||
# Load user information set by UserClient
|
||||
WINDOW = xbmcgui.Window(10000)
|
||||
username = WINDOW.getProperty('currUser')
|
||||
server = WINDOW.getProperty('server%s' % username)
|
||||
|
||||
if addonSettings.getSetting('compressArt')=='true':
|
||||
query = query + "&Quality=90"
|
||||
|
||||
if imageTag == None:
|
||||
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':
|
||||
artwork = artwork + "&EnableImageEnhancers=false"
|
||||
|
||||
|
@ -353,12 +353,13 @@ class API():
|
|||
|
||||
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")
|
||||
port = addonSettings.getSetting('port')
|
||||
host = addonSettings.getSetting('ipaddress')
|
||||
server = host + ":" + port
|
||||
artwork = "http://" + server + "/mediabrowser/Users/" + str(id) + "/Images/" + type + "?Format=original"
|
||||
|
||||
artwork = "%s/mediabrowser/Users/%s/Images/%s?Format=original" % (server, id, type)
|
||||
|
||||
return artwork
|
||||
|
|
@ -101,13 +101,12 @@ class DownloadUtils():
|
|||
self.logMsg("postcapabilities called")
|
||||
|
||||
# Set Capabilities
|
||||
mb3Port = self.addonSettings.getSetting('port')
|
||||
mb3Host = self.addonSettings.getSetting('ipaddress')
|
||||
server = self.getServer()
|
||||
clientInfo = ClientInformation()
|
||||
machineId = clientInfo.getMachineId()
|
||||
|
||||
# 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);
|
||||
jsonData = self.downloadUrl(url)
|
||||
self.logMsg("Session JsonData : " + jsonData)
|
||||
|
@ -122,7 +121,7 @@ class DownloadUtils():
|
|||
#supportedCommands = "Play,Playstate,DisplayContent,GoHome,SendString,GoToSettings,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["Id"] = sessionId;
|
||||
#postData["PlayableMediaTypes"] = "Video";
|
||||
|
@ -133,89 +132,6 @@ class DownloadUtils():
|
|||
|
||||
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):
|
||||
|
||||
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
|
||||
def onNotification (self,sender,method,data):
|
||||
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||
port = addon.getSetting('port')
|
||||
host = addon.getSetting('ipaddress')
|
||||
server = host + ":" + port
|
||||
downloadUtils = DownloadUtils()
|
||||
print "onNotification:" + method + ":" + sender + ":" + str(data)
|
||||
#player started playing an item -
|
||||
|
@ -45,16 +42,20 @@ class Kodi_Monitor(xbmc.Monitor):
|
|||
|
||||
WINDOW = xbmcgui.Window( 10000 )
|
||||
|
||||
userid = downloadUtils.getUserId()
|
||||
jsonData = downloadUtils.downloadUrl("http://" + server + "/mediabrowser/Users/" + userid + "/Items/" + embyid + "?format=json&ImageTypeLimit=1", suppress=False, popup=1 )
|
||||
username = WINDOW.getProperty('currUser')
|
||||
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)
|
||||
userData = result.get("UserData")
|
||||
|
||||
playurl = PlayUtils().getPlayUrl(server, embyid, result)
|
||||
|
||||
watchedurl = 'http://' + server + '/mediabrowser/Users/'+ userid + '/PlayedItems/' + embyid
|
||||
positionurl = 'http://' + server + '/mediabrowser/Users/'+ userid + '/PlayingItems/' + embyid
|
||||
deleteurl = 'http://' + server + '/mediabrowser/Items/' + embyid
|
||||
watchedurl = "%s/mediabrowser/Users/%s/PlayedItems/%s" % (server, userid, embyid)
|
||||
positionurl = "%s/mediabrowser/Users/%s/PlayingItems/%s" % (server, userid, embyid)
|
||||
deleteurl = "%s/mediabrowser/Items/%s" % (server, embyid)
|
||||
|
||||
# set the current playing info
|
||||
WINDOW.setProperty(playurl+"watchedurl", watchedurl)
|
||||
|
|
|
@ -24,6 +24,10 @@ class PlayUtils():
|
|||
|
||||
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')
|
||||
# if the path is local and depending on the video quality play we can direct play it do so-
|
||||
if self.isDirectPlay(result) == True:
|
||||
|
@ -47,7 +51,7 @@ class PlayUtils():
|
|||
if ("apple.com" in playurl):
|
||||
playurl += '?|User-Agent=%s' % USER_AGENT
|
||||
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")
|
||||
if(mediaSources != None):
|
||||
if mediaSources[0].get('DefaultAudioStreamIndex') != None:
|
||||
|
@ -58,10 +62,10 @@ class PlayUtils():
|
|||
else:
|
||||
#No path or has a path but not sufficient network so transcode
|
||||
if result.get("Type") == "Audio":
|
||||
playurl = 'http://' + server + '/mediabrowser/Audio/' + id + '/stream.mp3'
|
||||
playurl = "%s/mediabrowser/Audio/%s/stream.mp3" % (server, id)
|
||||
else:
|
||||
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 + '&AudioCodec=aac,ac3'
|
||||
playurl = playurl + '&deviceId=' + txt_mac
|
||||
|
@ -179,4 +183,3 @@ class PlayUtils():
|
|||
|
||||
# default to not local
|
||||
return False
|
||||
|
||||
|
|
|
@ -37,12 +37,14 @@ class PlaybackUtils():
|
|||
|
||||
def PLAY(self, id):
|
||||
xbmc.log("PLAY Called")
|
||||
port = addon.getSetting('port')
|
||||
host = addon.getSetting('ipaddress')
|
||||
server = host + ":" + port
|
||||
WINDOW = xbmcgui.Window(10000)
|
||||
|
||||
userid = self.downloadUtils.getUserId()
|
||||
jsonData = self.downloadUtils.downloadUrl("http://" + server + "/mediabrowser/Users/" + userid + "/Items/" + id + "?format=json&ImageTypeLimit=1", suppress=False, popup=1 )
|
||||
username = WINDOW.getProperty('currUser')
|
||||
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, id)
|
||||
jsonData = self.downloadUtils.downloadUrl(url, suppress=False, popup=1 )
|
||||
result = json.loads(jsonData)
|
||||
|
||||
userData = result.get("UserData")
|
||||
|
@ -85,9 +87,9 @@ class PlaybackUtils():
|
|||
if (result.get("LocationType") == "Virtual"):
|
||||
xbmcgui.Dialog().ok(self.language(30128), self.language(30129))
|
||||
|
||||
watchedurl = 'http://' + server + '/mediabrowser/Users/'+ userid + '/PlayedItems/' + id
|
||||
positionurl = 'http://' + server + '/mediabrowser/Users/'+ userid + '/PlayingItems/' + id
|
||||
deleteurl = 'http://' + server + '/mediabrowser/Items/' + id
|
||||
watchedurl = "%s/mediabrowser/Users/%s/PlayedItems/%s" % (server, userid, id)
|
||||
positionurl = "%s/mediabrowser/Users/%s/PlayingItems/%s" % (server, userid, id)
|
||||
deleteurl = "%s/mediabrowser/Items/%s" % (server, id)
|
||||
|
||||
# set the current playing info
|
||||
WINDOW.setProperty(playurl+"watchedurl", watchedurl)
|
||||
|
@ -241,8 +243,11 @@ class PlaybackUtils():
|
|||
def PLAYAllItems(self, items, startPositionTicks):
|
||||
utils.logMsg("PlayBackUtils", "== ENTER: PLAYAllItems ==")
|
||||
utils.logMsg("PlayBackUtils", "Items : " + str(items))
|
||||
userid = self.downloadUtils.getUserId()
|
||||
server = self.downloadUtils.getServer()
|
||||
WINDOW = xbmcgui.Window(10000)
|
||||
|
||||
username = WINDOW.getProperty('currUser')
|
||||
userid = WINDOW.getProperty('userId%s' % username)
|
||||
server = WINDOW.getProperty('server%s' % username)
|
||||
|
||||
playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
|
||||
playlist.clear()
|
||||
|
@ -251,7 +256,7 @@ class PlaybackUtils():
|
|||
for itemID in items:
|
||||
|
||||
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 )
|
||||
|
||||
item_data = json.loads(jsonData)
|
||||
|
@ -274,15 +279,18 @@ class PlaybackUtils():
|
|||
self.seekToPosition(seekTime)
|
||||
|
||||
def PLAYAllEpisodes(self, items):
|
||||
userid = self.downloadUtils.getUserId()
|
||||
server = self.downloadUtils.getServer()
|
||||
WINDOW = xbmcgui.Window(10000)
|
||||
|
||||
username = WINDOW.getProperty('currUser')
|
||||
userid = WINDOW.getProperty('userId%s' % username)
|
||||
server = WINDOW.getProperty('server%s' % username)
|
||||
|
||||
playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
|
||||
playlist.clear()
|
||||
|
||||
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 )
|
||||
|
||||
item_data = json.loads(jsonData)
|
||||
|
@ -292,15 +300,18 @@ class PlaybackUtils():
|
|||
|
||||
def AddToPlaylist(self, itemIds):
|
||||
utils.logMsg("PlayBackUtils", "== ENTER: PLAYAllItems ==")
|
||||
userid = self.downloadUtils.getUserId()
|
||||
server = self.downloadUtils.getServer()
|
||||
WINDOW = xbmcgui.Window(10000)
|
||||
|
||||
username = WINDOW.getProperty('currUser')
|
||||
userid = WINDOW.getProperty('userId%s' % username)
|
||||
server = WINDOW.getProperty('server%s' % username)
|
||||
|
||||
playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
|
||||
|
||||
for itemID in itemIds:
|
||||
|
||||
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 )
|
||||
|
||||
item_data = json.loads(jsonData)
|
||||
|
@ -318,6 +329,12 @@ class PlaybackUtils():
|
|||
listItem = xbmcgui.ListItem(path=playurl, iconImage=thumbPath, thumbnailImage=thumbPath)
|
||||
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
|
||||
if (item.get("LocationType") == "Virtual") or (item.get("IsPlaceHolder") == True):
|
||||
|
||||
|
@ -326,9 +343,9 @@ class PlaybackUtils():
|
|||
|
||||
else:
|
||||
|
||||
watchedurl = 'http://' + server + '/mediabrowser/Users/'+ userid + '/PlayedItems/' + id
|
||||
positionurl = 'http://' + server + '/mediabrowser/Users/'+ userid + '/PlayingItems/' + id
|
||||
deleteurl = 'http://' + server + '/mediabrowser/Items/' + id
|
||||
watchedurl = "%s/mediabrowser/Users/%s/PlayedItems/%s" % (server, userid, id)
|
||||
positionurl = "%s/mediabrowser/Users/%s/PlayingItems/%s" % (server, userid, id)
|
||||
deleteurl = "%s/mediabrowser/Items/%s" % (server, id)
|
||||
|
||||
# set the current playing info
|
||||
WINDOW = xbmcgui.Window( 10000 )
|
||||
|
|
|
@ -94,11 +94,14 @@ class Player( xbmc.Player ):
|
|||
|
||||
|
||||
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?
|
||||
clientInfo = ClientInformation()
|
||||
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
|
||||
self.downloadUtils.downloadUrl(url, type="DELETE")
|
||||
|
||||
|
@ -113,7 +116,11 @@ class Player( xbmc.Player ):
|
|||
currentPosition = data.get("currentPosition")
|
||||
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
|
||||
|
||||
|
@ -151,7 +158,11 @@ class Player( xbmc.Player ):
|
|||
playMethod = data.get("playmethod")
|
||||
paused = data.get("paused")
|
||||
|
||||
url = ("http://%s:%s/mediabrowser/Sessions/Playing/Progress" % (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/Progress" % server
|
||||
|
||||
url = url + "?itemId=" + item_id
|
||||
|
||||
|
@ -230,7 +241,10 @@ class Player( xbmc.Player ):
|
|||
self.printDebug("emby Service -> onPlayBackStarted : No info for current playing file", 0)
|
||||
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
|
||||
|
||||
|
@ -296,11 +310,10 @@ class Player( xbmc.Player ):
|
|||
id = WINDOW.getProperty("virtualstrm")
|
||||
type = WINDOW.getProperty("virtualstrmtype")
|
||||
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||
port = addon.getSetting('port')
|
||||
host = addon.getSetting('ipaddress')
|
||||
server = host + ":" + port
|
||||
userid = self.downloadUtils.getUserId()
|
||||
watchedurl = 'http://' + server + '/mediabrowser/Users/' + userid + '/PlayedItems/' + id
|
||||
username = WINDOW.getProperty('currUser')
|
||||
userid = WINDOW.getProperty('userId%s' % username)
|
||||
server = WINDOW.getProperty('server%s' % username)
|
||||
watchedurl = "%s/mediabrowser/Users/%s/PlayedItems/%s" % (server, userid, id)
|
||||
self.downloadUtils.downloadUrl(watchedurl, postBody="", type="POST")
|
||||
librarySync.updatePlayCount(id,type)
|
||||
except: pass
|
||||
|
@ -327,17 +340,18 @@ class Player( xbmc.Player ):
|
|||
|
||||
# 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()
|
||||
WINDOW = xbmcgui.Window( 10000 )
|
||||
username = WINDOW.getProperty('currUser')
|
||||
userid = WINDOW.getProperty('userId%s' % username)
|
||||
server = WINDOW.getProperty('server%s' % username)
|
||||
# add remaining unplayed episodes if applicable
|
||||
MB3Episode = ReadEmbyDB().getItem(item_id)
|
||||
userData = MB3Episode["UserData"]
|
||||
if userData!=None and userData["Played"]==True:
|
||||
pDialog = xbmcgui.DialogProgress()
|
||||
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 != ""):
|
||||
seasonData = json.loads(jsonData)
|
||||
if seasonData.get("Items") != None:
|
||||
|
@ -362,5 +376,3 @@ class Player( xbmc.Player ):
|
|||
totalTime = xbmc.Player().getTotalTime()
|
||||
|
||||
PlaybackUtils().PLAYAllEpisodes(seasonData.get("Items"))
|
||||
|
||||
|
||||
|
|
|
@ -15,13 +15,12 @@ class ReadEmbyDB():
|
|||
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
|
||||
WINDOW = xbmcgui.Window(10000)
|
||||
username = WINDOW.getProperty('currUser')
|
||||
userid = WINDOW.getProperty('userId%s' % username)
|
||||
server = WINDOW.getProperty('server%s' % username)
|
||||
|
||||
downloadUtils = DownloadUtils()
|
||||
userid = downloadUtils.getUserId()
|
||||
|
||||
if fullSync:
|
||||
sortstring = "&SortBy=SortName"
|
||||
|
@ -33,9 +32,9 @@ class ReadEmbyDB():
|
|||
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'
|
||||
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:
|
||||
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)
|
||||
if jsonData != None and jsonData != "":
|
||||
|
@ -56,13 +55,12 @@ class ReadEmbyDB():
|
|||
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
|
||||
WINDOW = xbmcgui.Window(10000)
|
||||
username = WINDOW.getProperty('currUser')
|
||||
userid = WINDOW.getProperty('userId%s' % username)
|
||||
server = WINDOW.getProperty('server%s' % username)
|
||||
|
||||
downloadUtils = DownloadUtils()
|
||||
userid = downloadUtils.getUserId()
|
||||
|
||||
if not fullSync:
|
||||
sortstring = "&Limit=20&SortBy=DateCreated"
|
||||
|
@ -70,9 +68,9 @@ class ReadEmbyDB():
|
|||
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'
|
||||
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:
|
||||
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)
|
||||
if jsonData != None and jsonData != "":
|
||||
|
@ -85,15 +83,15 @@ class ReadEmbyDB():
|
|||
def getItem(self, id):
|
||||
result = None
|
||||
|
||||
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||
port = addon.getSetting('port')
|
||||
host = addon.getSetting('ipaddress')
|
||||
server = host + ":" + port
|
||||
WINDOW = xbmcgui.Window(10000)
|
||||
username = WINDOW.getProperty('currUser')
|
||||
userid = WINDOW.getProperty('userId%s' % username)
|
||||
server = WINDOW.getProperty('server%s' % username)
|
||||
|
||||
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 != "":
|
||||
result = json.loads(jsonData)
|
||||
|
||||
|
@ -102,15 +100,15 @@ class ReadEmbyDB():
|
|||
def getFullItem(self, id):
|
||||
result = None
|
||||
|
||||
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||
port = addon.getSetting('port')
|
||||
host = addon.getSetting('ipaddress')
|
||||
server = host + ":" + port
|
||||
WINDOW = xbmcgui.Window(10000)
|
||||
username = WINDOW.getProperty('currUser')
|
||||
userid = WINDOW.getProperty('userId%s' % username)
|
||||
server = WINDOW.getProperty('server%s' % username)
|
||||
|
||||
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 != "":
|
||||
result = json.loads(jsonData)
|
||||
|
||||
|
@ -119,13 +117,12 @@ class ReadEmbyDB():
|
|||
def getTVShows(self, id, fullinfo = False, fullSync = False):
|
||||
result = None
|
||||
|
||||
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||
port = addon.getSetting('port')
|
||||
host = addon.getSetting('ipaddress')
|
||||
server = host + ":" + port
|
||||
WINDOW = xbmcgui.Window(10000)
|
||||
username = WINDOW.getProperty('currUser')
|
||||
userid = WINDOW.getProperty('userId%s' % username)
|
||||
server = WINDOW.getProperty('server%s' % username)
|
||||
|
||||
downloadUtils = DownloadUtils()
|
||||
userid = downloadUtils.getUserId()
|
||||
|
||||
if not fullSync:
|
||||
sortstring = "&Limit=20&SortBy=DateCreated"
|
||||
|
@ -134,9 +131,9 @@ class ReadEmbyDB():
|
|||
|
||||
|
||||
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:
|
||||
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)
|
||||
if jsonData != None and jsonData != "":
|
||||
|
@ -149,15 +146,14 @@ class ReadEmbyDB():
|
|||
def getTVShowSeasons(self, tvShowId):
|
||||
result = None
|
||||
|
||||
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||
port = addon.getSetting('port')
|
||||
host = addon.getSetting('ipaddress')
|
||||
server = host + ":" + port
|
||||
WINDOW = xbmcgui.Window(10000)
|
||||
username = WINDOW.getProperty('currUser')
|
||||
userid = WINDOW.getProperty('userId%s' % username)
|
||||
server = WINDOW.getProperty('server%s' % username)
|
||||
|
||||
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)
|
||||
if jsonData != None and jsonData != "":
|
||||
|
@ -191,18 +187,17 @@ class ReadEmbyDB():
|
|||
def getEpisodes(self, showId, fullinfo = False):
|
||||
result = None
|
||||
|
||||
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||
port = addon.getSetting('port')
|
||||
host = addon.getSetting('ipaddress')
|
||||
server = host + ":" + port
|
||||
WINDOW = xbmcgui.Window(10000)
|
||||
username = WINDOW.getProperty('currUser')
|
||||
userid = WINDOW.getProperty('userId%s' % username)
|
||||
server = WINDOW.getProperty('server%s' % username)
|
||||
|
||||
downloadUtils = DownloadUtils()
|
||||
userid = downloadUtils.getUserId()
|
||||
|
||||
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:
|
||||
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)
|
||||
|
||||
|
@ -217,22 +212,21 @@ class ReadEmbyDB():
|
|||
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
|
||||
WINDOW = xbmcgui.Window(10000)
|
||||
username = WINDOW.getProperty('currUser')
|
||||
userid = WINDOW.getProperty('userId%s' % username)
|
||||
server = WINDOW.getProperty('server%s' % username)
|
||||
|
||||
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'
|
||||
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:
|
||||
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)
|
||||
|
||||
|
@ -246,15 +240,16 @@ class ReadEmbyDB():
|
|||
|
||||
def getCollections(self, type):
|
||||
#Build a list of the user views
|
||||
userid = DownloadUtils().getUserId()
|
||||
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||
port = addon.getSetting('port')
|
||||
host = addon.getSetting('ipaddress')
|
||||
server = host + ":" + port
|
||||
WINDOW = xbmcgui.Window(10000)
|
||||
username = WINDOW.getProperty('currUser')
|
||||
userid = WINDOW.getProperty('userId%s' % username)
|
||||
server = WINDOW.getProperty('server%s' % username)
|
||||
|
||||
downloadUtils = DownloadUtils()
|
||||
|
||||
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:
|
||||
error = "Get connect : " + str(msg)
|
||||
xbmc.log (error)
|
||||
|
@ -267,8 +262,8 @@ class ReadEmbyDB():
|
|||
|
||||
parentid = result.get("Id")
|
||||
|
||||
htmlpath = ("http://%s/mediabrowser/Users/" % server)
|
||||
jsonData = downloadUtils.downloadUrl(htmlpath + userid + "/items?ParentId=" + parentid + "&Sortby=SortName&format=json")
|
||||
htmlpath = "%s/mediabrowser/Users/%s/items?ParentId=%s&Sortby=SortName&format=json" % (server, userid, parentid)
|
||||
jsonData = downloadUtils.downloadUrl(htmlpath)
|
||||
collections=[]
|
||||
|
||||
if(jsonData == ""):
|
||||
|
@ -293,13 +288,12 @@ class ReadEmbyDB():
|
|||
|
||||
def getViewCollections(self, type):
|
||||
#Build a list of the user views
|
||||
userid = DownloadUtils().getUserId()
|
||||
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||
port = addon.getSetting('port')
|
||||
host = addon.getSetting('ipaddress')
|
||||
server = host + ":" + port
|
||||
WINDOW = xbmcgui.Window(10000)
|
||||
username = WINDOW.getProperty('currUser')
|
||||
userid = WINDOW.getProperty('userId%s' % username)
|
||||
server = WINDOW.getProperty('server%s' % username)
|
||||
|
||||
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 )
|
||||
collections=[]
|
||||
|
||||
|
@ -309,7 +303,7 @@ class ReadEmbyDB():
|
|||
|
||||
for view in views:
|
||||
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 )
|
||||
if(jsonData != ""):
|
||||
newViews = json.loads(jsonData)
|
||||
|
@ -334,15 +328,14 @@ class ReadEmbyDB():
|
|||
def getBoxSets(self):
|
||||
result = None
|
||||
|
||||
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||
port = addon.getSetting('port')
|
||||
host = addon.getSetting('ipaddress')
|
||||
server = host + ":" + port
|
||||
WINDOW = xbmcgui.Window(10000)
|
||||
username = WINDOW.getProperty('currUser')
|
||||
userid = WINDOW.getProperty('userId%s' % username)
|
||||
server = WINDOW.getProperty('server%s' % username)
|
||||
|
||||
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)
|
||||
|
||||
|
@ -355,15 +348,14 @@ class ReadEmbyDB():
|
|||
def getMoviesInBoxSet(self,boxsetId):
|
||||
result = None
|
||||
|
||||
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||
port = addon.getSetting('port')
|
||||
host = addon.getSetting('ipaddress')
|
||||
server = host + ":" + port
|
||||
WINDOW = xbmcgui.Window(10000)
|
||||
username = WINDOW.getProperty('currUser')
|
||||
userid = WINDOW.getProperty('userId%s' % username)
|
||||
server = WINDOW.getProperty('server%s' % username)
|
||||
|
||||
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)
|
||||
|
||||
|
@ -372,4 +364,3 @@ class ReadEmbyDB():
|
|||
if(result.has_key('Items')):
|
||||
result = result['Items']
|
||||
return result
|
||||
|
||||
|
|
|
@ -275,8 +275,10 @@ class WebSocketThread(threading.Thread):
|
|||
def run(self):
|
||||
|
||||
addonSettings = xbmcaddon.Addon(id='plugin.video.emby')
|
||||
mb3Host = addonSettings.getSetting('ipaddress')
|
||||
mb3Port = addonSettings.getSetting('port')
|
||||
WINDOW = xbmcgui.Window(10000)
|
||||
username = WINDOW.getProperty('currUser')
|
||||
server = WINDOW.getProperty('server%s' % username)
|
||||
host = WINDOW.getProperty('server_%s' % username)
|
||||
|
||||
if(self.logLevel >= 1):
|
||||
websocket.enableTrace(True)
|
||||
|
@ -287,8 +289,12 @@ class WebSocketThread(threading.Thread):
|
|||
self.logMsg("Could not retrieve WebSocket port, can not run WebScoket Client")
|
||||
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.
|
||||
webSocketUrl = "ws://" + mb3Host + ":" + mb3Port + "/mediabrowser"
|
||||
#webSocketUrl = "ws://" + host + "/mediabrowser"
|
||||
self.logMsg("WebSocket URL : " + webSocketUrl)
|
||||
self.client = websocket.WebSocketApp(webSocketUrl,
|
||||
on_message = self.on_message,
|
||||
|
|
|
@ -33,13 +33,14 @@ class WriteKodiDB():
|
|||
|
||||
if(mb3Id != None):
|
||||
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||
port = addon.getSetting('port')
|
||||
host = addon.getSetting('ipaddress')
|
||||
server = host + ":" + port
|
||||
downloadUtils = DownloadUtils()
|
||||
userid = downloadUtils.getUserId()
|
||||
WINDOW = xbmcgui.Window(10000)
|
||||
username = WINDOW.getProperty('currUser')
|
||||
userid = WINDOW.getProperty('userId%s' % username)
|
||||
server = WINDOW.getProperty('server%s' % username)
|
||||
|
||||
watchedurl = 'http://' + server + '/mediabrowser/Users/' + userid + '/PlayedItems/' + mb3Id
|
||||
downloadUtils = DownloadUtils()
|
||||
|
||||
watchedurl = "%s/mediabrowser/Users/%s/PlayedItems/%s" % (server, userid, mb3Id)
|
||||
utils.logMsg("Emby","watchedurl -->" + watchedurl)
|
||||
if playcount != 0:
|
||||
downloadUtils.downloadUrl(watchedurl, postBody="", type="POST")
|
||||
|
@ -48,11 +49,12 @@ class WriteKodiDB():
|
|||
|
||||
def updateMovieToKodiLibrary_Batched(self, MBitem, KodiItem,connection, cursor):
|
||||
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||
port = addon.getSetting('port')
|
||||
host = addon.getSetting('ipaddress')
|
||||
server = host + ":" + port
|
||||
WINDOW = xbmcgui.Window(10000)
|
||||
username = WINDOW.getProperty('currUser')
|
||||
userid = WINDOW.getProperty('userId%s' % username)
|
||||
server = WINDOW.getProperty('server%s' % username)
|
||||
|
||||
downloadUtils = DownloadUtils()
|
||||
userid = downloadUtils.getUserId()
|
||||
|
||||
timeInfo = API().getTimeInfo(MBitem)
|
||||
userData=API().getUserData(MBitem)
|
||||
|
@ -111,7 +113,7 @@ class WriteKodiDB():
|
|||
#trailer link
|
||||
trailerUrl = None
|
||||
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 )
|
||||
if(jsonData != ""):
|
||||
trailerItem = json.loads(jsonData)
|
||||
|
@ -207,11 +209,12 @@ class WriteKodiDB():
|
|||
def updateMovieToKodiLibrary(self, MBitem, KodiItem, connection, cursor):
|
||||
|
||||
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||
port = addon.getSetting('port')
|
||||
host = addon.getSetting('ipaddress')
|
||||
server = host + ":" + port
|
||||
WINDOW = xbmcgui.Window(10000)
|
||||
username = WINDOW.getProperty('currUser')
|
||||
userid = WINDOW.getProperty('userId%s' % username)
|
||||
server = WINDOW.getProperty('server%s' % username)
|
||||
|
||||
downloadUtils = DownloadUtils()
|
||||
userid = downloadUtils.getUserId()
|
||||
|
||||
timeInfo = API().getTimeInfo(MBitem)
|
||||
userData=API().getUserData(MBitem)
|
||||
|
@ -263,7 +266,7 @@ class WriteKodiDB():
|
|||
#trailer link
|
||||
trailerUrl = None
|
||||
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 )
|
||||
if(jsonData != ""):
|
||||
trailerItem = json.loads(jsonData)
|
||||
|
@ -684,11 +687,12 @@ class WriteKodiDB():
|
|||
#TODO: PR at Kodi team for a addMovie endpoint on their API
|
||||
|
||||
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||
port = addon.getSetting('port')
|
||||
host = addon.getSetting('ipaddress')
|
||||
server = host + ":" + port
|
||||
WINDOW = xbmcgui.Window(10000)
|
||||
username = WINDOW.getProperty('currUser')
|
||||
userid = WINDOW.getProperty('userId%s' % username)
|
||||
server = WINDOW.getProperty('server%s' % username)
|
||||
|
||||
downloadUtils = DownloadUtils()
|
||||
userid = downloadUtils.getUserId()
|
||||
|
||||
timeInfo = API().getTimeInfo(MBitem)
|
||||
userData=API().getUserData(MBitem)
|
||||
|
@ -752,7 +756,7 @@ class WriteKodiDB():
|
|||
|
||||
trailerUrl = None
|
||||
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 )
|
||||
if(jsonData != ""):
|
||||
trailerItem = json.loads(jsonData)
|
||||
|
|
Loading…
Reference in a new issue