[Play Count Info] Tabulate first seen info later
Tabulate first seen information when loading the metadata, rather than when first adding the tracks to the playlist. This should fix first seen information when metadata is available, as the information will be useless without track titles. Signed-off-by: Christopher Snowhill <kode54@gmail.com>swiftingly
parent
0f923e6072
commit
86de03a1ab
|
@ -143,6 +143,7 @@ typedef NS_ENUM(NSInteger, URLOrigin) {
|
||||||
|
|
||||||
// Play statistics
|
// Play statistics
|
||||||
- (void)updatePlayCountForTrack:(PlaylistEntry *_Nonnull)pe;
|
- (void)updatePlayCountForTrack:(PlaylistEntry *_Nonnull)pe;
|
||||||
|
- (void)firstSawTrack:(PlaylistEntry *_Nonnull)pe;
|
||||||
|
|
||||||
- (void)moveObjectsInArrangedObjectsFromIndexes:(NSIndexSet *_Nullable)indexSet
|
- (void)moveObjectsInArrangedObjectsFromIndexes:(NSIndexSet *_Nullable)indexSet
|
||||||
toIndex:(NSUInteger)insertIndex;
|
toIndex:(NSUInteger)insertIndex;
|
||||||
|
|
|
@ -1675,11 +1675,6 @@ static void *playlistControllerContext = &playlistControllerContext;
|
||||||
- (void)didInsertURLs:(NSArray *)urls origin:(URLOrigin)origin {
|
- (void)didInsertURLs:(NSArray *)urls origin:(URLOrigin)origin {
|
||||||
if(![urls count]) return;
|
if(![urls count]) return;
|
||||||
|
|
||||||
for(PlaylistEntry *pe in urls) {
|
|
||||||
[self firstSawTrack:pe];
|
|
||||||
}
|
|
||||||
[self commitPersistentStore];
|
|
||||||
|
|
||||||
NSArray *nsurls = [urls valueForKey:@"url"];
|
NSArray *nsurls = [urls valueForKey:@"url"];
|
||||||
if(![[SandboxBroker sharedSandboxBroker] areAllPathsSafe:nsurls]) {
|
if(![[SandboxBroker sharedSandboxBroker] areAllPathsSafe:nsurls]) {
|
||||||
[appController showPathSuggester];
|
[appController showPathSuggester];
|
||||||
|
|
|
@ -735,9 +735,13 @@ NSURL *_Nullable urlForPath(NSString *_Nullable path);
|
||||||
__block NSString *entryKey = [outArray objectAtIndex:i];
|
__block NSString *entryKey = [outArray objectAtIndex:i];
|
||||||
__block NSDictionary *entryInfo = [outArray objectAtIndex:i + 1];
|
__block NSDictionary *entryInfo = [outArray objectAtIndex:i + 1];
|
||||||
__block NSMutableIndexSet *weakUpdateIndexes = update_indexes;
|
__block NSMutableIndexSet *weakUpdateIndexes = update_indexes;
|
||||||
|
PlaylistController *playlistController = self->playlistController;
|
||||||
dispatch_sync_reentrant(dispatch_get_main_queue(), ^{
|
dispatch_sync_reentrant(dispatch_get_main_queue(), ^{
|
||||||
NSArray *entrySet = [uniquePathsEntries objectForKey:entryKey];
|
NSArray *entrySet = [uniquePathsEntries objectForKey:entryKey];
|
||||||
if(entrySet) {
|
if(entrySet) {
|
||||||
|
if([entrySet count] > 0) {
|
||||||
|
[playlistController firstSawTrack:entrySet[0]];
|
||||||
|
}
|
||||||
for(PlaylistEntry *pe in entrySet) {
|
for(PlaylistEntry *pe in entrySet) {
|
||||||
[pe setMetadata:entryInfo];
|
[pe setMetadata:entryInfo];
|
||||||
if(pe.index >= 0 && pe.index < NSNotFound) {
|
if(pe.index >= 0 && pe.index < NSNotFound) {
|
||||||
|
@ -811,6 +815,7 @@ NSURL *_Nullable urlForPath(NSString *_Nullable path);
|
||||||
NSDictionary *entryInfo = [NSDictionary dictionaryByMerging:entryProperties with:[AudioMetadataReader metadataForURL:pe.url]];
|
NSDictionary *entryInfo = [NSDictionary dictionaryByMerging:entryProperties with:[AudioMetadataReader metadataForURL:pe.url]];
|
||||||
|
|
||||||
[pe setMetadata:entryInfo];
|
[pe setMetadata:entryInfo];
|
||||||
|
[playlistController firstSawTrack:pe];
|
||||||
}];
|
}];
|
||||||
|
|
||||||
[self->playlistController updateTotalTime];
|
[self->playlistController updateTotalTime];
|
||||||
|
|
Loading…
Reference in New Issue