Spotlight gets all necessary tags from metadata now. Some interface tweaks.
This commit is contained in:
parent
d8ac96afbf
commit
0e6a9ee966
6 changed files with 684 additions and 682 deletions
|
@ -104,7 +104,6 @@
|
||||||
17F561400C3BD4F30019975C /* CogAudio.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 17F561330C3BD4DC0019975C /* CogAudio.framework */; };
|
17F561400C3BD4F30019975C /* CogAudio.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 17F561330C3BD4DC0019975C /* CogAudio.framework */; };
|
||||||
17F562390C3BD91B0019975C /* General.preferencePane in Resources */ = {isa = PBXBuildFile; fileRef = 17F5622E0C3BD8FB0019975C /* General.preferencePane */; };
|
17F562390C3BD91B0019975C /* General.preferencePane in Resources */ = {isa = PBXBuildFile; fileRef = 17F5622E0C3BD8FB0019975C /* General.preferencePane */; };
|
||||||
5604D4550D603430004F5C5D /* SpotlightSearchController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5604D4510D603430004F5C5D /* SpotlightSearchController.m */; };
|
5604D4550D603430004F5C5D /* SpotlightSearchController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5604D4510D603430004F5C5D /* SpotlightSearchController.m */; };
|
||||||
5604D4560D603430004F5C5D /* SpotlightTransformers.m in Sources */ = {isa = PBXBuildFile; fileRef = 5604D4530D603430004F5C5D /* SpotlightTransformers.m */; };
|
|
||||||
5604D4580D603459004F5C5D /* SpotlightPanel.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5604D4570D603459004F5C5D /* SpotlightPanel.xib */; };
|
5604D4580D603459004F5C5D /* SpotlightPanel.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5604D4570D603459004F5C5D /* SpotlightPanel.xib */; };
|
||||||
5604D45B0D60349B004F5C5D /* SpotlightWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5604D4590D60349B004F5C5D /* SpotlightWindowController.m */; };
|
5604D45B0D60349B004F5C5D /* SpotlightWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5604D4590D60349B004F5C5D /* SpotlightWindowController.m */; };
|
||||||
5604D4F60D60726E004F5C5D /* SpotlightPlaylistEntry.m in Sources */ = {isa = PBXBuildFile; fileRef = 5604D4F50D60726E004F5C5D /* SpotlightPlaylistEntry.m */; };
|
5604D4F60D60726E004F5C5D /* SpotlightPlaylistEntry.m in Sources */ = {isa = PBXBuildFile; fileRef = 5604D4F50D60726E004F5C5D /* SpotlightPlaylistEntry.m */; };
|
||||||
|
@ -592,8 +591,6 @@
|
||||||
32CA4F630368D1EE00C91783 /* Cog_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Cog_Prefix.pch; sourceTree = "<group>"; };
|
32CA4F630368D1EE00C91783 /* Cog_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Cog_Prefix.pch; sourceTree = "<group>"; };
|
||||||
5604D4510D603430004F5C5D /* SpotlightSearchController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SpotlightSearchController.m; path = Spotlight/SpotlightSearchController.m; sourceTree = "<group>"; };
|
5604D4510D603430004F5C5D /* SpotlightSearchController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SpotlightSearchController.m; path = Spotlight/SpotlightSearchController.m; sourceTree = "<group>"; };
|
||||||
5604D4520D603430004F5C5D /* SpotlightSearchController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SpotlightSearchController.h; path = Spotlight/SpotlightSearchController.h; sourceTree = "<group>"; };
|
5604D4520D603430004F5C5D /* SpotlightSearchController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SpotlightSearchController.h; path = Spotlight/SpotlightSearchController.h; sourceTree = "<group>"; };
|
||||||
5604D4530D603430004F5C5D /* SpotlightTransformers.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SpotlightTransformers.m; path = Spotlight/SpotlightTransformers.m; sourceTree = "<group>"; };
|
|
||||||
5604D4540D603430004F5C5D /* SpotlightTransformers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SpotlightTransformers.h; path = Spotlight/SpotlightTransformers.h; sourceTree = "<group>"; };
|
|
||||||
5604D4570D603459004F5C5D /* SpotlightPanel.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = SpotlightPanel.xib; path = Spotlight/SpotlightPanel.xib; sourceTree = "<group>"; };
|
5604D4570D603459004F5C5D /* SpotlightPanel.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = SpotlightPanel.xib; path = Spotlight/SpotlightPanel.xib; sourceTree = "<group>"; };
|
||||||
5604D4590D60349B004F5C5D /* SpotlightWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SpotlightWindowController.m; path = Spotlight/SpotlightWindowController.m; sourceTree = "<group>"; };
|
5604D4590D60349B004F5C5D /* SpotlightWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SpotlightWindowController.m; path = Spotlight/SpotlightWindowController.m; sourceTree = "<group>"; };
|
||||||
5604D45A0D60349B004F5C5D /* SpotlightWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SpotlightWindowController.h; path = Spotlight/SpotlightWindowController.h; sourceTree = "<group>"; };
|
5604D45A0D60349B004F5C5D /* SpotlightWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SpotlightWindowController.h; path = Spotlight/SpotlightWindowController.h; sourceTree = "<group>"; };
|
||||||
|
@ -1092,8 +1089,6 @@
|
||||||
5604D45A0D60349B004F5C5D /* SpotlightWindowController.h */,
|
5604D45A0D60349B004F5C5D /* SpotlightWindowController.h */,
|
||||||
5604D4510D603430004F5C5D /* SpotlightSearchController.m */,
|
5604D4510D603430004F5C5D /* SpotlightSearchController.m */,
|
||||||
5604D4520D603430004F5C5D /* SpotlightSearchController.h */,
|
5604D4520D603430004F5C5D /* SpotlightSearchController.h */,
|
||||||
5604D4530D603430004F5C5D /* SpotlightTransformers.m */,
|
|
||||||
5604D4540D603430004F5C5D /* SpotlightTransformers.h */,
|
|
||||||
5604D4F40D60726E004F5C5D /* SpotlightPlaylistEntry.h */,
|
5604D4F40D60726E004F5C5D /* SpotlightPlaylistEntry.h */,
|
||||||
5604D4F50D60726E004F5C5D /* SpotlightPlaylistEntry.m */,
|
5604D4F50D60726E004F5C5D /* SpotlightPlaylistEntry.m */,
|
||||||
);
|
);
|
||||||
|
@ -1631,7 +1626,6 @@
|
||||||
17BBE5BC0CD95CFA00258F7A /* InvertedToolbarWindow.m in Sources */,
|
17BBE5BC0CD95CFA00258F7A /* InvertedToolbarWindow.m in Sources */,
|
||||||
173428F50D5FB1C400E8D854 /* EntriesController.m in Sources */,
|
173428F50D5FB1C400E8D854 /* EntriesController.m in Sources */,
|
||||||
5604D4550D603430004F5C5D /* SpotlightSearchController.m in Sources */,
|
5604D4550D603430004F5C5D /* SpotlightSearchController.m in Sources */,
|
||||||
5604D4560D603430004F5C5D /* SpotlightTransformers.m in Sources */,
|
|
||||||
5604D45B0D60349B004F5C5D /* SpotlightWindowController.m in Sources */,
|
5604D45B0D60349B004F5C5D /* SpotlightWindowController.m in Sources */,
|
||||||
5604D4F60D60726E004F5C5D /* SpotlightPlaylistEntry.m in Sources */,
|
5604D4F60D60726E004F5C5D /* SpotlightPlaylistEntry.m in Sources */,
|
||||||
);
|
);
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -10,8 +10,12 @@
|
||||||
#import "PlaylistEntry.h"
|
#import "PlaylistEntry.h"
|
||||||
|
|
||||||
|
|
||||||
@interface SpotlightPlaylistEntry : PlaylistEntry
|
@interface SpotlightPlaylistEntry : PlaylistEntry {
|
||||||
|
|
||||||
|
NSNumber *length;
|
||||||
|
}
|
||||||
|
|
||||||
+(SpotlightPlaylistEntry *)playlistEntryWithMetadataItem:(NSMetadataItem *)metadataItem;
|
+(SpotlightPlaylistEntry *)playlistEntryWithMetadataItem:(NSMetadataItem *)metadataItem;
|
||||||
|
|
||||||
|
@property(copy) NSNumber *length;
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -17,6 +17,9 @@ static NSArray * entryKeys;
|
||||||
// extramdKeys represents those keys that require additional processing
|
// extramdKeys represents those keys that require additional processing
|
||||||
static NSArray * extramdKeys;
|
static NSArray * extramdKeys;
|
||||||
|
|
||||||
|
// allmdKeys is a combined array of both mdKeys and entryKeys
|
||||||
|
static NSArray * allmdKeys;
|
||||||
|
|
||||||
// And the dictionary that matches them
|
// And the dictionary that matches them
|
||||||
static NSDictionary * tags;
|
static NSDictionary * tags;
|
||||||
|
|
||||||
|
@ -26,23 +29,25 @@ static NSDictionary * tags;
|
||||||
{
|
{
|
||||||
mdKeys = [NSArray arrayWithObjects:
|
mdKeys = [NSArray arrayWithObjects:
|
||||||
@"kMDItemTitle",
|
@"kMDItemTitle",
|
||||||
@"kMDItemAuthors",
|
|
||||||
@"kMDItemAlbum",
|
@"kMDItemAlbum",
|
||||||
@"kMDItemAudioTrackNumber",
|
@"kMDItemAudioTrackNumber",
|
||||||
@"kMDItemRecordingYear",
|
@"kMDItemRecordingYear",
|
||||||
@"kMDItemMusicalGenre",
|
@"kMDItemMusicalGenre",
|
||||||
|
@"kMDItemDurationSeconds",
|
||||||
nil];
|
nil];
|
||||||
entryKeys = [NSArray arrayWithObjects:
|
entryKeys = [NSArray arrayWithObjects:
|
||||||
@"title",
|
@"title",
|
||||||
@"artist",
|
|
||||||
@"album",
|
@"album",
|
||||||
@"track",
|
@"track",
|
||||||
@"year",
|
@"year",
|
||||||
@"genre",
|
@"genre",
|
||||||
|
@"length",
|
||||||
nil];
|
nil];
|
||||||
extramdKeys = [NSArray arrayWithObjects:
|
extramdKeys = [NSArray arrayWithObjects:
|
||||||
@"kMDItemPath",
|
@"kMDItemPath",
|
||||||
|
@"kMDItemAuthors",
|
||||||
nil];
|
nil];
|
||||||
|
allmdKeys = [mdKeys arrayByAddingObjectsFromArray:extramdKeys];
|
||||||
tags = [NSDictionary dictionaryWithObjects:entryKeys forKeys:mdKeys];
|
tags = [NSDictionary dictionaryWithObjects:entryKeys forKeys:mdKeys];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,15 +55,17 @@ static NSDictionary * tags;
|
||||||
{
|
{
|
||||||
// use the matching tag sets to generate a playlist entry
|
// use the matching tag sets to generate a playlist entry
|
||||||
SpotlightPlaylistEntry *entry = [[[SpotlightPlaylistEntry alloc] init] autorelease];
|
SpotlightPlaylistEntry *entry = [[[SpotlightPlaylistEntry alloc] init] autorelease];
|
||||||
NSDictionary *songAttributes = [metadataItem valuesForAttributes:mdKeys];
|
NSDictionary *songAttributes = [metadataItem valuesForAttributes:allmdKeys];
|
||||||
NSDictionary *extraAttributes = [metadataItem valuesForAttributes:extramdKeys];
|
|
||||||
for (NSString * mdKey in tags) {
|
for (NSString * mdKey in tags) {
|
||||||
[entry setValue: [songAttributes objectForKey:mdKey]
|
[entry setValue: [songAttributes objectForKey:mdKey]
|
||||||
forKey:[tags objectForKey:mdKey]];
|
forKey:[tags objectForKey:mdKey]];
|
||||||
|
|
||||||
}
|
}
|
||||||
// URL needs to be generated from the simple path stored in kMDItemPath
|
// URL needs to be generated from the simple path stored in kMDItemPath
|
||||||
[entry setURL: [NSURL fileURLWithPath: [extraAttributes objectForKey:@"kMDItemPath"]]];
|
[entry setURL: [NSURL fileURLWithPath: [songAttributes objectForKey:@"kMDItemPath"]]];
|
||||||
|
|
||||||
|
// Authors is an array, but we only care about the first item in it
|
||||||
|
[entry setArtist: [[songAttributes objectForKey:@"kMDItemAuthors"] objectAtIndex:0]];
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,8 +73,10 @@ static NSDictionary * tags;
|
||||||
{
|
{
|
||||||
if (self = [super init])
|
if (self = [super init])
|
||||||
{
|
{
|
||||||
|
length = nil;
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@synthesize length;
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
//
|
|
||||||
// SpotlightTransformers.h
|
|
||||||
// Cog
|
|
||||||
//
|
|
||||||
// Created by Matthew Grinshpun on 10/02/08.
|
|
||||||
// Copyright 2008 __MyCompanyName__. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
#import <Cocoa/Cocoa.h>
|
|
||||||
|
|
||||||
|
|
||||||
@interface SpotlightArtistTransformer : NSValueTransformer{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
|
@ -1,27 +0,0 @@
|
||||||
//
|
|
||||||
// SpotlightTransformers.m
|
|
||||||
// Cog
|
|
||||||
//
|
|
||||||
// Created by Matthew Grinshpun on 10/02/08.
|
|
||||||
// Copyright 2008 __MyCompanyName__. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
#import "SpotlightTransformers.h"
|
|
||||||
|
|
||||||
// kMDItemAuthor is an array of values.
|
|
||||||
// For music, the first value is the artist
|
|
||||||
@implementation SpotlightArtistTransformer
|
|
||||||
|
|
||||||
+ (Class)transformedValueClass {
|
|
||||||
return [NSString class];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (id)transformedValue:(id)value {
|
|
||||||
NSString * artistString = @"";
|
|
||||||
if (value != nil) {
|
|
||||||
artistString = [NSString stringWithString:
|
|
||||||
(NSString *)[value objectAtIndex:0]];
|
|
||||||
}
|
|
||||||
return artistString;
|
|
||||||
}
|
|
||||||
@end
|
|
Loading…
Reference in a new issue