Example #1
0
    def update_art_for_items(items, start):
        changedcount = 0
        for i, item in enumerate(items):
            progress.update(start + i * stepsize // len(items))
            mediainfo.prepare_mediaitem(item)

            processed = function(item)
            processed = mediainfo.get_artwork_updates(item['art'], processed)
            if processed:
                mediainfo.update_art_in_library(item['mediatype'], item['dbid'], processed)
                changedcount += len(processed)
            if monitor.abortRequested():
                break
        return changedcount
def add_art_to_library(mediatype, seasons, dbid, selectedart):
    if not selectedart:
        return
    if mediatype == mediatypes.TVSHOW:
        for season, season_id in seasons.iteritems():
            mediainfo.update_art_in_library(mediatypes.SEASON, season_id, dict((arttype, url) \
                for arttype, url in selectedart.iteritems() if arttype.startswith('season.{0}.'.format(season))))
        mediainfo.update_art_in_library(mediatype, dbid, dict((arttype, url) \
            for arttype, url in selectedart.iteritems() if '.' not in arttype))
    else:
        mediainfo.update_art_in_library(mediatype, dbid, selectedart)