From 54bd1db7455e7abf8b75147030a0985623750f0b Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Sat, 23 Dec 2017 23:55:33 -0800 Subject: [PATCH] Ignore RepeatOne only when manually skipping tracks, not when playing normally. --- Playlist/PlaylistController.m | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/Playlist/PlaylistController.m b/Playlist/PlaylistController.m index 194b0781d..1d0e05c88 100644 --- a/Playlist/PlaylistController.m +++ b/Playlist/PlaylistController.m @@ -593,6 +593,16 @@ - (PlaylistEntry *)getNextEntry:(PlaylistEntry *)pe { + return [self getNextEntry:pe ignoreRepeatOne:NO]; +} + +- (PlaylistEntry *)getNextEntry:(PlaylistEntry *)pe ignoreRepeatOne:(BOOL)ignoreRepeatOne +{ + if (!ignoreRepeatOne && [self repeat] == RepeatOne) + { + return pe; + } + if ([queueList count] > 0) { @@ -655,6 +665,16 @@ - (PlaylistEntry *)getPrevEntry:(PlaylistEntry *)pe { + return [self getPrevEntry:pe ignoreRepeatOne:NO]; +} + +- (PlaylistEntry *)getPrevEntry:(PlaylistEntry *)pe ignoreRepeatOne:(BOOL)ignoreRepeatOne +{ + if (!ignoreRepeatOne && [self repeat] == RepeatOne) + { + return pe; + } + if ([self shuffle] != ShuffleOff) { return [self shuffledEntryAtIndex:(pe.shuffleIndex - 1)]; @@ -679,7 +699,7 @@ { PlaylistEntry *pe; - pe = [self getNextEntry:[self currentEntry]]; + pe = [self getNextEntry:[self currentEntry] ignoreRepeatOne:YES]; if (pe == nil) return NO; @@ -693,7 +713,7 @@ { PlaylistEntry *pe; - pe = [self getPrevEntry:[self currentEntry]]; + pe = [self getPrevEntry:[self currentEntry] ignoreRepeatOne:YES]; if (pe == nil) return NO;