[Play Counts] Add option to (mass) reset counts
Add option to reset counts for all selected tracks on the playlist. Signed-off-by: Christopher Snowhill <kode54@gmail.com>lastfm
parent
de43192453
commit
8fc981cb92
|
@ -2166,6 +2166,15 @@ Gw
|
|||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="stopAfterSelection:" target="218" id="ZRy-Mw-4cY"/>
|
||||
<binding destination="2020" name="enabled" keyPath="selection" id="lrh-gy-5Z3">
|
||||
<dictionary key="options">
|
||||
<integer key="NSMultipleValuesPlaceholder" value="0"/>
|
||||
<integer key="NSNoSelectionPlaceholder" value="0"/>
|
||||
<integer key="NSNotApplicablePlaceholder" value="0"/>
|
||||
<integer key="NSNullPlaceholder" value="0"/>
|
||||
<string key="NSValueTransformerName">NSIsNotNil</string>
|
||||
</dictionary>
|
||||
</binding>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="2047"/>
|
||||
|
@ -2207,8 +2216,27 @@ Gw
|
|||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="reloadTags:" target="218" id="Ghx-F8-uF3"/>
|
||||
<binding destination="2020" name="enabled" keyPath="selection" id="DmN-2M-3dY">
|
||||
<binding destination="2020" name="enabled" keyPath="selection" id="s3T-C1-yR0">
|
||||
<dictionary key="options">
|
||||
<integer key="NSMultipleValuesPlaceholder" value="0"/>
|
||||
<integer key="NSNoSelectionPlaceholder" value="0"/>
|
||||
<integer key="NSNotApplicablePlaceholder" value="0"/>
|
||||
<integer key="NSNullPlaceholder" value="0"/>
|
||||
<string key="NSValueTransformerName">NSIsNotNil</string>
|
||||
</dictionary>
|
||||
</binding>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Reset Play Count" id="5iV-dM-oX2">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="resetPlaycounts:" target="218" id="M3d-2T-ZRq"/>
|
||||
<binding destination="2020" name="enabled" keyPath="selection" id="2FG-Dj-1XM">
|
||||
<dictionary key="options">
|
||||
<integer key="NSMultipleValuesPlaceholder" value="0"/>
|
||||
<integer key="NSNoSelectionPlaceholder" value="0"/>
|
||||
<integer key="NSNotApplicablePlaceholder" value="0"/>
|
||||
<integer key="NSNullPlaceholder" value="0"/>
|
||||
<string key="NSValueTransformerName">NSIsNotNil</string>
|
||||
</dictionary>
|
||||
</binding>
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue