mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-11-10 04:06:11 +00:00
changed some logging
This commit is contained in:
parent
34ea46b9cb
commit
e859108697
4 changed files with 18 additions and 20 deletions
|
@ -86,13 +86,13 @@ class ClientInformation():
|
||||||
if(len(clientId) == 0):
|
if(len(clientId) == 0):
|
||||||
uuid = uuid4()
|
uuid = uuid4()
|
||||||
clientId = str("%012X" % uuid)
|
clientId = str("%012X" % uuid)
|
||||||
self.logMsg("ClientId saved to FILE : %s" % clientId)
|
self.logMsg("ClientId saved to FILE : %s" % clientId,1)
|
||||||
os.write(fd, clientId)
|
os.write(fd, clientId)
|
||||||
os.fsync(fd)
|
os.fsync(fd)
|
||||||
|
|
||||||
os.close(fd)
|
os.close(fd)
|
||||||
|
|
||||||
self.logMsg("ClientId saved to WINDOW : %s" % clientId)
|
self.logMsg("ClientId saved to WINDOW : %s" % clientId,1)
|
||||||
WINDOW.setProperty("client_id", clientId)
|
WINDOW.setProperty("client_id", clientId)
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
|
@ -160,11 +160,11 @@ class User(ClientInformation):
|
||||||
|
|
||||||
# Verify if userId is saved to Window
|
# Verify if userId is saved to Window
|
||||||
if (w_userId != ""):
|
if (w_userId != ""):
|
||||||
self.logMsg("Returning saved (WINDOW) UserId for user: %s UserId: %s" % (username, w_userId))
|
self.logMsg("Returning saved (WINDOW) UserId for user: %s UserId: %s" % (username, w_userId),2)
|
||||||
return w_userId
|
return w_userId
|
||||||
# Verify if userId is saved in settings
|
# Verify if userId is saved in settings
|
||||||
elif (s_userId != ""):
|
elif (s_userId != ""):
|
||||||
self.logMsg("Returning saved (SETTINGS) UserId for user: %s UserId: %s" % (username, s_userId))
|
self.logMsg("Returning saved (SETTINGS) UserId for user: %s UserId: %s" % (username, s_userId),2)
|
||||||
self.WINDOW.setProperty('userId%s' % username, s_userId)
|
self.WINDOW.setProperty('userId%s' % username, s_userId)
|
||||||
return s_userId
|
return s_userId
|
||||||
else:
|
else:
|
||||||
|
@ -178,11 +178,11 @@ class User(ClientInformation):
|
||||||
|
|
||||||
# Verify if token is saved to Window
|
# Verify if token is saved to Window
|
||||||
if (w_token != ""):
|
if (w_token != ""):
|
||||||
self.logMsg("Returning saved (WINDOW) AccessToken for user: %s Token: %s" % (username, w_token))
|
self.logMsg("Returning saved (WINDOW) AccessToken for user: %s Token: %s" % (username, w_token),2)
|
||||||
return w_token
|
return w_token
|
||||||
# Verify if token is saved in settings
|
# Verify if token is saved in settings
|
||||||
elif (s_token != ""):
|
elif (s_token != ""):
|
||||||
self.logMsg("Returning saved (SETTINGS) AccessToken for user: %s Token: %s" % (username, s_token))
|
self.logMsg("Returning saved (SETTINGS) AccessToken for user: %s Token: %s" % (username, s_token),2)
|
||||||
self.WINDOW.setProperty('AccessToken%s' % username, s_token)
|
self.WINDOW.setProperty('AccessToken%s' % username, s_token)
|
||||||
return s_token
|
return s_token
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -61,13 +61,13 @@ class DownloadUtils():
|
||||||
userid = WINDOW.getProperty("userid" + userName)
|
userid = WINDOW.getProperty("userid" + userName)
|
||||||
|
|
||||||
if(userid != None and userid != ""):
|
if(userid != None and userid != ""):
|
||||||
self.logMsg("DownloadUtils -> Returning saved (WINDOW) UserID : " + userid + "UserName: " + userName)
|
self.logMsg("DownloadUtils -> Returning saved (WINDOW) UserID : " + userid + "UserName: " + userName,2)
|
||||||
return userid
|
return userid
|
||||||
|
|
||||||
userid = self.addonSettings.getSetting("userid" + userName)
|
userid = self.addonSettings.getSetting("userid" + userName)
|
||||||
if(userid != None and userid != ""):
|
if(userid != None and userid != ""):
|
||||||
WINDOW.setProperty("userid" + userName, userid)
|
WINDOW.setProperty("userid" + userName, userid)
|
||||||
self.logMsg("DownloadUtils -> Returning saved (SETTING) UserID : " + userid + "UserName: " + userName)
|
self.logMsg("DownloadUtils -> Returning saved (SETTING) UserID : " + userid + "UserName: " + userName,2)
|
||||||
return userid
|
return userid
|
||||||
|
|
||||||
self.logMsg("Looking for user name: " + userName)
|
self.logMsg("Looking for user name: " + userName)
|
||||||
|
@ -130,13 +130,13 @@ class DownloadUtils():
|
||||||
|
|
||||||
token = WINDOW.getProperty("AccessToken" + username)
|
token = WINDOW.getProperty("AccessToken" + username)
|
||||||
if(token != None and token != ""):
|
if(token != None and token != ""):
|
||||||
self.logMsg("DownloadUtils -> Returning saved (WINDOW) AccessToken for user:" + username + " token:" + token)
|
self.logMsg("DownloadUtils -> Returning saved (WINDOW) AccessToken for user:" + username + " token:" + token,2)
|
||||||
return token
|
return token
|
||||||
|
|
||||||
token = self.addonSettings.getSetting("AccessToken" + username)
|
token = self.addonSettings.getSetting("AccessToken" + username)
|
||||||
if(token != None and token != ""):
|
if(token != None and token != ""):
|
||||||
WINDOW.setProperty("AccessToken" + username, token)
|
WINDOW.setProperty("AccessToken" + username, token)
|
||||||
self.logMsg("DownloadUtils -> Returning saved (SETTINGS) AccessToken for user:" + username + " token:" + token)
|
self.logMsg("DownloadUtils -> Returning saved (SETTINGS) AccessToken for user:" + username + " token:" + token,2)
|
||||||
return token
|
return token
|
||||||
|
|
||||||
port = self.addonSettings.getSetting("port")
|
port = self.addonSettings.getSetting("port")
|
||||||
|
@ -234,11 +234,11 @@ class DownloadUtils():
|
||||||
if(authToken != ""):
|
if(authToken != ""):
|
||||||
headers["X-MediaBrowser-Token"] = authToken
|
headers["X-MediaBrowser-Token"] = authToken
|
||||||
|
|
||||||
self.logMsg("Authentication Header : " + str(headers))
|
self.logMsg("Authentication Header : " + str(headers),2)
|
||||||
return headers
|
return headers
|
||||||
|
|
||||||
def downloadUrl(self, url, suppress=False, postBody=None, type="GET", popup=0, authenticate=True ):
|
def downloadUrl(self, url, suppress=False, postBody=None, type="GET", popup=0, authenticate=True ):
|
||||||
self.logMsg("== ENTER: getURL ==")
|
self.logMsg("== ENTER: getURL ==",2)
|
||||||
|
|
||||||
if(authenticate == True and suppress == True):
|
if(authenticate == True and suppress == True):
|
||||||
token = self.authenticate(retreive=False)
|
token = self.authenticate(retreive=False)
|
||||||
|
@ -267,16 +267,16 @@ class DownloadUtils():
|
||||||
server = url.split('/')[serversplit]
|
server = url.split('/')[serversplit]
|
||||||
urlPath = "/"+"/".join(url.split('/')[urlsplit:])
|
urlPath = "/"+"/".join(url.split('/')[urlsplit:])
|
||||||
|
|
||||||
self.logMsg("DOWNLOAD_URL = " + url)
|
self.logMsg("DOWNLOAD_URL = " + url,2)
|
||||||
self.logMsg("server = " + str(server))
|
self.logMsg("server = " + str(server),2)
|
||||||
self.logMsg("urlPath = " + str(urlPath))
|
self.logMsg("urlPath = " + str(urlPath),2)
|
||||||
|
|
||||||
if(server[0:1] == ":" or server[-1:] == ":"):
|
if(server[0:1] == ":" or server[-1:] == ":"):
|
||||||
self.logMsg("No server host or port set in url")
|
self.logMsg("No server host or port set in url")
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
head = self.getAuthHeader(authenticate)
|
head = self.getAuthHeader(authenticate)
|
||||||
self.logMsg("HEADERS : " + str(head), level=1)
|
self.logMsg("HEADERS : " + str(head), level=2)
|
||||||
|
|
||||||
conn = httplib.HTTPConnection(server, timeout=5)
|
conn = httplib.HTTPConnection(server, timeout=5)
|
||||||
|
|
||||||
|
@ -284,7 +284,7 @@ class DownloadUtils():
|
||||||
if(postBody != None):
|
if(postBody != None):
|
||||||
head["Content-Type"] = "application/x-www-form-urlencoded"
|
head["Content-Type"] = "application/x-www-form-urlencoded"
|
||||||
head["Content-Length"] = str(len(postBody))
|
head["Content-Length"] = str(len(postBody))
|
||||||
self.logMsg("POST DATA : " + postBody)
|
self.logMsg("POST DATA : " + postBody,2)
|
||||||
conn.request(method=type, url=urlPath, body=postBody, headers=head)
|
conn.request(method=type, url=urlPath, body=postBody, headers=head)
|
||||||
else:
|
else:
|
||||||
conn.request(method=type, url=urlPath, headers=head)
|
conn.request(method=type, url=urlPath, headers=head)
|
||||||
|
|
|
@ -386,7 +386,6 @@ class LibrarySync():
|
||||||
|
|
||||||
if not matchFound:
|
if not matchFound:
|
||||||
#no match so we have to create it
|
#no match so we have to create it
|
||||||
print "episode not found...creating it: "
|
|
||||||
WriteKodiDB().addEpisodeToKodiLibrary(item)
|
WriteKodiDB().addEpisodeToKodiLibrary(item)
|
||||||
updateNeeded = True
|
updateNeeded = True
|
||||||
|
|
||||||
|
|
|
@ -91,8 +91,7 @@ class Player( xbmc.Player ):
|
||||||
type = data.get("Type")
|
type = data.get("Type")
|
||||||
|
|
||||||
if(refresh_id != None):
|
if(refresh_id != None):
|
||||||
#TODO: trigger update of single item, for now trigger full playcounts update
|
#report updates playcount and resume status to Kodi and MB3
|
||||||
xbmc.log("Invoking refresh of playcounts")
|
|
||||||
librarySync.updatePlayCount(item_id,type)
|
librarySync.updatePlayCount(item_id,type)
|
||||||
|
|
||||||
if(currentPosition != None and self.hasData(runtime)):
|
if(currentPosition != None and self.hasData(runtime)):
|
||||||
|
|
Loading…
Reference in a new issue