Update PlexAPI to 4.4.0

This commit is contained in:
JonnyWong16 2021-03-07 12:06:56 -08:00
parent 0e4de17853
commit 6fb4b35076
No known key found for this signature in database
GPG key ID: B1F1F9807184697A
15 changed files with 799 additions and 525 deletions

View file

@ -4,10 +4,11 @@ from urllib.parse import quote_plus
from plexapi import media, utils, video
from plexapi.base import Playable, PlexPartialObject
from plexapi.exceptions import BadRequest
from plexapi.mixins import ArtUrlMixin, ArtMixin, PosterUrlMixin, PosterMixin, TagMixin
@utils.registerPlexObject
class Photoalbum(PlexPartialObject):
class Photoalbum(PlexPartialObject, ArtMixin, PosterMixin):
""" Represents a single Photoalbum (collection of photos).
Attributes:
@ -136,7 +137,7 @@ class Photoalbum(PlexPartialObject):
@utils.registerPlexObject
class Photo(PlexPartialObject, Playable):
class Photo(PlexPartialObject, Playable, ArtUrlMixin, PosterUrlMixin, TagMixin):
""" Represents a single Photo.
Attributes:
@ -163,7 +164,7 @@ class Photo(PlexPartialObject, Playable):
parentTitle (str): Name of the photo album for the photo.
ratingKey (int): Unique key identifying the photo.
summary (str): Summary of the photo.
tag (List<:class:`~plexapi.media.Tag`>): List of tag objects.
tags (List<:class:`~plexapi.media.Tag`>): List of tag objects.
thumb (str): URL to thumbnail image (/library/metadata/<ratingKey>/thumb/<thumbid>).
title (str): Name of the photo.
titleSort (str): Title to use when sorting (defaults to title).
@ -199,7 +200,7 @@ class Photo(PlexPartialObject, Playable):
self.parentTitle = data.attrib.get('parentTitle')
self.ratingKey = utils.cast(int, data.attrib.get('ratingKey'))
self.summary = data.attrib.get('summary')
self.tag = self.findItems(data, media.Tag)
self.tags = self.findItems(data, media.Tag)
self.thumb = data.attrib.get('thumb')
self.title = data.attrib.get('title')
self.titleSort = data.attrib.get('titleSort', self.title)
@ -207,12 +208,6 @@ class Photo(PlexPartialObject, Playable):
self.updatedAt = utils.toDatetime(data.attrib.get('updatedAt'))
self.year = utils.cast(int, data.attrib.get('year'))
@property
def thumbUrl(self):
"""Return URL for the thumbnail image."""
key = self.firstAttr('thumb', 'parentThumb', 'granparentThumb')
return self._server.url(key, includeToken=True) if key else None
def photoalbum(self):
""" Return the photo's :class:`~plexapi.photo.Photoalbum`. """
return self.fetchItem(self.parentKey)