mirror of
https://github.com/pkkid/python-plexapi
synced 2024-11-10 14:14:19 +00:00
Add Playlist attributes doc string
This commit is contained in:
parent
f41be90a3a
commit
b7f813aacd
1 changed files with 22 additions and 5 deletions
|
@ -11,8 +11,26 @@ from plexapi.utils import cast, toDatetime
|
|||
|
||||
@utils.registerPlexObject
|
||||
class Playlist(PlexPartialObject, Playable):
|
||||
""" Represents a single Playlist object.
|
||||
# TODO: Document attributes
|
||||
""" Represents a single Playlist.
|
||||
|
||||
Attributes:
|
||||
TAG (str): 'Playlist'
|
||||
TYPE (str): 'playlist'
|
||||
addedAt (datetime): Datetime the playlist was added to the server.
|
||||
allowSync (bool): True if you allow syncing playlists.
|
||||
composite (str): URL to composite image (/playlist/<ratingKey>/composite/<compositeid>)
|
||||
duration (int): Duration of the playlist in milliseconds.
|
||||
durationInSeconds (int): Duration of the playlist in seconds.
|
||||
guid (str): Plex GUID for the playlist (com.plexapp.agents.none://XXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXX).
|
||||
key (str): API URL (/playlist/<ratingkey>).
|
||||
leafCount (int): Number of items in the playlist view.
|
||||
playlistType (str): 'audio', 'video', or 'photo'
|
||||
ratingKey (int): Unique key identifying the playlist.
|
||||
smart (bool): True if the playlist is a smart playlist.
|
||||
summary (str): Summary of the playlist.
|
||||
title (str): Name of the playlist.
|
||||
type (str): 'playlist'
|
||||
updatedAt (datatime): Datetime the playlist was updated.
|
||||
"""
|
||||
TAG = 'Playlist'
|
||||
TYPE = 'playlist'
|
||||
|
@ -21,12 +39,12 @@ class Playlist(PlexPartialObject, Playable):
|
|||
""" Load attribute values from Plex XML response. """
|
||||
Playable._loadData(self, data)
|
||||
self.addedAt = toDatetime(data.attrib.get('addedAt'))
|
||||
self.allowSync = cast(bool, data.attrib.get('allowSync'))
|
||||
self.composite = data.attrib.get('composite') # url to thumbnail
|
||||
self.duration = cast(int, data.attrib.get('duration'))
|
||||
self.durationInSeconds = cast(int, data.attrib.get('durationInSeconds'))
|
||||
self.guid = data.attrib.get('guid')
|
||||
self.key = data.attrib.get('key')
|
||||
self.key = self.key.replace('/items', '') if self.key else self.key # FIX_BUG_50
|
||||
self.key = data.attrib.get('key', '').replace('/items', '') # FIX_BUG_50
|
||||
self.leafCount = cast(int, data.attrib.get('leafCount'))
|
||||
self.playlistType = data.attrib.get('playlistType')
|
||||
self.ratingKey = cast(int, data.attrib.get('ratingKey'))
|
||||
|
@ -35,7 +53,6 @@ class Playlist(PlexPartialObject, Playable):
|
|||
self.title = data.attrib.get('title')
|
||||
self.type = data.attrib.get('type')
|
||||
self.updatedAt = toDatetime(data.attrib.get('updatedAt'))
|
||||
self.allowSync = cast(bool, data.attrib.get('allowSync'))
|
||||
self._items = None # cache for self.items
|
||||
|
||||
def __len__(self): # pragma: no cover
|
||||
|
|
Loading…
Reference in a new issue