Playback: Always remember last playing track
Select it on startup, and start playback at the last position if configured to do so. Also, if there is a bug and multiple tracks are marked for current, unmark them as usual, but also commit the changes. Signed-off-by: Christopher Snowhill <kode54@gmail.com>
This commit is contained in:
parent
ddf7438c6e
commit
14dac74c54
1 changed files with 4 additions and 6 deletions
|
@ -271,14 +271,11 @@ static BOOL consentLastEnabled = NO;
|
|||
|
||||
if(results && [results count] > 0) {
|
||||
PlaylistEntry *pe = results[0];
|
||||
// Select this track
|
||||
[playlistView selectRowIndexes:[NSIndexSet indexSetWithIndex:pe.index] byExtendingSelection:NO];
|
||||
if([[NSUserDefaults standardUserDefaults] boolForKey:@"resumePlaybackOnStartup"]) {
|
||||
// And play it
|
||||
[playbackController playEntryAtIndex:pe.index startPaused:(lastStatus == CogStatusPaused) andSeekTo:@(pe.currentPosition)];
|
||||
} else {
|
||||
pe.current = NO;
|
||||
pe.stopAfter = NO;
|
||||
pe.currentPosition = 0.0;
|
||||
pe.countAdded = NO;
|
||||
[playlistController commitPersistentStore];
|
||||
}
|
||||
// Bug fix
|
||||
if([results count] > 1) {
|
||||
|
@ -286,6 +283,7 @@ static BOOL consentLastEnabled = NO;
|
|||
PlaylistEntry *pe = results[i];
|
||||
[pe setCurrent:NO];
|
||||
}
|
||||
[playlistController commitPersistentStore];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue