Bug Fix: Fix resume playback on startup
In case multiple playlist entries are left marked as "current" in the playlist database, resume playback on the first one, and unmark all the rest of them. Signed-off-by: Christopher Snowhill <kode54@gmail.com>
This commit is contained in:
parent
b4c8c11218
commit
1e1ee2fbe2
1 changed files with 8 additions and 1 deletions
|
@ -225,7 +225,7 @@ static AppController *kAppController = nil;
|
|||
NSError *error = nil;
|
||||
NSArray *results = [playlistController.persistentContainer.viewContext executeFetchRequest:request error:&error];
|
||||
|
||||
if(results && [results count] == 1) {
|
||||
if(results && [results count] > 0) {
|
||||
PlaylistEntry *pe = results[0];
|
||||
if([[NSUserDefaults standardUserDefaults] boolForKey:@"resumePlaybackOnStartup"]) {
|
||||
[playbackController playEntryAtIndex:pe.index startPaused:(lastStatus == CogStatusPaused) andSeekTo:@(pe.currentPosition)];
|
||||
|
@ -236,6 +236,13 @@ static AppController *kAppController = nil;
|
|||
pe.countAdded = NO;
|
||||
[playlistController commitPersistentStore];
|
||||
}
|
||||
// Bug fix
|
||||
if([results count] > 1) {
|
||||
for(size_t i = 1; i < [results count]; ++i) {
|
||||
PlaylistEntry *pe = results[i];
|
||||
[pe setCurrent:NO];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue