def first_check( all_artists, album_artists, background=False, update_db = False ): log( "Checking for artist match with fanart.tv - First Check", xbmc.LOGNOTICE ) heading = __language__( 32187 ) album_artists_matched = [] all_artists_matched = [] d = datetime.utcnow() present_datecode = calendar.timegm( d.utctimetuple() ) count = 0 name = "" artist_list = [] all_artist_list = [] recognized = [] recognized_album = [] fanart_test = "" dialog_msg( "create", heading = "", background = background ) for artist in album_artists: percent = int( ( float( count )/len( album_artists ) )*100 ) log( "Checking artist MBID: %s" % artist[ "musicbrainz_artistid" ], xbmc.LOGDEBUG ) match = {} match = artist if artist["musicbrainz_artistid"] and ( artist[ "has_art"] == "False" or update_db ): match[ "has_art" ] = check_art( artist[ "musicbrainz_artistid" ], artist_type = "album" ) elif not artist["musicbrainz_artistid"]: match[ "has_art" ] = "False" else: match[ "has_art" ] = artist[ "has_art"] album_artists_matched.append( match ) dialog_msg( "update", percent = percent, line1 = heading, line2 = "", line3 = __language__( 32049 ) % artist[ "name" ], background = background ) count += 1 log( "Storing Album Artists List", xbmc.LOGDEBUG ) store_lalist( album_artists_matched, len( album_artists_matched ) ) if enable_all_artists and all_artists: count = 0 for artist in all_artists: percent = int( ( float( count )/len( all_artists ) )*100 ) log( "Checking artist MBID: %s" % artist[ "musicbrainz_artistid" ], xbmc.LOGDEBUG ) match = {} match = artist if artist["musicbrainz_artistid"] and ( artist[ "has_art"] == "False" or update_db ): match[ "has_art" ] = check_art( artist[ "musicbrainz_artistid" ], artist_type = "all_artist" ) elif not artist["musicbrainz_artistid"]: match[ "has_art" ] = "False" else: match[ "has_art" ] = artist[ "has_art"] all_artists_matched.append( match ) dialog_msg( "update", percent = percent, line1 = heading, line2 = "", line3 = __language__( 32049 ) % artist[ "name" ], background = background ) count += 1 store_local_artist_table( all_artists_matched, background = background ) store_fanarttv_datecode( present_datecode ) dialog_msg( "close", background = background ) log( "Finished First Check", xbmc.LOGDEBUG ) return
def get_recognized( all_artists, album_artists, background=False ): log( "Checking for artist match with fanart.tv - Get Recognized artists", xbmc.LOGNOTICE ) album_artists_matched = [] all_artists_matched = [] true = 0 count = 0 name = "" artist_list = [] all_artist_list = [] fanart_test = "" previous_datecode = retrieve_fanarttv_datecode() d = datetime.utcnow() present_datecode = calendar.timegm( d.utctimetuple() ) dialog_msg( "create", heading = "", background = background ) new_artwork, data = check_fanart_new_artwork( present_datecode ) if new_artwork: for artist in album_artists: percent = int( ( float( count )/len( album_artists ) )*100 ) log( "Checking artist MBID: %s" % artist[ "musicbrainz_artistid" ], xbmc.LOGDEBUG ) match = {} match = artist if match[ "musicbrainz_artistid" ]: match[ "has_art" ] = update_art( match[ "musicbrainz_artistid" ], data, artist[ "has_art" ] ) album_artists_matched.append( match ) dialog_msg( "update", percent = percent, line1 = __language__( 32185 ), line2 = "", line3 = __language__( 32049 ) % artist[ "name" ], background = background ) count += 1 if enable_all_artists and all_artists: count = 0 for artist in all_artists: percent = int( ( float( count )/len( all_artists ) )*100 ) log( "Checking artist MBID: %s" % artist[ "musicbrainz_artistid" ], xbmc.LOGDEBUG ) match = {} match = artist if match[ "musicbrainz_artistid" ]: match[ "has_art" ] = update_art( match[ "musicbrainz_artistid" ], data, artist[ "has_art" ] ) all_artists_matched.append( match ) dialog_msg( "update", percent = percent, line1 = __language__( 32185 ), line2 = "", line3 = __language__( 32049 ) % artist[ "name" ], background = background ) count += 1 else: log( "No new music artwork on fanart.tv", xbmc.LOGNOTICE ) album_artists_matched = album_artists all_artists_matched = all_artists store_lalist( album_artists_matched, len( album_artists_matched ) ) store_local_artist_table( all_artists_matched, background = background ) store_fanarttv_datecode( present_datecode ) dialog_msg( "close", background = background ) log( "Finished Getting Recognized Artists", xbmc.LOGDEBUG ) return all_artists_matched, album_artists_matched