Implemented Repeat All through NSPredicate and filtering, method should be applicable when Shuffle is fixed too.
parent
390c98b18c
commit
184525a47a
|
@ -50,6 +50,7 @@ typedef enum {
|
||||||
- (BOOL)shuffle;
|
- (BOOL)shuffle;
|
||||||
- (void)setRepeat:(RepeatMode)r;
|
- (void)setRepeat:(RepeatMode)r;
|
||||||
- (RepeatMode)repeat;
|
- (RepeatMode)repeat;
|
||||||
|
- (NSArray *)filterPlaylistOnAlbum:(NSString *)album;
|
||||||
|
|
||||||
- (PlaylistEntry *)getNextEntry:(PlaylistEntry *)pe;
|
- (PlaylistEntry *)getNextEntry:(PlaylistEntry *)pe;
|
||||||
- (PlaylistEntry *)getPrevEntry:(PlaylistEntry *)pe;
|
- (PlaylistEntry *)getPrevEntry:(PlaylistEntry *)pe;
|
||||||
|
|
|
@ -399,10 +399,32 @@
|
||||||
i = [[pe index] intValue] + 1;
|
i = [[pe index] intValue] + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (repeat == RepeatAlbum)
|
||||||
|
{
|
||||||
|
PlaylistEntry *next = [self entryAtIndex:i];
|
||||||
|
|
||||||
|
if ((i > [[self arrangedObjects] count]-1) || ([[next album] caseInsensitiveCompare:[pe album]]) || ([next album] == nil))
|
||||||
|
{
|
||||||
|
NSArray *filtered = [self filterPlaylistOnAlbum:[pe album]];
|
||||||
|
if ([pe album] == nil)
|
||||||
|
i--;
|
||||||
|
else
|
||||||
|
i = [[[filtered objectAtIndex:0] index] intValue];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
return [self entryAtIndex:i];
|
return [self entryAtIndex:i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSArray *)filterPlaylistOnAlbum:(NSString *)album
|
||||||
|
{
|
||||||
|
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"album like %@",
|
||||||
|
album];
|
||||||
|
return [[self arrangedObjects] filteredArrayUsingPredicate:predicate];
|
||||||
|
}
|
||||||
|
|
||||||
- (PlaylistEntry *)getPrevEntry:(PlaylistEntry *)pe
|
- (PlaylistEntry *)getPrevEntry:(PlaylistEntry *)pe
|
||||||
{
|
{
|
||||||
if (repeat == RepeatOne) {
|
if (repeat == RepeatOne) {
|
||||||
|
|
Loading…
Reference in New Issue