Fixed ridiculous Spotlight bug where absent track numbers would cause a crash. Cleaned directory structure.

CQTexperiment
matthewleon 2008-02-16 13:18:14 +00:00
parent d4ee1ac6ae
commit 6b11d41fbe
8 changed files with 56 additions and 14 deletions

View File

@ -111,8 +111,9 @@
56462EAF0D6341F6000AB68C /* SpotlightTransformers.m in Sources */ = {isa = PBXBuildFile; fileRef = 56462EAE0D6341F6000AB68C /* SpotlightTransformers.m */; };
56462EB20D634206000AB68C /* SpotlightPlaylistController.m in Sources */ = {isa = PBXBuildFile; fileRef = 56462EB10D634206000AB68C /* SpotlightPlaylistController.m */; };
56C63D910D647DF300EAE25A /* NSComparisonPredicate+CogPredicate.m in Sources */ = {isa = PBXBuildFile; fileRef = 56C63D900D647DF300EAE25A /* NSComparisonPredicate+CogPredicate.m */; };
56DB07F70D670D1F00453B6A /* NSArray+CogSort.m in Sources */ = {isa = PBXBuildFile; fileRef = 56DB07F60D670D1F00453B6A /* NSArray+CogSort.m */; };
56DB08090D67109300453B6A /* NSString+CogSort.m in Sources */ = {isa = PBXBuildFile; fileRef = 56DB08080D67109300453B6A /* NSString+CogSort.m */; };
56DB084C0D6717DC00453B6A /* NSNumber+CogSort.m in Sources */ = {isa = PBXBuildFile; fileRef = 56DB084B0D6717DC00453B6A /* NSNumber+CogSort.m */; };
56DB08550D67185300453B6A /* NSArray+CogSort.m in Sources */ = {isa = PBXBuildFile; fileRef = 56DB08540D67185300453B6A /* NSArray+CogSort.m */; };
56DB08580D67186500453B6A /* NSString+CogSort.m in Sources */ = {isa = PBXBuildFile; fileRef = 56DB08570D67186500453B6A /* NSString+CogSort.m */; };
8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; };
8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; };
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
@ -610,10 +611,12 @@
566D32160D538550004466A5 /* APL.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = APL.xcodeproj; path = Plugins/APL/APL.xcodeproj; sourceTree = "<group>"; };
56C63D8F0D647DF300EAE25A /* NSComparisonPredicate+CogPredicate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSComparisonPredicate+CogPredicate.h"; path = "Spotlight/NSComparisonPredicate+CogPredicate.h"; sourceTree = "<group>"; };
56C63D900D647DF300EAE25A /* NSComparisonPredicate+CogPredicate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSComparisonPredicate+CogPredicate.m"; path = "Spotlight/NSComparisonPredicate+CogPredicate.m"; sourceTree = "<group>"; };
56DB07F50D670D1F00453B6A /* NSArray+CogSort.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSArray+CogSort.h"; sourceTree = "<group>"; };
56DB07F60D670D1F00453B6A /* NSArray+CogSort.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSArray+CogSort.m"; sourceTree = "<group>"; };
56DB08070D67109300453B6A /* NSString+CogSort.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+CogSort.h"; sourceTree = "<group>"; };
56DB08080D67109300453B6A /* NSString+CogSort.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+CogSort.m"; sourceTree = "<group>"; };
56DB084A0D6717DC00453B6A /* NSNumber+CogSort.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSNumber+CogSort.h"; path = "Spotlight/NSNumber+CogSort.h"; sourceTree = "<group>"; };
56DB084B0D6717DC00453B6A /* NSNumber+CogSort.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSNumber+CogSort.m"; path = "Spotlight/NSNumber+CogSort.m"; sourceTree = "<group>"; };
56DB08530D67185300453B6A /* NSArray+CogSort.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSArray+CogSort.h"; path = "Spotlight/NSArray+CogSort.h"; sourceTree = "<group>"; };
56DB08540D67185300453B6A /* NSArray+CogSort.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSArray+CogSort.m"; path = "Spotlight/NSArray+CogSort.m"; sourceTree = "<group>"; };
56DB08560D67186500453B6A /* NSString+CogSort.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSString+CogSort.h"; path = "Spotlight/NSString+CogSort.h"; sourceTree = "<group>"; };
56DB08570D67186500453B6A /* NSString+CogSort.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSString+CogSort.m"; path = "Spotlight/NSString+CogSort.m"; sourceTree = "<group>"; };
8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
8E07AAEE0AAC910500A4B32F /* SS_PreferencePaneProtocol.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SS_PreferencePaneProtocol.h; path = Preferences/SS_PreferencePaneProtocol.h; sourceTree = "<group>"; };
8E07AAEF0AAC910500A4B32F /* SS_PrefsController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SS_PrefsController.h; path = Preferences/SS_PrefsController.h; sourceTree = "<group>"; };
@ -1121,12 +1124,14 @@
56DB08340D67166000453B6A /* Categories */ = {
isa = PBXGroup;
children = (
56DB08560D67186500453B6A /* NSString+CogSort.h */,
56DB08570D67186500453B6A /* NSString+CogSort.m */,
56DB08530D67185300453B6A /* NSArray+CogSort.h */,
56DB08540D67185300453B6A /* NSArray+CogSort.m */,
56C63D8F0D647DF300EAE25A /* NSComparisonPredicate+CogPredicate.h */,
56C63D900D647DF300EAE25A /* NSComparisonPredicate+CogPredicate.m */,
56DB07F50D670D1F00453B6A /* NSArray+CogSort.h */,
56DB07F60D670D1F00453B6A /* NSArray+CogSort.m */,
56DB08070D67109300453B6A /* NSString+CogSort.h */,
56DB08080D67109300453B6A /* NSString+CogSort.m */,
56DB084A0D6717DC00453B6A /* NSNumber+CogSort.h */,
56DB084B0D6717DC00453B6A /* NSNumber+CogSort.m */,
);
name = Categories;
sourceTree = "<group>";
@ -1668,8 +1673,9 @@
56462EB20D634206000AB68C /* SpotlightPlaylistController.m in Sources */,
07E18DF30D62B38400BB0E11 /* NSArray+ShuffleUtils.m in Sources */,
56C63D910D647DF300EAE25A /* NSComparisonPredicate+CogPredicate.m in Sources */,
56DB07F70D670D1F00453B6A /* NSArray+CogSort.m in Sources */,
56DB08090D67109300453B6A /* NSString+CogSort.m in Sources */,
56DB084C0D6717DC00453B6A /* NSNumber+CogSort.m in Sources */,
56DB08550D67185300453B6A /* NSArray+CogSort.m in Sources */,
56DB08580D67186500453B6A /* NSString+CogSort.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

View File

@ -0,0 +1,16 @@
//
// NSNumber+CogSort.h
// Cog
//
// Created by Matthew Grinshpun on 16/02/08.
// Copyright 2008 __MyCompanyName__. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@interface NSNumber (CogSort)
- (NSComparisonResult)compareTrackNumbers:(NSNumber *)aNumber;
@end

View File

@ -0,0 +1,20 @@
//
// NSNumber+CogSort.m
// Cog
//
// Created by Matthew Grinshpun on 16/02/08.
// Copyright 2008 __MyCompanyName__. All rights reserved.
//
#import "NSNumber+CogSort.h"
@implementation NSNumber (CogSort)
// Sometimes track numbers are CFNumbers
- (NSComparisonResult)compareTrackNumbers:(NSNumber *)aNumber
{
return [self compare:aNumber];
}
@end

View File

@ -12,6 +12,7 @@
#import "NSComparisonPredicate+CogPredicate.h"
#import "NSArray+CogSort.h"
#import "NSString+CogSort.h"
#import "NSNumber+CogSort.h"
// Minimum length of a search string (searching for very small strings gets ugly)
#define MINIMUM_SEARCH_STRING_LENGTH 3
@ -84,8 +85,7 @@ static NSPredicate * musicOnlyPredicate = nil;
// Set scope to contents of pathControl
self.query.searchScopes = [NSArray arrayWithObjects:pathControl.URL, nil];
[self.query startQuery];
NSLog(@"Started query: %@ \nWith descriptors: %@", [self.query.predicate description],
[self.query.sortDescriptors description]);
NSLog(@"Started query: %@", [self.query.predicate description]);
}
}
}