def select_artwork( details, media_type ): artwork = None selection = None if media_type in ( "cdart", "cover" ): if media_type == "cdart": artwork = remote_cdart_list( details ) else: artwork = remote_coverart_list( details ) if artwork: for art in artwork: if art["musicbrainz_albumid"] == details[ "musicbrainz_albumid" ]: selection = art if not selection: dialog_msg( "okdialog", heading = __language__( 32033 ), line1 = __language__( 32030 ), line2 = __language__( 32031 ), background = False ) else: dialog_msg( "okdialog", heading = __language__( 32033 ), line1 = __language__( 32030 ), line2 = __language__( 32031 ), background = False ) else: if media_type == "fanart": artwork = remote_fanart_list( details ) elif media_type == "clearlogo": artwork = remote_clearlogo_list( details ) elif media_type == "hdlogo": artwork = remote_hdlogo_list( details ) elif media_type == "artistthumb": artwork = remote_artistthumb_list( details ) elif media_type == "musicbanner": artwork = remote_banner_list( details ) if artwork: for art in artwork: print art
def _report_hook( count, blocksize, totalsize ): try: percent = int( float( count * blocksize * 100 ) / totalsize ) if percent < 1: percent = 1 if percent > 100: percent = 100 except: percent = 1 if type in ( "fanart", "clearlogo", "artistthumb", "musicbanner" ): dialog_msg( "update", percent = percent, line1 = "%s%s" % ( __language__(32038) , get_unicode( album["artist"] ) ), background = background ) else: dialog_msg( "update", percent = percent, line1 = "%s%s" % ( __language__(32038) , get_unicode( album["artist"] ) ), line2 = "%s%s" % ( __language__(32039) , get_unicode( album["title"] ) ), background = background ) if mode == "auto": if dialog_msg( "iscanceled", background = background ): is_canceled = True
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
def auto_download( type, artist_list, background=False ): is_canceled = False log( "Autodownload", xbmc.LOGDEBUG ) try: artist_count = 0 download_count = 0 cdart_existing = 0 album_count = 0 d_error=False percent = 1 successfully_downloaded = [] if type in ( "clearlogo_allartists", "artistthumb_allartists", "fanart_allartists", "musicbanner_allartists" ): if type == "clearlogo_allartists": type = "clearlogo" elif type == "artistthumb_allartists": type = "artistthumb" elif type == "musicbanner_allartists": type = "musicbanner" else: type = "fanart" count_artist_local = len( artist_list ) dialog_msg( "create", heading = __language__(32046), background = background ) #Onscreen Dialog - Automatic Downloading of Artwork key_label = type for artist in artist_list: low_res = True if dialog_msg( "iscanceled", background = background ) or is_canceled: is_canceled = True break artist_count += 1 if not artist["has_art"] == "True": # If fanart.tv does not report that it has an artist match skip it. continue percent = int( (artist_count / float(count_artist_local) ) * 100) if percent < 1: percent = 1 if percent > 100: percent = 100 log( "Artist: %-40s Local ID: %-10s Distant MBID: %s" % ( artist["name"], artist["local_id"], artist["musicbrainz_artistid"] ), xbmc.LOGNOTICE ) if type in ( "fanart", "clearlogo", "artistthumb", "musicbanner" ) and artist[ "has_art" ]: dialog_msg( "update", percent = percent, line1 = "%s%s" % ( __language__(32038), get_unicode( artist["name"] ) ), background = background ) auto_art = {} temp_art = {} temp_art["musicbrainz_artistid"] = artist["musicbrainz_artistid"] auto_art["musicbrainz_artistid"] = artist["musicbrainz_artistid"] temp_art["artist"] = artist["name"] auto_art["artist"] = artist["name"] path = os.path.join( music_path, change_characters( smart_unicode( artist["name"] ) ) ) if type == "fanart": art = remote_fanart_list( auto_art ) elif type == "clearlogo": art = remote_clearlogo_list( auto_art ) arthd = remote_hdlogo_list( auto_art ) elif type == "musicbanner": art = remote_banner_list( auto_art ) else: art = remote_artistthumb_list( auto_art ) if art: if type == "fanart": temp_art["path"] = path auto_art["path"] = os.path.join( path, "extrafanart" ).replace( "\\\\" , "\\" ) if not exists( auto_art["path"] ): try: if _makedirs( auto_art["path"] ): log( "extrafanart directory made", xbmc.LOGDEBUG ) except: print_exc() log( "unable to make extrafanart directory", xbmc.LOGDEBUG ) continue else: log( "extrafanart directory already exists", xbmc.LOGDEBUG ) else: auto_art["path"] = path if type == "fanart": if enable_fanart_limit: fanart_dir, fanart_files = listdir( auto_art["path"] ) fanart_number = len( fanart_files ) if fanart_number == fanart_limit: continue if not exists( os.path.join( path, "fanart.jpg" ).replace( "\\\\", "\\" ) ): message, d_success, final_destination, is_canceled = download_art( art[0], temp_art, artist["local_id"], "fanart", "single", 0, background ) for artwork in art: fanart = {} if enable_fanart_limit and fanart_number == fanart_limit: log( "Fanart Limit Reached", xbmc.LOGNOTICE ) continue if exists( os.path.join( auto_art["path"], os.path.basename( artwork ) ) ): log( "Fanart already exists, skipping", xbmc.LOGDEBUG ) continue else: message, d_success, final_destination, is_canceled = download_art( artwork, auto_art, artist["local_id"], "fanart", "auto", 0, background ) if d_success == 1: if enable_fanart_limit: fanart_number += 1 download_count += 1 fanart["artist"] = auto_art["artist"] fanart["path"] = final_destination successfully_downloaded.append( fanart ) else: log( "Download Error... Check Path.", xbmc.LOGDEBUG ) log( " Path: %s" % auto_art["path"], xbmc.LOGDEBUG ) d_error = True else: if type == "clearlogo": if arthd and enable_hdlogos: artwork = arthd[0] else: artwork = art[0] else: artwork = art[0] if type == "artistthumb": if resizeondownload: low_res = check_size( auto_art["path"], key_label, 1000, 1000 ) # Fixed always redownloading Thumbs else: low_res = False if exists( os.path.join( auto_art["path"], "folder.jpg" ) ) and not low_res: log( "Artist Thumb already exists, skipping", xbmc.LOGDEBUG ) continue else: message, d_success, final_destination, is_canceled = download_art( artwork , auto_art, artist["local_id"], "artistthumb", "auto", 0, background ) elif type == "clearlogo": if enable_hdlogos and resizeondownload and arthd: low_res = check_size( auto_art["path"], key_label, 800, 310 ) else: low_res = False if exists( os.path.join( auto_art["path"], "logo.png" ) ) and not low_res: log( "ClearLOGO already exists, skipping", xbmc.LOGDEBUG ) continue else: message, d_success, final_destination, is_canceled = download_art( artwork , auto_art, artist["local_id"], "clearlogo", "auto", 0, background ) elif type == "musicbanner": if exists( os.path.join( auto_art["path"], "banner.jpg" ) ): log( "Music Banner already exists, skipping", xbmc.LOGDEBUG ) continue else: message, d_success, final_destination, is_canceled = download_art( artwork , auto_art, artist["local_id"], "musicbanner", "auto", 0, background ) if d_success == 1: download_count += 1 auto_art["path"] = final_destination successfully_downloaded.append( auto_art ) else: log( "Download Error... Check Path.", xbmc.LOGDEBUG ) log( " Path: %s" % auto_art["path"], xbmc.LOGDEBUG ) d_error = True else : log( "Artist Match not found", xbmc.LOGDEBUG ) elif type in ( "cdart", "cover" ) and artist[ "has_art" ]: local_album_list = get_local_albums_db( artist["name"], background ) if type == "cdart": remote_art_url = remote_cdart_list( artist ) else: remote_art_url = remote_coverart_list( artist ) for album in local_album_list: low_res = True if dialog_msg( "iscanceled", background = background ): break if not remote_art_url: log( "No artwork found", xbmc.LOGDEBUG ) break album_count += 1 if not album["musicbrainz_albumid"]: continue dialog_msg( "update", percent = percent, line1 = "%s%s" % ( __language__(32038) , get_unicode( artist["name"] ) ), line2 = "%s%s" % (__language__(32039) , get_unicode( album["title"] ) ), background = background ) name = artist["name"] title = album["title"] log( "Album: %s" % album["title"], xbmc.LOGDEBUG ) if not album[key_label] or resizeondownload: musicbrainz_albumid = album["musicbrainz_albumid"] art = artwork_search( remote_art_url, musicbrainz_albumid, album["disc"], key_label ) if art: if resizeondownload: low_res = check_size( album["path"].replace( "\\\\", "\\" ), key_label, art["size"], art["size"] ) if art["picture"]: log( "ALBUM MATCH ON FANART.TV FOUND", xbmc.LOGDEBUG ) #log( "test_album[0]: %s" % test_album[0], xbmc.LOGDEBUG ) if low_res: message, d_success, final_destination, is_canceled = download_art( art["picture"], album, album["local_id"], key_label, "auto", 0, background ) if d_success == 1: download_count += 1 album[key_label] = True album["path"] = final_destination successfully_downloaded.append( album ) else: log( "Download Error... Check Path.", xbmc.LOGDEBUG ) log( " Path: %s" % repr( album["path"] ), xbmc.LOGDEBUG ) d_error = True else: pass else: log( "ALBUM NOT MATCHED ON FANART.TV", xbmc.LOGDEBUG ) else: log( "ALBUM NOT MATCHED ON FANART.TV", xbmc.LOGDEBUG ) else: log( "%s artwork file already exists, skipping..." % key_label, xbmc.LOGDEBUG ) dialog_msg( "close", background = background ) if d_error: dialog_msg( "ok", line1 = __language__(32026), line2 = "%s: %s" % ( __language__(32041), download_count ), background = background ) else: dialog_msg( "ok", line1 = __language__(32040), line2 = "%s: %s" % ( __language__(32041), download_count ), background = background ) return download_count, successfully_downloaded except: print_exc() dialog_msg( "close", background = background )
def download_art( url_cdart, album, database_id, type, mode, size, background = False ): log( "Downloading artwork... ", xbmc.LOGDEBUG ) download_success = False thumb_path = "" percent = 1 is_canceled = False if mode == "auto": dialog_msg( "update", percent = percent, background = background ) else: dialog_msg( "create", heading = __language__(32047), background = background ) #Onscreen Dialog - "Downloading...." file_name = get_filename( type, url_cdart, mode ) #Helix: paths MUST end with trailing slash path = os.path.join(album["path"].replace( "\\\\" , "\\" ), '') if file_name == "unknown": log( "Unknown Type ", xbmc.LOGDEBUG ) message = [ __language__(32026), __language__(32025), "File: %s" % get_unicode( path ), "Url: %s" % get_unicode( url_cdart ) ] return message, download_success if type in ( "artistthumb", "cover" ): thumbnail_path = get_thumbnail_path( database_id, type ) else: thumbnail_path = "" if type == "fanart" and mode in ( "manual", "single" ): thumbnail_path = get_fanart_path( database_id, type ) if not exists( path ): try: pathsuccess = _makedirs( album["path"].replace( "\\\\" , "\\" ) ) except: pass log( "Path: %s" % path, xbmc.LOGDEBUG ) log( "Filename: %s" % file_name, xbmc.LOGDEBUG ) log( "url: %s" % url_cdart, xbmc.LOGDEBUG ) # cosmetic: use subfolder for downloading instead of work folder if not exists( os.path.join(tempgfx_folder, '').replace( "\\\\","\\" )): _makedirs(os.path.join(tempgfx_folder, '').replace( "\\\\","\\" )) destination = os.path.join(tempgfx_folder, file_name).replace( "\\\\","\\" ) # download to work folder first final_destination = os.path.join( path, file_name ).replace( "\\\\","\\" ) try: #this give the ability to use the progress bar by retrieving the downloading information #and calculating the percentage def _report_hook( count, blocksize, totalsize ): try: percent = int( float( count * blocksize * 100 ) / totalsize ) if percent < 1: percent = 1 if percent > 100: percent = 100 except: percent = 1 if type in ( "fanart", "clearlogo", "artistthumb", "musicbanner" ): dialog_msg( "update", percent = percent, line1 = "%s%s" % ( __language__(32038) , get_unicode( album["artist"] ) ), background = background ) else: dialog_msg( "update", percent = percent, line1 = "%s%s" % ( __language__(32038) , get_unicode( album["artist"] ) ), line2 = "%s%s" % ( __language__(32039) , get_unicode( album["title"] ) ), background = background ) if mode == "auto": if dialog_msg( "iscanceled", background = background ): is_canceled = True if exists( path ): fp, h = urllib.urlretrieve(url_cdart, destination, _report_hook) #message = ["Download Sucessful!"] message = [__language__(32023), __language__(32024), "File: %s" % get_unicode( path ), "Url: %s" % get_unicode( url_cdart )] success = file_copy( destination, final_destination ) # copy it to album folder # update database try: conn = sqlite3.connect(addon_db) c = conn.cursor() if type == "cdart": c.execute('''UPDATE alblist SET cdart="True" WHERE path="%s"''' % ( get_unicode( album["path"] ) ) ) elif type == "cover": c.execute('''UPDATE alblist SET cover="True" WHERE path="%s"''' % ( get_unicode( album["path"] ) ) ) conn.commit() c.close() except: log( "Error updating database", xbmc.LOGDEBUG ) print_exc() download_success = True else: log( "Path error", xbmc.LOGDEBUG ) log( " file path: %s" % repr( destination ), xbmc.LOGDEBUG ) message = [ __language__(32026), __language__(32025) , "File: %s" % get_unicode( path ), "Url: %s" % get_unicode( url_cdart ) ] #message = Download Problem, Check file paths - Artwork Not Downloaded] # always cleanup downloaded files #if type == "fanart": delete_file( destination ) except: log( "General download error", xbmc.LOGDEBUG ) message = [ __language__(32026), __language__(32025), "File: %s" % get_unicode( path ), "Url: %s" % get_unicode( url_cdart ) ] #message = [Download Problem, Check file paths - Artwork Not Downloaded] print_exc() if mode == "auto" or mode == "single": return message, download_success, final_destination, is_canceled # returns one of the messages built based on success or lack of else: dialog_msg( "close", background = background ) return message, download_success, is_canceled
def update_xbmc_thumbnails( background=False ): log( "Updating Thumbnails/fanart Images", xbmc.LOGNOTICE ) fanart = "fanart.jpg" artistthumb_temp = "artist.jpg" artistthumb = "folder.jpg" albumthumb = "folder.jpg" #xbmc.executebuiltin("Notification( %s, %s, %d, %s)" % ( __language__(32042), __language__(32112), 2000, image) ) xbmc.sleep( 1000 ) dialog_msg( "create", heading = __language__( 32042 ), background = background ) # Artists artists = get_local_artists_db( mode="local_artists" ) if not artists: artists = get_local_artists_db( mode="album_artists" ) # Albums albums = get_local_albums_db( "all artists", False ) percent = 1 count = 0 for artist in artists: percent = percent = int( ( count/float( len( artists ) ) ) * 100 ) count += 1 if percent == 0: percent = 1 if percent > 100: percent = 100 if dialog_msg( "iscanceled" ): break dialog_msg( "update", percent = percent, line1 = __language__( 32112 ), line2 = " %s %s" % ( __language__( 32038 ), getunicode( artist["name"] ) ), background = background ) xbmc_thumbnail_path = "" xbmc_fanart_path = "" fanart_path = os.path.join( music_path, change_characters( artist["name"] ), fanart ).replace( "\\\\","\\" ) artistthumb_path = os.path.join( music_path, change_characters( artist["name"] ), artistthumb ).replace( "\\\\","\\" ) artistthumb_rename = os.path.join( music_path, change_characters( artist["name"] ), artistthumb_temp ).replace( "\\\\","\\" ) if exists( artistthumb_rename ): file_rename( artistthumb_rename, artistthumb_path ) if exists( fanart_path ): xbmc_fanart_path = get_fanart_path( artist["local_id"], "artist" ) elif exists( artistthumb_path ): xbmc_thumbnail_path = get_thumbnail_path( artist["local_id"], "artist" ) else: continue if xbmc_fanart_path: # copy to XBMC supplied fanart path thumbnail_copy( fanart_path, xbmc_fanart_path, "fanart" ) if xbmc_thumbnail_path: # copy to XBMC supplied artist image path thumbnail_copy( artistthumb_path, xbmc_thumbnail_path, "artist thumb" ) percent = 1 count = 1 for album in albums: percent = percent = int( ( count/float( len( albums ) ) ) * 100 ) if percent < 1: percent = 1 if percent > 100: percent = 100 if dialog_msg( "iscanceled" ): break dialog_msg( "update", percent = percent, line1 = __language__( 32042 ), line2 = __language__( 32112 ), line3 = " %s %s" % ( __language__( 32039 ), getunicode( album["title"] ) ), background = background ) xbmc_thumbnail_path = "" coverart_path = os.path.join( album["path"], albumthumb ).replace( "\\\\","\\" ) if exists( coverart_path ): xbmc_thumbnail_path = get_thumbnail_path( album["local_id"], "album" ) if xbmc_thumbnail_path: thumbnail_copy( coverart_path, xbmc_thumbnail_path, "album cover" ) count += 1 log( "Finished Updating Thumbnails/fanart Images", xbmc.LOGNOTICE )
log( "# %-50s #" % __credits2__, xbmc.LOGNOTICE ) log( "# Thanks for the help guys... #", xbmc.LOGNOTICE ) log( "# %-50s #" % "Frodo", xbmc.LOGNOTICE ) log( "############################################################", xbmc.LOGNOTICE ) log( "Looking for settings.xml", xbmc.LOGNOTICE ) if not exists(settings_file): # Open Settings if settings.xml does not exists log( "settings.xml File not found, creating path and opening settings", xbmc.LOGNOTICE ) _makedirs( addon_work_folder ) __addon__.openSettings() soft_exit = True settings_to_log( addon_work_folder, "[script.cdartmanager]" ) try: recognized_ = int( __addon__.getSetting( "recognized" ) ) soft_exit = False except: dialog_msg( "okdialog", heading = __language__( 32181 ), line1 = __language__( 32182 ) ) __addon__.openSettings() soft_exit = True script_mode, provided_mbid, provided_dbid, media_type = get_script_mode() if xbmcgui.Window( 10000 ).getProperty( "cdart_manager_running" ) == "True": log( "cdART Manager Already running, exiting...", xbmc.LOGNOTICE ) soft_exit = True else: xbmcgui.Window( 10000 ).setProperty( "cdart_manager_running", "True" ) if not soft_exit: try: if enable_all_artists: xbmcgui.Window( 10000 ).setProperty( "cdart_manager_allartist", "True" ) else: xbmcgui.Window( 10000 ).setProperty( "cdart_manager_allartist", "False" ) xbmc.executebuiltin('Dialog.Close(all, true)')
def update_xbmc_thumbnails(background=False): log("Updating Thumbnails/fanart Images", xbmc.LOGNOTICE) fanart = "fanart.jpg" artistthumb_temp = "artist.jpg" artistthumb = "folder.jpg" albumthumb = "folder.jpg" #xbmc.executebuiltin("Notification( %s, %s, %d, %s)" % ( __language__(32042), __language__(32112), 2000, image) ) xbmc.sleep(1000) dialog_msg("create", heading=__language__(32042), background=background) # Artists artists = get_local_artists_db(mode="local_artists") if not artists: artists = get_local_artists_db(mode="album_artists") # Albums albums = get_local_albums_db("all artists", False) percent = 1 count = 0 for artist in artists: percent = percent = int((count / float(len(artists))) * 100) count += 1 if percent == 0: percent = 1 if percent > 100: percent = 100 if dialog_msg("iscanceled"): break dialog_msg("update", percent=percent, line1=__language__(32112), line2=" %s %s" % (__language__(32038), getunicode(artist["name"])), background=background) xbmc_thumbnail_path = "" xbmc_fanart_path = "" fanart_path = os.path.join(music_path, change_characters(artist["name"]), fanart).replace("\\\\", "\\") artistthumb_path = os.path.join(music_path, change_characters(artist["name"]), artistthumb).replace("\\\\", "\\") artistthumb_rename = os.path.join(music_path, change_characters(artist["name"]), artistthumb_temp).replace( "\\\\", "\\") if exists(artistthumb_rename): file_rename(artistthumb_rename, artistthumb_path) if exists(fanart_path): xbmc_fanart_path = get_fanart_path(artist["local_id"], "artist") elif exists(artistthumb_path): xbmc_thumbnail_path = get_thumbnail_path(artist["local_id"], "artist") else: continue if xbmc_fanart_path: # copy to XBMC supplied fanart path thumbnail_copy(fanart_path, xbmc_fanart_path, "fanart") if xbmc_thumbnail_path: # copy to XBMC supplied artist image path thumbnail_copy(artistthumb_path, xbmc_thumbnail_path, "artist thumb") percent = 1 count = 1 for album in albums: percent = percent = int((count / float(len(albums))) * 100) if percent < 1: percent = 1 if percent > 100: percent = 100 if dialog_msg("iscanceled"): break dialog_msg("update", percent=percent, line1=__language__(32042), line2=__language__(32112), line3=" %s %s" % (__language__(32039), getunicode(album["title"])), background=background) xbmc_thumbnail_path = "" coverart_path = os.path.join(album["path"], albumthumb).replace("\\\\", "\\") if exists(coverart_path): xbmc_thumbnail_path = get_thumbnail_path(album["local_id"], "album") if xbmc_thumbnail_path: thumbnail_copy(coverart_path, xbmc_thumbnail_path, "album cover") count += 1 log("Finished Updating Thumbnails/fanart Images", xbmc.LOGNOTICE)
xbmc.LOGNOTICE) log("Looking for settings.xml", xbmc.LOGNOTICE) if not exists( settings_file): # Open Settings if settings.xml does not exists log("settings.xml File not found, creating path and opening settings", xbmc.LOGNOTICE) _makedirs(addon_work_folder) __addon__.openSettings() soft_exit = True settings_to_log(addon_work_folder, "[script.cdartmanager]") try: recognized_ = int(__addon__.getSetting("recognized")) soft_exit = False except: dialog_msg("okdialog", heading=__language__(32181), line1=__language__(32182)) __addon__.openSettings() soft_exit = True script_mode, provided_mbid, provided_dbid, media_type = get_script_mode() if xbmcgui.Window(10000).getProperty("cdart_manager_running") == "True": log("cdART Manager Already running, exiting...", xbmc.LOGNOTICE) soft_exit = True else: xbmcgui.Window(10000).setProperty("cdart_manager_running", "True") if not soft_exit: try: if enable_all_artists: xbmcgui.Window(10000).setProperty("cdart_manager_allartist", "True") else: