mirror of
https://github.com/pkkid/python-plexapi
synced 2024-11-10 06:04:15 +00:00
Add back missing index value from Show,Season,Episode; Make season numbers a bit easier to fetch
This commit is contained in:
parent
5701af7ed4
commit
36b5d12a19
1 changed files with 15 additions and 0 deletions
|
@ -114,6 +114,7 @@ class Show(Video):
|
||||||
self.contentRating = data.attrib.get('contentRating', NA)
|
self.contentRating = data.attrib.get('contentRating', NA)
|
||||||
self.duration = utils.cast(int, data.attrib.get('duration', NA))
|
self.duration = utils.cast(int, data.attrib.get('duration', NA))
|
||||||
self.guid = data.attrib.get('guid', NA)
|
self.guid = data.attrib.get('guid', NA)
|
||||||
|
self.index = data.attrib.get('index', NA)
|
||||||
self.leafCount = utils.cast(int, data.attrib.get('leafCount', NA))
|
self.leafCount = utils.cast(int, data.attrib.get('leafCount', NA))
|
||||||
self.location = utils.findLocations(data, single=True)
|
self.location = utils.findLocations(data, single=True)
|
||||||
self.originallyAvailableAt = utils.toDatetime(data.attrib.get('originallyAvailableAt', NA), '%Y-%m-%d')
|
self.originallyAvailableAt = utils.toDatetime(data.attrib.get('originallyAvailableAt', NA), '%Y-%m-%d')
|
||||||
|
@ -170,6 +171,7 @@ class Season(Video):
|
||||||
def _loadData(self, data):
|
def _loadData(self, data):
|
||||||
Video._loadData(self, data)
|
Video._loadData(self, data)
|
||||||
self.leafCount = utils.cast(int, data.attrib.get('leafCount', NA))
|
self.leafCount = utils.cast(int, data.attrib.get('leafCount', NA))
|
||||||
|
self.index = data.attrib.get('index', NA)
|
||||||
self.parentKey = data.attrib.get('parentKey', NA)
|
self.parentKey = data.attrib.get('parentKey', NA)
|
||||||
self.parentRatingKey = data.attrib.get('parentRatingKey', NA)
|
self.parentRatingKey = data.attrib.get('parentRatingKey', NA)
|
||||||
self.viewedLeafCount = utils.cast(int, data.attrib.get('viewedLeafCount', NA))
|
self.viewedLeafCount = utils.cast(int, data.attrib.get('viewedLeafCount', NA))
|
||||||
|
@ -178,6 +180,10 @@ class Season(Video):
|
||||||
def isWatched(self):
|
def isWatched(self):
|
||||||
return bool(self.viewedLeafCount == self.leafCount)
|
return bool(self.viewedLeafCount == self.leafCount)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def seasonNumber(self):
|
||||||
|
return self.index
|
||||||
|
|
||||||
def episodes(self, watched=None):
|
def episodes(self, watched=None):
|
||||||
childrenKey = '/library/metadata/%s/children' % self.ratingKey
|
childrenKey = '/library/metadata/%s/children' % self.ratingKey
|
||||||
return utils.listItems(self.server, childrenKey, watched=watched)
|
return utils.listItems(self.server, childrenKey, watched=watched)
|
||||||
|
@ -217,6 +223,7 @@ class Episode(Video, Playable):
|
||||||
self.grandparentThumb = data.attrib.get('grandparentThumb', NA)
|
self.grandparentThumb = data.attrib.get('grandparentThumb', NA)
|
||||||
self.grandparentTitle = data.attrib.get('grandparentTitle', NA)
|
self.grandparentTitle = data.attrib.get('grandparentTitle', NA)
|
||||||
self.guid = data.attrib.get('guid', NA)
|
self.guid = data.attrib.get('guid', NA)
|
||||||
|
self.index = data.attrib.get('index', NA)
|
||||||
self.originallyAvailableAt = utils.toDatetime(data.attrib.get('originallyAvailableAt', NA), '%Y-%m-%d')
|
self.originallyAvailableAt = utils.toDatetime(data.attrib.get('originallyAvailableAt', NA), '%Y-%m-%d')
|
||||||
self.parentIndex = data.attrib.get('parentIndex', NA)
|
self.parentIndex = data.attrib.get('parentIndex', NA)
|
||||||
self.parentKey = data.attrib.get('parentKey', NA)
|
self.parentKey = data.attrib.get('parentKey', NA)
|
||||||
|
@ -237,11 +244,19 @@ class Episode(Video, Playable):
|
||||||
self.username = utils.findUsername(data)
|
self.username = utils.findUsername(data)
|
||||||
self.player = utils.findPlayer(self.server, data)
|
self.player = utils.findPlayer(self.server, data)
|
||||||
self.transcodeSession = utils.findTranscodeSession(self.server, data)
|
self.transcodeSession = utils.findTranscodeSession(self.server, data)
|
||||||
|
# Cached season number
|
||||||
|
self._seasonNumber = None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def isWatched(self):
|
def isWatched(self):
|
||||||
return bool(self.viewCount > 0)
|
return bool(self.viewCount > 0)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def seasonNumber(self):
|
||||||
|
if self._seasonNumber is None:
|
||||||
|
self._seasonNumber = self.parentIndex if self.parentIndex else self.season().seasonNumber
|
||||||
|
return self._seasonNumber
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def thumbUrl(self):
|
def thumbUrl(self):
|
||||||
return self.server.url(self.grandparentThumb)
|
return self.server.url(self.grandparentThumb)
|
||||||
|
|
Loading…
Reference in a new issue