Merge pull request #400 from pkkid/photo_tags

photo_tags
This commit is contained in:
Steffen Fredriksen 2019-11-28 23:14:45 +01:00 committed by GitHub
commit ba1f3a2b69
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 1 deletions

View file

@ -869,7 +869,7 @@ class PhotoSection(LibrarySection):
TYPE (str): 'photo'
"""
ALLOWED_FILTERS = ('all', 'iso', 'make', 'lens', 'aperture', 'exposure', 'device', 'resolution', 'place',
'originallyAvailableAt', 'addedAt', 'title', 'userRating')
'originallyAvailableAt', 'addedAt', 'title', 'userRating', 'tag', 'year')
ALLOWED_SORT = ('addedAt',)
TAG = 'Directory'
TYPE = 'photo'

View file

@ -419,6 +419,25 @@ class Label(MediaTag):
FILTER = 'label'
@utils.registerPlexObject
class Tag(MediaTag):
""" Represents a single tag media tag.
Attributes:
TAG (str): 'tag'
FILTER (str): 'tag'
"""
TAG = 'Tag'
FILTER = 'tag'
def _loadData(self, data):
self._data = data
self.id = cast(int, data.attrib.get('id', 0))
self.filter = data.attrib.get('filter')
self.tag = data.attrib.get('tag')
self.title = self.tag
@utils.registerPlexObject
class Country(MediaTag):
""" Represents a single Country media tag.

View file

@ -117,6 +117,7 @@ class Photo(PlexPartialObject):
self.updatedAt = utils.toDatetime(data.attrib.get('updatedAt'))
self.year = utils.cast(int, data.attrib.get('year'))
self.media = self.findItems(data, media.Media)
self.tag = self.findItems(data, media.Tag)
def photoalbum(self):
""" Return this photo's :class:`~plexapi.photo.Photoalbum`. """