mirror of
https://github.com/pkkid/python-plexapi
synced 2024-11-22 11:43:13 +00:00
Remove check for playQueueType when adding items to a PlayQueue (#977)
* Remove check for playQueueType when adding items to a PlayQueue * Fix PlayQueue doc strings
This commit is contained in:
parent
9f7f11ba9c
commit
f5673294c7
1 changed files with 6 additions and 13 deletions
|
@ -3,7 +3,7 @@ from urllib.parse import quote_plus
|
||||||
|
|
||||||
from plexapi import utils
|
from plexapi import utils
|
||||||
from plexapi.base import PlexObject
|
from plexapi.base import PlexObject
|
||||||
from plexapi.exceptions import BadRequest, Unsupported
|
from plexapi.exceptions import BadRequest
|
||||||
|
|
||||||
|
|
||||||
class PlayQueue(PlexObject):
|
class PlayQueue(PlexObject):
|
||||||
|
@ -13,7 +13,7 @@ class PlayQueue(PlexObject):
|
||||||
TAG (str): 'PlayQueue'
|
TAG (str): 'PlayQueue'
|
||||||
TYPE (str): 'playqueue'
|
TYPE (str): 'playqueue'
|
||||||
identifier (str): com.plexapp.plugins.library
|
identifier (str): com.plexapp.plugins.library
|
||||||
items (list): List of :class:`~plexapi.media.Media` or :class:`~plexapi.playlist.Playlist`
|
items (list): List of :class:`~plexapi.base.Playable` or :class:`~plexapi.playlist.Playlist`
|
||||||
mediaTagPrefix (str): Fx /system/bundle/media/flags/
|
mediaTagPrefix (str): Fx /system/bundle/media/flags/
|
||||||
mediaTagVersion (int): Fx 1485957738
|
mediaTagVersion (int): Fx 1485957738
|
||||||
playQueueID (int): ID of the PlayQueue.
|
playQueueID (int): ID of the PlayQueue.
|
||||||
|
@ -27,7 +27,7 @@ class PlayQueue(PlexObject):
|
||||||
playQueueSourceURI (str): Original URI used to create the PlayQueue.
|
playQueueSourceURI (str): Original URI used to create the PlayQueue.
|
||||||
playQueueTotalCount (int): How many items in the PlayQueue.
|
playQueueTotalCount (int): How many items in the PlayQueue.
|
||||||
playQueueVersion (int): Version of the PlayQueue. Increments every time a change is made to the PlayQueue.
|
playQueueVersion (int): Version of the PlayQueue. Increments every time a change is made to the PlayQueue.
|
||||||
selectedItem (:class:`~plexapi.media.Media`): Media object for the currently selected item.
|
selectedItem (:class:`~plexapi.base.Playable`): Media object for the currently selected item.
|
||||||
_server (:class:`~plexapi.server.PlexServer`): PlexServer associated with the PlayQueue.
|
_server (:class:`~plexapi.server.PlexServer`): PlexServer associated with the PlayQueue.
|
||||||
size (int): Alias for playQueueTotalCount.
|
size (int): Alias for playQueueTotalCount.
|
||||||
"""
|
"""
|
||||||
|
@ -150,9 +150,9 @@ class PlayQueue(PlexObject):
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
server (:class:`~plexapi.server.PlexServer`): Server you are connected to.
|
server (:class:`~plexapi.server.PlexServer`): Server you are connected to.
|
||||||
items (:class:`~plexapi.media.Media` or :class:`~plexapi.playlist.Playlist`):
|
items (:class:`~plexapi.base.Playable` or :class:`~plexapi.playlist.Playlist`):
|
||||||
A media item, list of media items, or Playlist.
|
A media item, list of media items, or Playlist.
|
||||||
startItem (:class:`~plexapi.media.Media`, optional):
|
startItem (:class:`~plexapi.base.Playable`, optional):
|
||||||
Media item in the PlayQueue where playback should begin.
|
Media item in the PlayQueue where playback should begin.
|
||||||
shuffle (int, optional): Start the playqueue shuffled.
|
shuffle (int, optional): Start the playqueue shuffled.
|
||||||
repeat (int, optional): Start the playqueue shuffled.
|
repeat (int, optional): Start the playqueue shuffled.
|
||||||
|
@ -191,7 +191,6 @@ class PlayQueue(PlexObject):
|
||||||
path = "/playQueues{args}".format(args=utils.joinArgs(args))
|
path = "/playQueues{args}".format(args=utils.joinArgs(args))
|
||||||
data = server.query(path, method=server._session.post)
|
data = server.query(path, method=server._session.post)
|
||||||
c = cls(server, data, initpath=path)
|
c = cls(server, data, initpath=path)
|
||||||
c.playQueueType = args["type"]
|
|
||||||
c._server = server
|
c._server = server
|
||||||
return c
|
return c
|
||||||
|
|
||||||
|
@ -227,7 +226,6 @@ class PlayQueue(PlexObject):
|
||||||
path = f"/playQueues{utils.joinArgs(args)}"
|
path = f"/playQueues{utils.joinArgs(args)}"
|
||||||
data = server.query(path, method=server._session.post)
|
data = server.query(path, method=server._session.post)
|
||||||
c = cls(server, data, initpath=path)
|
c = cls(server, data, initpath=path)
|
||||||
c.playQueueType = args["type"]
|
|
||||||
c._server = server
|
c._server = server
|
||||||
return c
|
return c
|
||||||
|
|
||||||
|
@ -237,7 +235,7 @@ class PlayQueue(PlexObject):
|
||||||
Items can only be added to the section immediately following the current playing item.
|
Items can only be added to the section immediately following the current playing item.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
item (:class:`~plexapi.media.Media` or :class:`~plexapi.playlist.Playlist`): Single media item or Playlist.
|
item (:class:`~plexapi.base.Playable` or :class:`~plexapi.playlist.Playlist`): Single media item or Playlist.
|
||||||
playNext (bool, optional): If True, add this item to the front of the "Up Next" section.
|
playNext (bool, optional): If True, add this item to the front of the "Up Next" section.
|
||||||
If False, the item will be appended to the end of the "Up Next" section.
|
If False, the item will be appended to the end of the "Up Next" section.
|
||||||
Only has an effect if an item has already been added to the "Up Next" section.
|
Only has an effect if an item has already been added to the "Up Next" section.
|
||||||
|
@ -250,15 +248,10 @@ class PlayQueue(PlexObject):
|
||||||
args = {}
|
args = {}
|
||||||
if item.type == "playlist":
|
if item.type == "playlist":
|
||||||
args["playlistID"] = item.ratingKey
|
args["playlistID"] = item.ratingKey
|
||||||
itemType = item.playlistType
|
|
||||||
else:
|
else:
|
||||||
uuid = item.section().uuid
|
uuid = item.section().uuid
|
||||||
itemType = item.listType
|
|
||||||
args["uri"] = "library://{uuid}/item{key}".format(uuid=uuid, key=item.key)
|
args["uri"] = "library://{uuid}/item{key}".format(uuid=uuid, key=item.key)
|
||||||
|
|
||||||
if itemType != self.playQueueType:
|
|
||||||
raise Unsupported("Item type does not match PlayQueue type")
|
|
||||||
|
|
||||||
if playNext:
|
if playNext:
|
||||||
args["next"] = 1
|
args["next"] = 1
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue