Small fixes
This commit is contained in:
parent
b2a9f1a453
commit
9103f0516f
3 changed files with 23 additions and 22 deletions
|
@ -331,6 +331,8 @@ class DownloadUtils():
|
||||||
if r.text == '' and r.status_code == 200:
|
if r.text == '' and r.status_code == 200:
|
||||||
self.logMsg("====== 200 Success ======", 2)
|
self.logMsg("====== 200 Success ======", 2)
|
||||||
self.logMsg("Answer from PMS does not contain a body", 2)
|
self.logMsg("Answer from PMS does not contain a body", 2)
|
||||||
|
self.logMsg("Unable to convert the response for: %s" % url, 2)
|
||||||
|
self.logMsg("Content-type was: %s" % r.headers['content-type'], 2)
|
||||||
except:
|
except:
|
||||||
self.logMsg("Unable to convert the response for: %s" % url, 2)
|
self.logMsg("Unable to convert the response for: %s" % url, 2)
|
||||||
self.logMsg("Content-type was: %s" % r.headers['content-type'], 2)
|
self.logMsg("Content-type was: %s" % r.headers['content-type'], 2)
|
||||||
|
|
|
@ -34,10 +34,9 @@ def doPlayback(itemid, dbid):
|
||||||
# Get a first XML to get the librarySectionUUID
|
# Get a first XML to get the librarySectionUUID
|
||||||
item = PlexAPI.PlexAPI().GetPlexMetadata(itemid)
|
item = PlexAPI.PlexAPI().GetPlexMetadata(itemid)
|
||||||
# Use that to call the playlist
|
# Use that to call the playlist
|
||||||
playlist = PlexAPI.API(item).GetPlexPlaylist()
|
xmlPlaylist = PlexAPI.API(item).GetPlexPlaylist()
|
||||||
if playlist:
|
if xmlPlaylist:
|
||||||
pbutils.PlaybackUtils(playlist).play(itemid, dbid)
|
pbutils.PlaybackUtils(xmlPlaylist).play(itemid, dbid)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# No playlist received e.g. when directly playing trailers
|
# No playlist received e.g. when directly playing trailers
|
||||||
pbutils.PlaybackUtils(item).play(itemid, dbid)
|
pbutils.PlaybackUtils(item).play(itemid, dbid)
|
||||||
|
@ -48,7 +47,7 @@ def resetAuth():
|
||||||
resp = xbmcgui.Dialog().yesno(
|
resp = xbmcgui.Dialog().yesno(
|
||||||
heading="Warning",
|
heading="Warning",
|
||||||
line1=(
|
line1=(
|
||||||
"Emby might lock your account if you fail to log in too many times. "
|
"Plex might lock your account if you fail to log in too many times. "
|
||||||
"Proceed anyway?"))
|
"Proceed anyway?"))
|
||||||
if resp == 1:
|
if resp == 1:
|
||||||
utils.logMsg("EMBY", "Reset login attempts.", 1)
|
utils.logMsg("EMBY", "Reset login attempts.", 1)
|
||||||
|
|
|
@ -298,7 +298,7 @@ class Player(xbmc.Player):
|
||||||
# }
|
# }
|
||||||
if paused == 'stopped':
|
if paused == 'stopped':
|
||||||
state = 'stopped'
|
state = 'stopped'
|
||||||
elif paused == 'True':
|
elif paused is True:
|
||||||
state = 'paused'
|
state = 'paused'
|
||||||
else:
|
else:
|
||||||
state = 'playing'
|
state = 'playing'
|
||||||
|
@ -458,7 +458,7 @@ class Player(xbmc.Player):
|
||||||
|
|
||||||
if currentPosition and runtime:
|
if currentPosition and runtime:
|
||||||
try:
|
try:
|
||||||
percentComplete = (currentPosition * 10000000) / int(runtime)
|
percentComplete = (currentPosition * 10000) / int(runtime)
|
||||||
except ZeroDivisionError:
|
except ZeroDivisionError:
|
||||||
# Runtime is 0.
|
# Runtime is 0.
|
||||||
percentComplete = 0
|
percentComplete = 0
|
||||||
|
@ -507,18 +507,18 @@ class Player(xbmc.Player):
|
||||||
self.played_info.clear()
|
self.played_info.clear()
|
||||||
|
|
||||||
def stopPlayback(self, data):
|
def stopPlayback(self, data):
|
||||||
|
|
||||||
self.logMsg("stopPlayback called", 2)
|
self.logMsg("stopPlayback called", 2)
|
||||||
|
|
||||||
itemId = data['item_id']
|
itemId = data['item_id']
|
||||||
currentPosition = data['currentPosition']
|
playTime = data['currentPosition']
|
||||||
positionTicks = int(currentPosition * 10000000)
|
duration = data.get('runtime', '')
|
||||||
|
|
||||||
url = "{server}/emby/Sessions/Playing/Stopped"
|
url = "{server}/:/timeline?"
|
||||||
postdata = {
|
args = {
|
||||||
|
'ratingKey': itemId,
|
||||||
'ItemId': itemId,
|
'state': 'stopped', # 'stopped', 'paused', 'buffering', 'playing'
|
||||||
'MediaSourceId': itemId,
|
'time': int(playTime) * 1000,
|
||||||
'PositionTicks': positionTicks
|
'duration': int(duration) * 1000
|
||||||
}
|
}
|
||||||
self.doUtils.downloadUrl(url, postBody=postdata, type="POST")
|
url = url + urlencode(args)
|
||||||
|
self.doUtils.downloadUrl(url, type="GET")
|
||||||
|
|
Loading…
Reference in a new issue