From c71021fc9b15c451682d4bada563ba6941008684 Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Thu, 16 Jun 2022 17:05:52 -0700 Subject: [PATCH] [Metadata] Fix assigning Unsigned property The PlaylistEntry class needs a compatibility wrapper for the Unsigned member, as it is assigned by all of the inputs. Case sensitivity and all that is. And unfortunately, Core Data requires all model members to start with a lower case letter. Signed-off-by: Christopher Snowhill --- Playlist/PlaylistEntry.h | 5 ++++- Playlist/PlaylistEntry.m | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/Playlist/PlaylistEntry.h b/Playlist/PlaylistEntry.h index 1aa8c32d0..68c17d090 100644 --- a/Playlist/PlaylistEntry.h +++ b/Playlist/PlaylistEntry.h @@ -27,6 +27,7 @@ + (NSSet *_Nonnull)keyPathsForValuesAffectingYearText; + (NSSet *_Nonnull)keyPathsForValuesAffectingCuesheetPresent; + (NSSet *_Nonnull)keyPathsForValuesAffectingGainCorrection; ++ (NSSet *_Nonnull)keyPathsForValuesAffectingUnsigned; @property(nonatomic, readonly) NSString *_Nonnull display; @property(nonatomic, retain, readonly) NSNumber *_Nonnull length; @@ -42,7 +43,7 @@ @property(nonatomic, readonly) NSString *_Nonnull yearText; -@property(nonatomic, readonly) NSString *_Nonnull title; +@property(nonatomic) NSString *_Nonnull title; @property(nonatomic, readonly) NSString *_Nonnull trackText; @@ -62,6 +63,8 @@ @property(nonatomic) NSData *_Nullable albumArtInternal; +@property(nonatomic) BOOL Unsigned; + - (void)setMetadata:(NSDictionary *_Nonnull)metadata; @end diff --git a/Playlist/PlaylistEntry.m b/Playlist/PlaylistEntry.m index dea01c4c5..6b1271fb6 100644 --- a/Playlist/PlaylistEntry.m +++ b/Playlist/PlaylistEntry.m @@ -99,6 +99,10 @@ extern NSMutableDictionary *__artworkDictionary; return [NSSet setWithObjects:@"replayGainAlbumGain", @"replayGainAlbumPeak", @"replayGainTrackGain", @"replayGainTrackPeak", @"volume", nil]; } ++ (NSSet *)keyPathsForValuesAffectingUnsigned { + return [NSSet setWithObject:@"unSigned"]; +} + - (NSString *)description { return [NSString stringWithFormat:@"PlaylistEntry %lli:(%@)", self.index, self.url]; } @@ -457,6 +461,16 @@ NSURL *_Nullable urlForPath(NSString *_Nullable path) { return nil; } +// Gotta love that requirement of Core Data that everything starts with a lower case letter +@dynamic Unsigned; +- (BOOL)Unsigned { + return self.unSigned; +} + +- (void)setUnsigned:(BOOL)Unsigned { + self.unSigned = Unsigned; +} + - (void)setMetadata:(NSDictionary *)metadata { if(metadata == nil) { self.error = YES;