Skip to content

Commit

Permalink
Filter tracks by server in parser
Browse files Browse the repository at this point in the history
We can't do this for covers and albums because they have no server relation.

May help with GH-133.
  • Loading branch information
NattyNarwhal committed Jun 2, 2023
1 parent b8b1719 commit c31087a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Submariner/SBSubsonicParsingOperation.m
Original file line number Diff line number Diff line change
Expand Up @@ -1105,16 +1105,16 @@ - (SBTrack *)fetchTrackWithID:(NSString *)trackID orTitle:(NSString *)trackTitle
NSPredicate *predicate = nil;

if(album && trackID) {
predicate = [NSPredicate predicateWithFormat: @"(id == %@) && (album == %@)", trackID, album];
predicate = [NSPredicate predicateWithFormat: @"(id == %@) && (album == %@) && (server == %@)", trackID, album, server];

} else if(album && trackTitle) {
predicate = [NSPredicate predicateWithFormat: @"(itemName == %@) && (album == %@)", trackTitle, album];
predicate = [NSPredicate predicateWithFormat: @"(itemName == %@) && (album == %@) && (server == %@)", trackTitle, album, server];

} else if(!album && trackID) {
predicate = [NSPredicate predicateWithFormat: @"(id == %@)", trackID];
predicate = [NSPredicate predicateWithFormat: @"(id == %@) && (server == %@)", trackID, server];

} else if(!album && trackTitle) {
predicate = [NSPredicate predicateWithFormat: @"(itemName == %@)", trackTitle];
predicate = [NSPredicate predicateWithFormat: @"(itemName == %@) && (server == %@)", trackTitle, server];
}

NSArray<SBTrack*> *tracks = [[self threadedContext] fetchEntitiesNammed:@"Track" withPredicate:predicate error:&error];
Expand Down

0 comments on commit c31087a

Please sign in to comment.