+
+ tags, categories = [], []
+ for source_name, container in (('Tags', tags), ('Genres', categories)):
+ for e in content.get(source_name, []):
+ e_name = e.get('Name')
+ if not e_name:
+ continue
+ container.append(e_name)
+
+ description = content.get('Desc') or content.get('ShortDesc')
+ season = content.get('Season', {})
+ base_info = {
+ 'description': description,
+ 'timestamp': parse_iso8601(content.get('BroadcastDateTime')),
+ 'episode_number': int_or_none(content.get('Episode')),
+ 'season': season.get('Name'),
+ 'season_number': season.get('Number'),
+ 'season_id': season.get('Id'),
+ 'series': content.get('Media', {}).get('Name'),
+ 'tags': tags,
+ 'categories': categories,
+ }
+
+ entries = []
+ for stack in stacks:
+ stack_id = compat_str(stack['Id'])
+ entry = {
+ '_type': 'url_transparent',
+ 'url': '9c9media:stack:%s:%s:%s:%s' % (destination_code, content_id, package_id, stack_id),
+ 'id': stack_id,
+ 'title': '%s_part%s' % (title, stack['Name']) if multistacks else title,
+ 'duration': float_or_none(stack.get('Duration')),
+ 'ie_key': 'NineCNineMediaStack',
+ }
+ entry.update(base_info)
+ entries.append(entry)