[Play Count] Remember added count across sessions
Remember if play count was already tracked for the current file across restarts, if resume playback after restart is enabled. Signed-off-by: Christopher Snowhill <kode54@gmail.com>swiftingly
parent
2ce719c7fa
commit
c89837c0f8
|
@ -217,7 +217,9 @@ BOOL kAppControllerShuttingDown = NO;
|
||||||
[playbackController playEntryAtIndex:pe.index startPaused:(lastStatus == CogStatusPaused) andSeekTo:@(pe.currentPosition)];
|
[playbackController playEntryAtIndex:pe.index startPaused:(lastStatus == CogStatusPaused) andSeekTo:@(pe.currentPosition)];
|
||||||
} else {
|
} else {
|
||||||
pe.current = NO;
|
pe.current = NO;
|
||||||
|
pe.stopAfter = NO;
|
||||||
pe.currentPosition = 0.0;
|
pe.currentPosition = 0.0;
|
||||||
|
pe.countAdded = NO;
|
||||||
[playlistController commitPersistentStore];
|
[playlistController commitPersistentStore];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
<attribute name="channelConfig" optional="YES" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES"/>
|
<attribute name="channelConfig" optional="YES" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES"/>
|
||||||
<attribute name="channels" optional="YES" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES"/>
|
<attribute name="channels" optional="YES" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES"/>
|
||||||
<attribute name="codec" optional="YES" attributeType="String"/>
|
<attribute name="codec" optional="YES" attributeType="String"/>
|
||||||
|
<attribute name="countAdded" optional="YES" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES"/>
|
||||||
<attribute name="cuesheet" optional="YES" attributeType="String"/>
|
<attribute name="cuesheet" optional="YES" attributeType="String"/>
|
||||||
<attribute name="current" optional="YES" attributeType="Boolean" usesScalarValueType="YES"/>
|
<attribute name="current" optional="YES" attributeType="Boolean" usesScalarValueType="YES"/>
|
||||||
<attribute name="currentPosition" optional="YES" attributeType="Double" defaultValueString="0.0" usesScalarValueType="YES"/>
|
<attribute name="currentPosition" optional="YES" attributeType="Double" defaultValueString="0.0" usesScalarValueType="YES"/>
|
||||||
|
@ -67,7 +68,7 @@
|
||||||
<elements>
|
<elements>
|
||||||
<element name="AlbumArtwork" positionX="0" positionY="207" width="128" height="59"/>
|
<element name="AlbumArtwork" positionX="0" positionY="207" width="128" height="59"/>
|
||||||
<element name="PlayCount" positionX="-18" positionY="171" width="128" height="134"/>
|
<element name="PlayCount" positionX="-18" positionY="171" width="128" height="134"/>
|
||||||
<element name="PlaylistEntry" positionX="-36" positionY="9" width="128" height="704"/>
|
<element name="PlaylistEntry" positionX="-36" positionY="9" width="128" height="719"/>
|
||||||
<element name="SandboxToken" positionX="-18" positionY="171" width="128" height="59"/>
|
<element name="SandboxToken" positionX="-18" positionY="171" width="128" height="59"/>
|
||||||
</elements>
|
</elements>
|
||||||
</model>
|
</model>
|
|
@ -246,6 +246,9 @@ static void *playlistControllerContext = &playlistControllerContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)updatePlayCountForTrack:(PlaylistEntry *)pe {
|
- (void)updatePlayCountForTrack:(PlaylistEntry *)pe {
|
||||||
|
if(pe.countAdded) return;
|
||||||
|
pe.countAdded = YES;
|
||||||
|
|
||||||
PlayCount *pc = pe.playCountItem;
|
PlayCount *pc = pe.playCountItem;
|
||||||
|
|
||||||
if(pc) {
|
if(pc) {
|
||||||
|
@ -1393,6 +1396,7 @@ static void *playlistControllerContext = &playlistControllerContext;
|
||||||
currentEntry.current = NO;
|
currentEntry.current = NO;
|
||||||
currentEntry.stopAfter = NO;
|
currentEntry.stopAfter = NO;
|
||||||
currentEntry.currentPosition = 0.0;
|
currentEntry.currentPosition = 0.0;
|
||||||
|
currentEntry.countAdded = NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(pe) {
|
if(pe) {
|
||||||
|
|
Loading…
Reference in New Issue