- char * psz_title_sanitized = strdup( psz_title );
- filename_sanitize( psz_title_sanitized );
- if( asprintf( &psz_dir, "%s" DIR_SEP "art" DIR_SEP "title" DIR_SEP
- "%s", psz_cachedir, psz_title_sanitized ) == -1 )
+ /* If artist or album missing cache by art download URL. The download
+ URL will be md5 hashed to form a valid cache filename. We assume that
+ psz_arturl is always the download URL and not the already hashed filename.
+ (We should never need to call this function if art has already been
+ downloaded anyway). */
+ struct md5_s md5;
+ InitMD5( &md5 );
+ AddMD5( &md5, psz_arturl, sizeof( psz_arturl ) );
+ EndMD5( &md5 );
+ char * psz_arturl_sanitized = psz_md5_hash( &md5 );
+ if( asprintf( &psz_dir, "%s" DIR_SEP "art" DIR_SEP "arturl" DIR_SEP
+ "%s", psz_cachedir, psz_arturl_sanitized ) == -1 )