Add custom fields for manually exporting season/episode images

This commit is contained in:
JonnyWong16 2020-10-03 10:04:43 -07:00
commit 4d033bb379
No known key found for this signature in database
GPG key ID: B1F1F9807184697A

View file

@ -47,19 +47,19 @@ else:
class Export(object): class Export(object):
# True/False for allowed image export # True/False for allowed (thumb, art) image export
MEDIA_TYPES = { MEDIA_TYPES = {
'movie': True, 'movie': (True, True),
'show': True, 'show': (True, True),
'season': True, 'season': (True, False),
'episode': False, 'episode': (False, False),
'artist': True, 'artist': (True, True),
'album': True, 'album': (True, False),
'track': True, 'track': (False, False),
'photoalbum': False, 'photoalbum': (False, False),
'photo': False, 'photo': (False, False),
'collection': True, 'collection': (True, True),
'playlist': True 'playlist': (True, True)
} }
PLURAL_MEDIA_TYPES = { PLURAL_MEDIA_TYPES = {
'movie': 'movies', 'movie': 'movies',
@ -410,6 +410,7 @@ class Export(object):
_season_attrs = { _season_attrs = {
'addedAt': helpers.datetime_to_iso, 'addedAt': helpers.datetime_to_iso,
'art': None, 'art': None,
'artFile': lambda o: self.get_image(o, 'art'),
'fields': { 'fields': {
'name': None, 'name': None,
'locked': None 'locked': None
@ -448,6 +449,7 @@ class Export(object):
_episode_attrs = { _episode_attrs = {
'addedAt': helpers.datetime_to_iso, 'addedAt': helpers.datetime_to_iso,
'art': None, 'art': None,
'artFile': lambda o: self.get_image(o, 'art'),
'chapterSource': None, 'chapterSource': None,
'contentRating': None, 'contentRating': None,
'directors': { 'directors': {
@ -612,6 +614,7 @@ class Export(object):
'ratingKey': None, 'ratingKey': None,
'summary': None, 'summary': None,
'thumb': None, 'thumb': None,
'thumbFile': lambda o: self.get_image(o, 'thumb'),
'title': None, 'title': None,
'titleSort': None, 'titleSort': None,
'type': None, 'type': None,
@ -1550,8 +1553,8 @@ class Export(object):
logger.error("Tautulli Exporter :: %s", msg) logger.error("Tautulli Exporter :: %s", msg)
return msg return msg
self.include_thumb = self.include_thumb and self.MEDIA_TYPES[self.media_type] self.include_thumb = self.include_thumb and self.MEDIA_TYPES[self.media_type][0]
self.include_art = self.include_art and self.MEDIA_TYPES[self.media_type] self.include_art = self.include_art and self.MEDIA_TYPES[self.media_type][1]
self._process_custom_fields() self._process_custom_fields()
self.filename = '{}.{}'.format(helpers.clean_filename(filename), self.file_format) self.filename = '{}.{}'.format(helpers.clean_filename(filename), self.file_format)
@ -1718,10 +1721,10 @@ class Export(object):
export_attrs_set.update(attrs) export_attrs_set.update(attrs)
if self.include_thumb: if self.include_thumb:
if 'thumbFile' in media_attrs: if 'thumbFile' in media_attrs and self.MEDIA_TYPES[media_type][0]:
export_attrs_set.add('thumbFile') export_attrs_set.add('thumbFile')
if self.include_art: if self.include_art:
if 'artFile' in media_attrs: if 'artFile' in media_attrs and self.MEDIA_TYPES[media_type][1]:
export_attrs_set.add('artFile') export_attrs_set.add('artFile')
plural_media_type = self.PLURAL_MEDIA_TYPES.get(media_type) plural_media_type = self.PLURAL_MEDIA_TYPES.get(media_type)