diff --git a/Base.lproj/MainMenu.xib b/Base.lproj/MainMenu.xib index ec48350dd..79a499f1d 100644 --- a/Base.lproj/MainMenu.xib +++ b/Base.lproj/MainMenu.xib @@ -2166,6 +2166,15 @@ Gw + + + + + + + NSIsNotNil + + @@ -2207,8 +2216,27 @@ Gw - + + + + + + NSIsNotNil + + + + + + + + + + + + + + NSIsNotNil diff --git a/Playlist/PlaylistController.h b/Playlist/PlaylistController.h index a2ce9e19d..f745406ad 100644 --- a/Playlist/PlaylistController.h +++ b/Playlist/PlaylistController.h @@ -141,6 +141,9 @@ typedef NS_ENUM(NSInteger, URLOrigin) { // reload metadata of selection - (IBAction)reloadTags:(id _Nullable)sender; +// Reset playcount of selection +- (IBAction)resetPlaycounts:(id _Nullable)sender; + // Play statistics - (void)updatePlayCountForTrack:(PlaylistEntry *_Nonnull)pe; - (void)firstSawTrack:(PlaylistEntry *_Nonnull)pe; diff --git a/Playlist/PlaylistController.m b/Playlist/PlaylistController.m index c39f9a214..56e20dda2 100644 --- a/Playlist/PlaylistController.m +++ b/Playlist/PlaylistController.m @@ -282,6 +282,14 @@ static void *playlistControllerContext = &playlistControllerContext; } } +- (void)resetPlayCountForTrack:(PlaylistEntry *)pe { + PlayCount *pc = pe.playCountItem; + + if(pc) { + pc.count = 0; + } +} + - (void)updatePlaylistIndexes { NSArray *arranged = [self arrangedObjects]; NSUInteger n = [arranged count]; @@ -1719,4 +1727,14 @@ static void *playlistControllerContext = &playlistControllerContext; } } +- (IBAction)resetPlaycounts:(id)sender { + NSArray *selectedobjects = [self selectedObjects]; + if([selectedobjects count]) { + for(PlaylistEntry *pe in selectedobjects) { + [self resetPlayCountForTrack:pe]; + } + [self commitPersistentStore]; + } +} + @end