Fix export custom child fields failing without included parent field
This commit is contained in:
@@ -92,6 +92,14 @@ class Export(object):
|
|||||||
'collection': ['children'],
|
'collection': ['children'],
|
||||||
'playlist': ['item']
|
'playlist': ['item']
|
||||||
}
|
}
|
||||||
|
TREE_MEDIA_TYPES = [
|
||||||
|
('episode', 'season', 'show'),
|
||||||
|
('track', 'album', 'artist'),
|
||||||
|
('photo', 'photoalbum'),
|
||||||
|
('clip', 'photoalbum'),
|
||||||
|
('children', 'collection'),
|
||||||
|
('item', 'playlist')
|
||||||
|
]
|
||||||
METADATA_LEVELS = (0, 1, 2, 3, 9)
|
METADATA_LEVELS = (0, 1, 2, 3, 9)
|
||||||
MEDIA_INFO_LEVELS = (0, 1, 2, 3, 9)
|
MEDIA_INFO_LEVELS = (0, 1, 2, 3, 9)
|
||||||
IMAGE_LEVELS = (0, 1, 2, 9)
|
IMAGE_LEVELS = (0, 1, 2, 9)
|
||||||
@@ -1818,6 +1826,15 @@ class Export(object):
|
|||||||
else:
|
else:
|
||||||
self._custom_fields[media_type] = {field}
|
self._custom_fields[media_type] = {field}
|
||||||
|
|
||||||
|
for tree in self.TREE_MEDIA_TYPES:
|
||||||
|
for child_media_type, parent_media_type in zip(tree[:-1], tree[1:]):
|
||||||
|
if child_media_type in self._custom_fields:
|
||||||
|
plural_child_media_type = self.PLURAL_MEDIA_TYPES[child_media_type]
|
||||||
|
if parent_media_type in self._custom_fields:
|
||||||
|
self._custom_fields[parent_media_type].add(plural_child_media_type)
|
||||||
|
else:
|
||||||
|
self._custom_fields[parent_media_type] = {plural_child_media_type}
|
||||||
|
|
||||||
def _parse_custom_field(self, media_type, field):
|
def _parse_custom_field(self, media_type, field):
|
||||||
for child_media_type in self.CHILD_MEDIA_TYPES.get(media_type, []):
|
for child_media_type in self.CHILD_MEDIA_TYPES.get(media_type, []):
|
||||||
plural_key = self.PLURAL_MEDIA_TYPES[child_media_type]
|
plural_key = self.PLURAL_MEDIA_TYPES[child_media_type]
|
||||||
|
Reference in New Issue
Block a user