[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>lastfm
parent
ed8c8acc89
commit
4bc4b38489
|
@ -143,6 +143,7 @@ typedef NS_ENUM(NSInteger, URLOrigin) {
|
|||
|
||||
// Play statistics
|
||||
- (void)updatePlayCountForTrack:(PlaylistEntry *_Nonnull)pe;
|
||||
- (void)firstSawTrack:(PlaylistEntry *_Nonnull)pe;
|
||||
|
||||
- (void)moveObjectsInArrangedObjectsFromIndexes:(NSIndexSet *_Nullable)indexSet
|
||||
toIndex:(NSUInteger)insertIndex;
|
||||
|
|
|
@ -1675,11 +1675,6 @@ static void *playlistControllerContext = &playlistControllerContext;
|
|||
- (void)didInsertURLs:(NSArray *)urls origin:(URLOrigin)origin {
|
||||
if(![urls count]) return;
|
||||
|
||||
for(PlaylistEntry *pe in urls) {
|
||||
[self firstSawTrack:pe];
|
||||
}
|
||||
[self commitPersistentStore];
|
||||
|
||||
NSArray *nsurls = [urls valueForKey:@"url"];
|
||||
if(![[SandboxBroker sharedSandboxBroker] areAllPathsSafe:nsurls]) {
|
||||
[appController showPathSuggester];
|
||||
|
|
|
@ -735,9 +735,13 @@ NSURL *_Nullable urlForPath(NSString *_Nullable path);
|
|||
__block NSString *entryKey = [outArray objectAtIndex:i];
|
||||
__block NSDictionary *entryInfo = [outArray objectAtIndex:i + 1];
|
||||
__block NSMutableIndexSet *weakUpdateIndexes = update_indexes;
|
||||
PlaylistController *playlistController = self->playlistController;
|
||||
dispatch_sync_reentrant(dispatch_get_main_queue(), ^{
|
||||
NSArray *entrySet = [uniquePathsEntries objectForKey:entryKey];
|
||||
if(entrySet) {
|
||||
if([entrySet count] > 0) {
|
||||
[playlistController firstSawTrack:entrySet[0]];
|
||||
}
|
||||
for(PlaylistEntry *pe in entrySet) {
|
||||
[pe setMetadata:entryInfo];
|
||||
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]];
|
||||
|
||||
[pe setMetadata:entryInfo];
|
||||
[playlistController firstSawTrack:pe];
|
||||
}];
|
||||
|
||||
[self->playlistController updateTotalTime];
|
||||
|
|
Loading…
Reference in New Issue