[Core Data Storage] Refine deleted/empty items
Remove empty items also with empty URL fields. Signed-off-by: Christopher Snowhill <kode54@gmail.com>swiftingly
parent
2563125ec5
commit
385335b37c
|
@ -224,7 +224,7 @@ BOOL kAppControllerShuttingDown = NO;
|
|||
int lastStatus = (int)[[NSUserDefaults standardUserDefaults] integerForKey:@"lastPlaybackStatus"];
|
||||
|
||||
if(lastStatus != CogStatusStopped) {
|
||||
NSPredicate *deletedPredicate = [NSPredicate predicateWithFormat:@"deLeted == NO || deLeted == nil"];
|
||||
NSPredicate *deletedPredicate = [NSPredicate predicateWithFormat:@"deLeted == NO || deLeted == nil || urlString == nil"];
|
||||
NSPredicate *currentPredicate = [NSPredicate predicateWithFormat:@"current == YES"];
|
||||
|
||||
NSCompoundPredicate *predicate = [NSCompoundPredicate andPredicateWithSubpredicates:@[deletedPredicate, currentPredicate]];
|
||||
|
|
|
@ -1140,7 +1140,7 @@ static void *playlistControllerContext = &playlistControllerContext;
|
|||
}
|
||||
|
||||
- (NSArray *)filterPlaylistOnAlbum:(NSString *)album {
|
||||
NSPredicate *deletedPredicate = [NSPredicate predicateWithFormat:@"deLeted == NO || deLeted == nil"];
|
||||
NSPredicate *deletedPredicate = [NSPredicate predicateWithFormat:@"deLeted == NO || deLeted == nil || urlString == nil"];
|
||||
|
||||
NSPredicate *searchPredicate;
|
||||
if([album length] > 0)
|
||||
|
@ -1243,7 +1243,7 @@ static void *playlistControllerContext = &playlistControllerContext;
|
|||
}
|
||||
|
||||
- (void)readQueueFromDataStore {
|
||||
NSPredicate *deletedPredicate = [NSPredicate predicateWithFormat:@"deLeted == NO || deLeted == nil"];
|
||||
NSPredicate *deletedPredicate = [NSPredicate predicateWithFormat:@"deLeted == NO || deLeted == nil || urlString == nil"];
|
||||
NSPredicate *queuedPredicate = [NSPredicate predicateWithFormat:@"queued == YES"];
|
||||
|
||||
NSSortDescriptor *sortDescriptor = [NSSortDescriptor sortDescriptorWithKey:@"queuePosition" ascending:YES];
|
||||
|
@ -1265,7 +1265,7 @@ static void *playlistControllerContext = &playlistControllerContext;
|
|||
}
|
||||
|
||||
- (void)readShuffleListFromDataStore {
|
||||
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"deLeted == NO || deLeted == nil"];
|
||||
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"deLeted == NO || deLeted == nil || urlString == nil"];
|
||||
|
||||
NSSortDescriptor *sortDescriptor = [NSSortDescriptor sortDescriptorWithKey:@"shuffleIndex" ascending:YES];
|
||||
|
||||
|
|
|
@ -810,7 +810,7 @@ static inline void dispatch_sync_reentrant(dispatch_queue_t queue, dispatch_bloc
|
|||
NSMutableIndexSet *pruneSet = [[NSMutableIndexSet alloc] init];
|
||||
NSUInteger index = 0;
|
||||
for(PlaylistEntry *pe in resultsCopy) {
|
||||
if(pe.deLeted) {
|
||||
if(pe.deLeted || !pe.url) {
|
||||
[pruneSet addIndex:index];
|
||||
[moc deleteObject:pe];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue