def add_additional_iteminfo(self, mediaitem): mediainfo.prepare_mediaitem(mediaitem) if 'episodeid' in mediaitem: mediaitem['imdbnumber'] = self._get_episodeid(mediaitem) # Remove existing tvshow.* and season.* artwork mediaitem['art'] = dict((arttype.lower(), pykodi.unquoteimage(url)) \ for arttype, url in mediaitem['art'].iteritems() if '.' not in arttype) elif 'tvshowid' in mediaitem: mediaitem['seasons'], seasonart = self._get_seasons_artwork(quickjson.get_seasons(mediaitem['dbid'])) mediaitem['art'].update(seasonart)
def _get_seasons_artwork(self, seasons): resultseasons = {} resultart = {} for season in seasons: resultseasons[season['season']] = season['seasonid'] for arttype, url in season['art'].iteritems(): arttype = arttype.lower() if not arttype.startswith(('tvshow.', 'season.')): resultart['%s.%s.%s' % (mediatypes.SEASON, season['season'], arttype)] = pykodi.unquoteimage(url) return resultseasons, resultart
def prepare_mediaitem(mediaitem): mediaitem['mediatype'], mediaitem['dbid'] = get_mediatype_id(mediaitem) mediaitem['art'] = dict((arttype.lower(), pykodi.unquoteimage(url)) for \ arttype, url in mediaitem['art'].iteritems() if '.' not in arttype and not url.startswith('image://video'))