Commit dd39999d authored by Felix Paul Kühne's avatar Felix Paul Kühne

MLMediaLibrary: destroy albums and shows if their last media item disappeared

parent 4bb58bdd
......@@ -665,6 +665,16 @@ static NSString *kLastTVDBUpdateServerTime = @"MLLastTVDBUpdateServerTime";
if (!exists) {
APLog(@"Marking - %@", [fileURL absoluteString]);
file.isSafe = YES; // It doesn't exists, it's safe.
if (file.isAlbumTrack) {
MLAlbum *album = file.albumTrack.album;
if (album.tracks.count <= 1)
[[self managedObjectContext] deleteObject:album];
}
if (file.isShowEpisode) {
MLShow *show = file.showEpisode.show;
if (show.episodes.count <= 1)
[[self managedObjectContext] deleteObject:show];
}
#if TARGET_OS_IPHONE
NSString *thumbPath = [[[self thumbnailFolderPath] stringByAppendingPathComponent:[[file.objectID URIRepresentation] path]] stringByAppendingString:@".png"];
bool thumbExists = [fileManager fileExistsAtPath:thumbPath];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment