Fix moving of items in Plex playqueue
This commit is contained in:
parent
dc56c2a6a2
commit
b586ac09c4
1 changed files with 10 additions and 11 deletions
|
@ -403,17 +403,10 @@ class PlayQueue(object):
|
||||||
|
|
||||||
Will also change self.items
|
Will also change self.items
|
||||||
"""
|
"""
|
||||||
if before > len(self.items):
|
if before > len(self.items) or after > len(self.items) or after == before:
|
||||||
raise PlaylistError('Original position %s larger than current '
|
raise PlaylistError('Illegal original position %s and/or desired '
|
||||||
'playlist length %s',
|
'position %s for playlist length %s' %
|
||||||
before, len(self.items))
|
(before, after, len(self.items)))
|
||||||
elif after > len(self.items):
|
|
||||||
raise PlaylistError('Desired position %s larger than current '
|
|
||||||
'playlist length %s',
|
|
||||||
after, len(self.items))
|
|
||||||
elif after == before:
|
|
||||||
raise PlaylistError('Desired position and original position are '
|
|
||||||
'identical: %s', after)
|
|
||||||
LOG.debug('Moving item from %s to %s on the Plex side for %s',
|
LOG.debug('Moving item from %s to %s on the Plex side for %s',
|
||||||
before, after, self)
|
before, after, self)
|
||||||
if after == 0:
|
if after == 0:
|
||||||
|
@ -421,6 +414,12 @@ class PlayQueue(object):
|
||||||
(self.kind,
|
(self.kind,
|
||||||
self.id,
|
self.id,
|
||||||
self.items[before].id)
|
self.items[before].id)
|
||||||
|
elif after > before:
|
||||||
|
url = "{server}/%ss/%s/items/%s/move?after=%s" % \
|
||||||
|
(self.kind,
|
||||||
|
self.id,
|
||||||
|
self.items[before].id,
|
||||||
|
self.items[after].id)
|
||||||
else:
|
else:
|
||||||
url = "{server}/%ss/%s/items/%s/move?after=%s" % \
|
url = "{server}/%ss/%s/items/%s/move?after=%s" % \
|
||||||
(self.kind,
|
(self.kind,
|
||||||
|
|
Loading…
Reference in a new issue