mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-25 02:06:09 +00:00
cleanup
This commit is contained in:
parent
d78c04d67f
commit
d080c49821
6 changed files with 174 additions and 175 deletions
|
@ -143,7 +143,7 @@ if __name__ == '__main__':
|
||||||
doUtils = downloadutils.DownloadUtils()
|
doUtils = downloadutils.DownloadUtils()
|
||||||
url = "{server}/emby/Items/%s?format=json" % embyid
|
url = "{server}/emby/Items/%s?format=json" % embyid
|
||||||
logMsg("Deleting request: %s" % embyid, 0)
|
logMsg("Deleting request: %s" % embyid, 0)
|
||||||
doUtils.downloadUrl(url, type="DELETE")
|
doUtils.downloadUrl(url, action_type="DELETE")
|
||||||
|
|
||||||
'''if utils.settings('skipContextMenu') != "true":
|
'''if utils.settings('skipContextMenu') != "true":
|
||||||
if xbmcgui.Dialog().yesno(
|
if xbmcgui.Dialog().yesno(
|
||||||
|
@ -152,8 +152,7 @@ if __name__ == '__main__':
|
||||||
"also delete the file(s) from disk!")):
|
"also delete the file(s) from disk!")):
|
||||||
import downloadutils
|
import downloadutils
|
||||||
doUtils = downloadutils.DownloadUtils()
|
doUtils = downloadutils.DownloadUtils()
|
||||||
url = "{server}/emby/Items/%s?format=json" % embyid
|
doUtils.downloadUrl("{server}/emby/Items/%s?format=json" % embyid, action_type="DELETE")'''
|
||||||
doUtils.downloadUrl(url, type="DELETE")'''
|
|
||||||
|
|
||||||
xbmc.sleep(500)
|
xbmc.sleep(500)
|
||||||
xbmc.executebuiltin("Container.Update")
|
xbmc.executebuiltin("Container.Update")
|
|
@ -97,7 +97,7 @@ class DownloadUtils():
|
||||||
self.logMsg("Capabilities URL: %s" % url, 2)
|
self.logMsg("Capabilities URL: %s" % url, 2)
|
||||||
self.logMsg("Postdata: %s" % data, 2)
|
self.logMsg("Postdata: %s" % data, 2)
|
||||||
|
|
||||||
self.downloadUrl(url, postBody=data, type="POST")
|
self.downloadUrl(url, postBody=data, action_type="POST")
|
||||||
self.logMsg("Posted capabilities to %s" % self.server, 2)
|
self.logMsg("Posted capabilities to %s" % self.server, 2)
|
||||||
|
|
||||||
# Attempt at getting sessionId
|
# Attempt at getting sessionId
|
||||||
|
@ -140,7 +140,7 @@ class DownloadUtils():
|
||||||
"{server}/emby/Sessions/%s/Users/%s?format=json"
|
"{server}/emby/Sessions/%s/Users/%s?format=json"
|
||||||
% (sessionId, userId)
|
% (sessionId, userId)
|
||||||
)
|
)
|
||||||
self.downloadUrl(url, postBody={}, type="POST")
|
self.downloadUrl(url, postBody={}, action_type="POST")
|
||||||
|
|
||||||
|
|
||||||
def startSession(self):
|
def startSession(self):
|
||||||
|
|
|
@ -166,7 +166,7 @@ def deleteItem():
|
||||||
doUtils = downloadutils.DownloadUtils()
|
doUtils = downloadutils.DownloadUtils()
|
||||||
url = "{server}/emby/Items/%s?format=json" % embyid
|
url = "{server}/emby/Items/%s?format=json" % embyid
|
||||||
utils.logMsg("EMBY delete", "Deleting request: %s" % embyid, 0)
|
utils.logMsg("EMBY delete", "Deleting request: %s" % embyid, 0)
|
||||||
doUtils.downloadUrl(url, type="DELETE")
|
doUtils.downloadUrl(url, action_type="DELETE")
|
||||||
|
|
||||||
##### ADD ADDITIONAL USERS #####
|
##### ADD ADDITIONAL USERS #####
|
||||||
def addUser():
|
def addUser():
|
||||||
|
@ -221,7 +221,7 @@ def addUser():
|
||||||
selected = additionalUsername[resp]
|
selected = additionalUsername[resp]
|
||||||
selected_userId = additionalUserlist[selected]
|
selected_userId = additionalUserlist[selected]
|
||||||
url = "{server}/emby/Sessions/%s/Users/%s" % (sessionId, selected_userId)
|
url = "{server}/emby/Sessions/%s/Users/%s" % (sessionId, selected_userId)
|
||||||
doUtils.downloadUrl(url, postBody={}, type="DELETE")
|
doUtils.downloadUrl(url, postBody={}, action_type="DELETE")
|
||||||
dialog.notification(
|
dialog.notification(
|
||||||
heading="Success!",
|
heading="Success!",
|
||||||
message="%s removed from viewing session" % selected,
|
message="%s removed from viewing session" % selected,
|
||||||
|
@ -254,7 +254,7 @@ def addUser():
|
||||||
selected = users[resp]
|
selected = users[resp]
|
||||||
selected_userId = userlist[selected]
|
selected_userId = userlist[selected]
|
||||||
url = "{server}/emby/Sessions/%s/Users/%s" % (sessionId, selected_userId)
|
url = "{server}/emby/Sessions/%s/Users/%s" % (sessionId, selected_userId)
|
||||||
doUtils.downloadUrl(url, postBody={}, type="POST")
|
doUtils.downloadUrl(url, postBody={}, action_type="POST")
|
||||||
dialog.notification(
|
dialog.notification(
|
||||||
heading="Success!",
|
heading="Success!",
|
||||||
message="%s added to viewing session" % selected,
|
message="%s added to viewing session" % selected,
|
||||||
|
|
|
@ -154,10 +154,10 @@ class KodiMonitor(xbmc.Monitor):
|
||||||
# notify the server
|
# notify the server
|
||||||
url = "{server}/emby/Users/{UserId}/PlayedItems/%s?format=json" % itemid
|
url = "{server}/emby/Users/{UserId}/PlayedItems/%s?format=json" % itemid
|
||||||
if playcount != 0:
|
if playcount != 0:
|
||||||
doUtils.downloadUrl(url, type="POST")
|
doUtils.downloadUrl(url, action_type="POST")
|
||||||
self.logMsg("Mark as watched for itemid: %s" % itemid, 1)
|
self.logMsg("Mark as watched for itemid: %s" % itemid, 1)
|
||||||
else:
|
else:
|
||||||
doUtils.downloadUrl(url, type="DELETE")
|
doUtils.downloadUrl(url, action_type="DELETE")
|
||||||
self.logMsg("Mark as unwatched for itemid: %s" % itemid, 1)
|
self.logMsg("Mark as unwatched for itemid: %s" % itemid, 1)
|
||||||
finally:
|
finally:
|
||||||
embycursor.close()
|
embycursor.close()
|
||||||
|
@ -195,7 +195,7 @@ class KodiMonitor(xbmc.Monitor):
|
||||||
|
|
||||||
url = "{server}/emby/Items/%s?format=json" % itemid
|
url = "{server}/emby/Items/%s?format=json" % itemid
|
||||||
self.logMsg("Deleting request: %s" % itemid)
|
self.logMsg("Deleting request: %s" % itemid)
|
||||||
doUtils.downloadUrl(url, type="DELETE")
|
doUtils.downloadUrl(url, action_type="DELETE")
|
||||||
finally:
|
finally:
|
||||||
embycursor.close()'''
|
embycursor.close()'''
|
||||||
|
|
||||||
|
|
|
@ -208,7 +208,7 @@ class Player(xbmc.Player):
|
||||||
|
|
||||||
# Post playback to server
|
# Post playback to server
|
||||||
self.logMsg("Sending POST play started: %s." % postdata, 2)
|
self.logMsg("Sending POST play started: %s." % postdata, 2)
|
||||||
self.doUtils(url, postBody=postdata, type="POST")
|
self.doUtils(url, postBody=postdata, action_type="POST")
|
||||||
|
|
||||||
# Ensure we do have a runtime
|
# Ensure we do have a runtime
|
||||||
try:
|
try:
|
||||||
|
@ -480,7 +480,7 @@ class Player(xbmc.Player):
|
||||||
|
|
||||||
url = "{server}/emby/Items/%s?format=json" % itemid
|
url = "{server}/emby/Items/%s?format=json" % itemid
|
||||||
self.logMsg("Deleting request: %s" % itemid, 1)
|
self.logMsg("Deleting request: %s" % itemid, 1)
|
||||||
self.doUtils(url, type="DELETE")
|
self.doUtils(url, action_type="DELETE")
|
||||||
|
|
||||||
self.stopPlayback(data)
|
self.stopPlayback(data)
|
||||||
|
|
||||||
|
@ -489,7 +489,7 @@ class Player(xbmc.Player):
|
||||||
self.logMsg("Transcoding for %s terminated." % itemid, 1)
|
self.logMsg("Transcoding for %s terminated." % itemid, 1)
|
||||||
deviceId = self.clientInfo.getDeviceId()
|
deviceId = self.clientInfo.getDeviceId()
|
||||||
url = "{server}/emby/Videos/ActiveEncodings?DeviceId=%s" % deviceId
|
url = "{server}/emby/Videos/ActiveEncodings?DeviceId=%s" % deviceId
|
||||||
self.doUtils(url, type="DELETE")
|
self.doUtils(url, action_type="DELETE")
|
||||||
|
|
||||||
self.played_info.clear()
|
self.played_info.clear()
|
||||||
|
|
||||||
|
@ -508,4 +508,4 @@ class Player(xbmc.Player):
|
||||||
'MediaSourceId': itemId,
|
'MediaSourceId': itemId,
|
||||||
'PositionTicks': positionTicks
|
'PositionTicks': positionTicks
|
||||||
}
|
}
|
||||||
self.doUtils(url, postBody=postdata, type="POST")
|
self.doUtils(url, postBody=postdata, action_type="POST")
|
|
@ -522,16 +522,16 @@ class Read_EmbyServer():
|
||||||
# Updates the user rating to Emby
|
# Updates the user rating to Emby
|
||||||
|
|
||||||
if favourite:
|
if favourite:
|
||||||
self.doUtils("{server}/emby/Users/{UserId}/FavoriteItems/%s?format=json" % itemid, type="POST")
|
self.doUtils("{server}/emby/Users/{UserId}/FavoriteItems/%s?format=json" % itemid, action_type="POST")
|
||||||
elif favourite == False:
|
elif favourite == False:
|
||||||
self.doUtils("{server}/emby/Users/{UserId}/FavoriteItems/%s?format=json" % itemid, type="DELETE")
|
self.doUtils("{server}/emby/Users/{UserId}/FavoriteItems/%s?format=json" % itemid, action_type="DELETE")
|
||||||
|
|
||||||
if not deletelike and like:
|
if not deletelike and like:
|
||||||
self.doUtils("{server}/emby/Users/{UserId}/Items/%s/Rating?Likes=true&format=json" % itemid, type="POST")
|
self.doUtils("{server}/emby/Users/{UserId}/Items/%s/Rating?Likes=true&format=json" % itemid, action_type="POST")
|
||||||
elif not deletelike and like is False:
|
elif not deletelike and like is False:
|
||||||
self.doUtils("{server}/emby/Users/{UserId}/Items/%s/Rating?Likes=false&format=json" % itemid, type="POST")
|
self.doUtils("{server}/emby/Users/{UserId}/Items/%s/Rating?Likes=false&format=json" % itemid, action_type="POST")
|
||||||
elif deletelike:
|
elif deletelike:
|
||||||
self.doUtils("{server}/emby/Users/{UserId}/Items/%s/Rating?format=json" % itemid, type="DELETE")
|
self.doUtils("{server}/emby/Users/{UserId}/Items/%s/Rating?format=json" % itemid, action_type="DELETE")
|
||||||
|
|
||||||
self.logMsg("Update user rating to emby for itemid: %s "
|
self.logMsg("Update user rating to emby for itemid: %s "
|
||||||
"| like: %s | favourite: %s | deletelike: %s"
|
"| like: %s | favourite: %s | deletelike: %s"
|
||||||
|
|
Loading…
Reference in a new issue