Add thumbBlurHash and artBlurHash attributes with includeFields

This commit is contained in:
JonnyWong16 2020-11-21 20:02:31 -08:00
parent 178217a981
commit 9fb3eaf41c
No known key found for this signature in database
GPG key ID: B1F1F9807184697A
4 changed files with 10 additions and 6 deletions

View file

@ -34,6 +34,8 @@ class Audio(PlexPartialObject):
self._data = data
self.listType = 'audio'
self.addedAt = utils.toDatetime(data.attrib.get('addedAt'))
self.art = data.attrib.get('art')
self.artBlurHash = data.attrib.get('artBlurHash')
self.fields = self.findItems(data, etag='Field')
self.index = data.attrib.get('index')
self.key = data.attrib.get('key')
@ -42,6 +44,7 @@ class Audio(PlexPartialObject):
self.ratingKey = utils.cast(int, data.attrib.get('ratingKey'))
self.summary = data.attrib.get('summary')
self.thumb = data.attrib.get('thumb')
self.thumbBlurHash = data.attrib.get('thumbBlurHash')
self.title = data.attrib.get('title')
self.titleSort = data.attrib.get('titleSort', self.title)
self.type = data.attrib.get('type')
@ -126,7 +129,6 @@ class Artist(Audio):
def _loadData(self, data):
""" Load attribute values from Plex XML response. """
Audio._loadData(self, data)
self.art = data.attrib.get('art')
self.guid = data.attrib.get('guid')
self.key = self.key.replace('/children', '') # FIX_BUG_50
self.locations = self.listAttrs(data, 'path', etag='Location')
@ -219,7 +221,6 @@ class Album(Audio):
def _loadData(self, data):
""" Load attribute values from Plex XML response. """
Audio._loadData(self, data)
self.art = data.attrib.get('art')
self.key = self.key.replace('/children', '') # fixes bug #50
self.originallyAvailableAt = utils.toDatetime(data.attrib.get('originallyAvailableAt'), '%Y-%m-%d')
self.parentKey = data.attrib.get('parentKey')
@ -319,7 +320,6 @@ class Track(Audio, Playable):
""" Load attribute values from Plex XML response. """
Audio._loadData(self, data)
Playable._loadData(self, data)
self.art = data.attrib.get('art')
self.chapterSource = data.attrib.get('chapterSource')
self.duration = utils.cast(int, data.attrib.get('duration'))
self.grandparentArt = data.attrib.get('grandparentArt')

View file

@ -102,7 +102,7 @@ class PlexObject(object):
if value not in [False, 0, '0']:
includes[k] = 1 if value is True else value
if includes:
details_key += '?' + urlencode(sorted(includes.items()), doseq=True)
details_key += '?' + urlencode(sorted(includes.items()))
return details_key
def fetchItem(self, ekey, cls=None, **kwargs):
@ -336,7 +336,7 @@ class PlexPartialObject(PlexObject):
'includeConcerts': 1,
'includeExternalMedia': 1,
'includeExtras': 1,
'includeFields': [1, 'thumbBlurHash', 'artBlurHash'],
'includeFields': 'thumbBlurHash,artBlurHash',
'includeGeolocation': 1,
'includeLoudnessRamps': 1,
'includeMarkers': 1,

View file

@ -1434,6 +1434,7 @@ class Collections(PlexPartialObject):
self.ratingKey = utils.cast(int, data.attrib.get('ratingKey'))
self.addedAt = utils.toDatetime(data.attrib.get('addedAt'))
self.art = data.attrib.get('art')
self.artBlurHash = data.attrib.get('artBlurHash')
self.childCount = utils.cast(int, data.attrib.get('childCount'))
self.collectionMode = data.attrib.get('collectionMode')
self.collectionSort = data.attrib.get('collectionSort')
@ -1441,7 +1442,7 @@ class Collections(PlexPartialObject):
self.fields = self.findItems(data, etag='Field')
self.guid = data.attrib.get('guid')
self.index = utils.cast(int, data.attrib.get('index'))
self.key = data.attrib.get('key')
self.key = data.attrib.get('key').replace('/children', '') # FIX_BUG_50
self.labels = self.findItems(data, etag='Label')
self.librarySectionID = data.attrib.get('librarySectionID')
self.librarySectionKey = data.attrib.get('librarySectionKey')
@ -1451,6 +1452,7 @@ class Collections(PlexPartialObject):
self.subtype = data.attrib.get('subtype')
self.summary = data.attrib.get('summary')
self.thumb = data.attrib.get('thumb')
self.thumbBlurHash = data.attrib.get('thumbBlurHash')
self.title = data.attrib.get('title')
self.titleSort = data.attrib.get('titleSort')
self.type = data.attrib.get('type')

View file

@ -35,6 +35,7 @@ class Video(PlexPartialObject):
self.listType = 'video'
self.addedAt = utils.toDatetime(data.attrib.get('addedAt'))
self.art = data.attrib.get('art')
self.artBlurHash = data.attrib.get('artBlurHash')
self.fields = self.findItems(data, etag='Field')
self.key = data.attrib.get('key', '')
self.lastViewedAt = utils.toDatetime(data.attrib.get('lastViewedAt'))
@ -42,6 +43,7 @@ class Video(PlexPartialObject):
self.ratingKey = utils.cast(int, data.attrib.get('ratingKey'))
self.summary = data.attrib.get('summary')
self.thumb = data.attrib.get('thumb')
self.thumbBlurHash = data.attrib.get('thumbBlurHash')
self.title = data.attrib.get('title')
self.titleSort = data.attrib.get('titleSort', self.title)
self.type = data.attrib.get('type')