iOS: Audio files thumbnail generation path is wrong
Suffers the same issue as the video thumbnails, the app ID is not updated.
Therefore, the app fails to find the generated thumbnail.
This is the code from the MediaLibraryKit:
#pragma mark - audio file specific code
- (NSString *)artworkPathForMediaItemWithTitle:(NSString *)title Artist:(NSString*)artist andAlbumName:(NSString*)albumname
{
NSString *artworkURL;
NSArray *searchPaths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
NSString *cacheDir = searchPaths[0];
cacheDir = [cacheDir stringByAppendingFormat:@"/%@", [[NSBundle mainBundle] bundleIdentifier]];
if ((artist.length == 0 || albumname.length == 0) && title != nil && title.length > 0) {
/* Use generated hash to find art */
artworkURL = [cacheDir stringByAppendingFormat:@"/art/arturl/%@/art.jpg", [self _md5FromString:title]];
} else {
/* Otherwise, it was cached by artist and album */
artworkURL = [cacheDir stringByAppendingFormat:@"/art/artistalbum/%@/%@/art.jpg", artist, albumname];
}
return artworkURL;
}
- (NSString *)_md5FromString:(NSString *)string
{
const char *ptr = [string UTF8String];
unsigned char md5Buffer[CC_MD5_DIGEST_LENGTH];
CC_MD5(ptr, (unsigned int)strlen(ptr), md5Buffer);
NSMutableString *output = [NSMutableString stringWithCapacity:CC_MD5_DIGEST_LENGTH * 2];
for(int i = 0; i < CC_MD5_DIGEST_LENGTH; i++)
[output appendFormat:@"%02x",md5Buffer[i]];
return [NSString stringWithString:output];
}