add check for show media type

gather show location and total size from episodes
This commit is contained in:
blacktwin
2020-03-09 11:51:40 -04:00
parent 1073642054
commit 98f4fe0742

View File

@ -112,15 +112,14 @@ class Metadata(object):
elif not self.title: elif not self.title:
self.title = self.full_title self.title = self.full_title
# For History if self.media_type == 'show':
if d.get('watched_status'): show = plex.fetchItem(int(self.rating_key))
self.watched_status = d['watched_status'] self.file = show.locations[0]
# For Metadata show_size = []
if d.get("library_name"): episodes = show.episodes()
self.libraryName = d['library_name'] for episode in episodes:
show_size.append(episode.media[0].parts[0].size)
if d.get('added_at'): self.file_size = sum(show_size)
self.added_at = d['added_at']
class User(object): class User(object):