Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

A few improvements to make it fit for public consumption. Proper daem…

…on installer and everything

git-svn-id: svn://Zim.local/NanoFibre/trunk@620 6c154dfa-49ee-0310-9ea9-8312faa011d6
  • Loading branch information...
commit 9535069791ddcf55e8535fa1394787d1a87e4909 1 parent 31159de
@jdelStrother authored
View
5 Album.h
@@ -1,9 +1,9 @@
//
// Album.h
-// Fibre
+// NanoFibre
//
// Created by Jonathan del Strother on 01/10/2006.
-// Copyright 2006 Best Before Media Ltd. All rights reserved.
+// Copyright 2006. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@@ -16,6 +16,7 @@
BOOL sizeCached;
}
++(NSString*)albumKeyForTrack:(NSDictionary*)track;
-(void)addTrack:(NSDictionary*)track;
-(NSString*)title;
-(NSString*)artist;
View
26 Album.m
@@ -1,9 +1,9 @@
//
// Album.m
-// Fibre
+// NanoFibre
//
// Created by Jonathan del Strother on 01/10/2006.
-// Copyright 2006 Best Before Media Ltd. All rights reserved.
+// Copyright 2006. All rights reserved.
//
#import "Album.h"
@@ -11,6 +11,22 @@
@implementation Album
++(NSString*)albumKeyForTrack:(NSDictionary*)track
+{
+ NSString* albumTitle = [track objectForKey:@"Album"];
+
+ NSString* artist = [track objectForKey:@"Album Artist"];
+ if (!artist)
+ artist = [track objectForKey:@"Artist"];
+
+ if (!artist) artist=@"";
+ if (!albumTitle) albumTitle=@"";
+
+
+ return [NSString stringWithFormat:@"%@__%@", artist, albumTitle];
+}
+
+
-(id)init
{
self = [super init];
@@ -21,6 +37,12 @@ -(id)init
return self;
}
+-(void)dealloc
+{
+ [tracks release];
+ [super dealloc];
+}
+
-(void)addTrack:(NSDictionary*)track
{
[tracks addObject:track];
View
7 AppController.h
@@ -4,9 +4,10 @@
@interface AppController : NSObject
{
- IBOutlet NSArrayController *arrayController;
- IBOutlet NSTextField *sizeLabel;
+ IBOutlet NSArrayController *arrayController;
+ IBOutlet NSTextField *sizeLabel;
IBOutlet NSWindow *window;
}
-- (IBAction)makePlaylist:(id)sender;
+-(IBAction)makePlaylist:(id)sender;
+-(IBAction)installDaemon:(id)sender;
@end
View
71 AppController.m
@@ -1,3 +1,5 @@
+#import <Security/Security.h>
+
#import "AppController.h"
#import "MusicLibrary.h"
#import "HumanDiskSizeTransformer.h";
@@ -14,6 +16,7 @@ +(void)initialize
-(void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
+ // If we're running in daemon mode, just make the changes and leave.
if ([[[NSProcessInfo processInfo] environment] objectForKey:@"fibreDaemon"])
{
[self makePlaylist:self];
@@ -32,6 +35,74 @@ -(IBAction)makePlaylist:(id)sender
}
+-(IBAction)installDaemon:(id)sender
+{
+ if (NSRunAlertPanel(@"Install Daemon?",
+ @"This will install a daemon to /usr/local/bin, and a launch agent to ~/Library/LaunchAgents",
+ @"Install",@"Cancel",nil) == NSAlertDefaultReturn)
+ {
+ AuthorizationRef auth;
+ if(AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment, kAuthorizationFlagDefaults, &auth) == errAuthorizationSuccess)
+ {
+ BOOL daemonFailed = NO;
+ BOOL agentFailed = NO;
+
+ NSString* sourceExecutable = [[NSBundle mainBundle] pathForAuxiliaryExecutable:@"fibred"];
+
+ char * args[3];
+ args[0] = "-p";
+ args[1] = "/usr/local/bin";
+ args[2] = NULL;
+ AuthorizationExecuteWithPrivileges(auth,"/bin/mkdir",
+ kAuthorizationFlagDefaults,
+ args, NULL);
+
+ args[0] = (char*)[sourceExecutable fileSystemRepresentation];
+ args[1] = "/usr/local/bin/";
+ args[2] = NULL;
+ AuthorizationExecuteWithPrivileges(auth,"/bin/cp",
+ kAuthorizationFlagDefaults,
+ args,NULL); // Some error handling here would be handy, but we don't get anything useful in communicationsPipe because it doesn't catch STDERR
+
+ //The above call doesn't block, so we need to wait for a bit before the file actually gets copied.
+ // Let's go for 5 attempts, 0.5seconds apart.
+ int attempts = 5;
+ while (attempts-->0 && ![[NSFileManager defaultManager] fileExistsAtPath:@"/usr/local/bin/fibred"])
+ {
+ [NSThread sleepUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.5]];
+ }
+ //Still not copied? Well, crap.
+ if (![[NSFileManager defaultManager] fileExistsAtPath:@"/usr/local/bin/fibred"])
+ {
+ daemonFailed = YES;
+ NSRunAlertPanel(@"Couldn't install daemon", @"Failed to copy daemon to /usr/local/bin/fibred",@"OK",nil,nil);
+ }
+
+ AuthorizationFree(auth,kAuthorizationFlagDefaults);
+
+ if (!daemonFailed)
+ {
+ NSString* srcAgent = [[NSBundle mainBundle] pathForResource:@"Nanofibre" ofType:@"plist"];
+ NSString* dstAgentDir = [@"~/Library/LaunchAgents" stringByExpandingTildeInPath];
+ NSString* dstAgent = [dstAgentDir stringByAppendingPathComponent:@"Nanofibre.plist"];
+ [[NSFileManager defaultManager] createDirectoryAtPath:dstAgentDir attributes:nil];
+ [[NSFileManager defaultManager] copyPath:srcAgent toPath:dstAgent handler:nil];
+
+ if (![[NSFileManager defaultManager] fileExistsAtPath:dstAgent])
+ {
+ agentFailed = YES;
+ NSString* msg = [NSString stringWithFormat:@"Failed to copy launch agent to %@.\nThe fibred agent has been left in /usr/local/bin", dstAgent];
+ NSRunAlertPanel(@"Couldn't install launch agent",msg,@"OK",nil,nil);
+ }
+ }
+
+ if (!daemonFailed && !agentFailed)
+ NSRunAlertPanel(@"Installation Succeeded", @"Successfully installed launch agent and the fibred daemon\nNanoFibre will generate a new playlist for you every night.", @"OK", nil, nil);
+ }
+ }
+}
+
+
-(BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theApplication
{
return YES;
View
BIN  ConstructPlaylist.scpt
Binary file not shown
View
2  English.lproj/MainMenu.nib/classes.nib
@@ -1,7 +1,7 @@
{
IBClasses = (
{
- ACTIONS = {makePlaylist = id; };
+ ACTIONS = {installDaemon = id; makePlaylist = id; };
CLASS = AppController;
LANGUAGE = ObjC;
OUTLETS = {sizeLabel = NSTextField; window = NSWindow; };
View
2  English.lproj/MainMenu.nib/info.nib
@@ -13,8 +13,8 @@
<string>446.1</string>
<key>IBOpenObjects</key>
<array>
- <integer>29</integer>
<integer>21</integer>
+ <integer>29</integer>
</array>
<key>IBSystem Version</key>
<string>8L127</string>
View
BIN  English.lproj/MainMenu.nib/keyedobjects.nib
Binary file not shown
View
13 English.lproj/MainMenu~.nib/classes.nib
@@ -1,13 +0,0 @@
-{
- IBClasses = (
- {
- ACTIONS = {makePlaylist = id; };
- CLASS = AppController;
- LANGUAGE = ObjC;
- OUTLETS = {sizeLabel = NSTextField; window = NSWindow; };
- SUPERCLASS = NSObject;
- },
- {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }
- );
- IBVersion = 1;
-}
View
22 English.lproj/MainMenu~.nib/info.nib
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>IBDocumentLocation</key>
- <string>609 496 356 240 0 0 1680 1028 </string>
- <key>IBEditorPositions</key>
- <dict>
- <key>29</key>
- <string>132 352 338 44 0 0 1680 1028 </string>
- </dict>
- <key>IBFramework Version</key>
- <string>446.1</string>
- <key>IBOpenObjects</key>
- <array>
- <integer>29</integer>
- <integer>21</integer>
- </array>
- <key>IBSystem Version</key>
- <string>8L127</string>
-</dict>
-</plist>
View
BIN  English.lproj/MainMenu~.nib/keyedobjects.nib
Binary file not shown
View
5 Fibre_Prefix.pch
@@ -5,6 +5,10 @@
#ifdef __OBJC__
#import <Cocoa/Cocoa.h>
+
+ // Rentzsh's handy enumeration macros. http://rentzsch.com/papers/improvingCocoaObjCEnumeration
+ // Bring on Obj-C 2.0, please.
+ // NB - Doesn't nest very well
#define nsenumerate_getEnumerator( TYPE, OBJ ) \
(TYPE)([OBJ isKindOfClass:[NSEnumerator class]] \
? OBJ \
@@ -24,5 +28,4 @@
ITERATOR_SYMBOL != nil; \
ITERATOR_SYMBOL = [((NSEnumerator*) enumerator) nextObject] )
-
#endif
View
4 HumanDiskSizeTransformer.h
@@ -1,9 +1,9 @@
//
// HumanDiskSizeTransformer.h
-// Fibre
+// NanoFibre
//
// Created by Jonathan del Strother on 08/10/2006.
-// Copyright 2006 Best Before Media Ltd. All rights reserved.
+// Copyright 2006. All rights reserved.
//
#import <Cocoa/Cocoa.h>
View
9 HumanDiskSizeTransformer.m
@@ -1,9 +1,9 @@
//
// HumanDiskSizeTransformer.m
-// Fibre
+// NanoFibre
//
// Created by Jonathan del Strother on 08/10/2006.
-// Copyright 2006 Best Before Media Ltd. All rights reserved.
+// Copyright 2006. All rights reserved.
//
#import "HumanDiskSizeTransformer.h"
@@ -48,7 +48,6 @@ -(id)reverseTransformedValue:(id)value; // NSString -> NSNumber
}
id returnValue = [NSNumber numberWithFloat:size];
- NSLog(@"reverse transform : %@ -> %@", value, returnValue);
return returnValue;
}
@@ -75,9 +74,7 @@ -(id)transformedValue:(id)value // NSNumber -> NSString
returnValue = [NSString stringWithFormat:@"%.0fMB", size*1024];
else
returnValue = [NSString stringWithFormat:@"%0.3gGB", size];
-
- NSLog(@"transform : %@ -> %@", value, returnValue);
-
+
return returnValue;
}
View
6 MusicLibrary.h
@@ -1,9 +1,9 @@
//
// MusicLibrary.h
-// Fibre
+// NanoFibre
//
// Created by Jonathan del Strother on 08/10/2006.
-// Copyright 2006 Best Before Media Ltd. All rights reserved.
+// Copyright 2006. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@@ -16,4 +16,4 @@
+(id)sharedLibrary;
-(void)createFibrePlaylist;
-@end
+@end
View
59 MusicLibrary.m
@@ -1,9 +1,9 @@
//
// MusicLibrary.m
-// Fibre
+// NanoFibre
//
// Created by Jonathan del Strother on 08/10/2006.
-// Copyright 2006 Best Before Media Ltd. All rights reserved.
+// Copyright 2006. All rights reserved.
//
#import "MusicLibrary.h"
@@ -104,17 +104,30 @@ -(id)init
return sharedLibrary;
}
-
+-(void)dealloc
+{
+ [albums release];
+ [libraryName release];
+ [super dealloc];
+}
-(void)loadLibrary
{
- NSDictionary* xml = [NSDictionary dictionaryWithContentsOfFile:@"/Users/jon/Music/iTunes/iTunes Music Library.xml"];
+ // This isn't particularly robust : It doesn't handle music libraries in odd locations, or ones that are linked to the usual location with aliases.
+ NSString* libraryPath = [@"~/Music/iTunes/iTunes Music Library.xml" stringByExpandingTildeInPath];
+
+ NSDictionary* xml = [NSDictionary dictionaryWithContentsOfFile:libraryPath];
+
+ if (!xml)
+ {
+ NSString* error = [NSString stringWithFormat:@"NanoFibre couldn't load your music library from %@. Sorry.", libraryPath];
+ NSRunAlertPanel(@"Couldn't load library", error, @"Quit",nil,nil);
+ [[NSApplication sharedApplication] terminate:self];
+ }
NSDictionary* tracks = [xml objectForKey:@"Tracks"];
- NSEnumerator* trackEnum = [tracks objectEnumerator];
- NSDictionary* track;
NSMutableDictionary* albumCollection = [NSMutableDictionary dictionary];
- while(track=[trackEnum nextObject])
+ nsenumerat(tracks, track)
{
if ([track objectForKey:@"Disabled"])
continue;
@@ -122,10 +135,8 @@ -(void)loadLibrary
if (!album)
{
album = [[Album alloc] init];
- NSString* albumTitle = [track objectForKey:@"Album"];
- if (!albumTitle)
- albumTitle = @"";
- [albumCollection setObject:album forKey:albumTitle];
+
+ [albumCollection setObject:album forKey:[Album albumKeyForTrack:track]];
[album release];
}
@@ -133,7 +144,7 @@ -(void)loadLibrary
}
albums = [[albumCollection allValues] retain];
-
+
//Need to find the name of the Library playlist - varies for different countries.
@@ -149,24 +160,25 @@ -(void)loadLibrary
if (!libraryName)
{
- [NSException raise:@"No Master Library" format:@"Couldn't find the itunes master library"];
+ [NSException raise:@"No Master Library" format:@"Couldn't find the iTunes master library"];
}
}
+
+// This is where we actually select some albums to play.
+// Could definitely be cleverer - it just deletes albums from the complete list until size<desiredSize.
+// ie it doesn't try to match desiredSize as closely as possible, it doesn't bias towards highly rated albums etc etc.
-(NSArray*)fibreSelection
{
NSMutableArray* albumSelection = [albums mutableCopy];
float maxSize = [[[NSUserDefaults standardUserDefaults] valueForKey:@"maxSize"] floatValue]*gigabytes();
-
- NSLog(@"Filter out big tracked albums (KCRW)/low rated ones/unchecked ones here");
-
-
+
while(totalSize(albumSelection) > maxSize)
{
[albumSelection removeObjectAtIndex:rand()%[albumSelection count]];
}
- NSLog(@"Album selection is %.3gGB", (float)(totalSize(albumSelection)/(1024.0*1024*1024)));
+ NSLog(@"Album selection is %.3gGB", totalSize(albumSelection)/(float)gigabytes());
return [[albumSelection copy] autorelease];
}
@@ -188,7 +200,7 @@ -(void)createFibrePlaylist
NSDictionary *errorInfo = nil;
- /* We have to construct an AppleEvent descriptor to contain the arguments for our handler call. Remember that this list is 1, rather than 0, based. */
+ // We have to construct an AppleEvent descriptor to contain the arguments for our handler call. Remember that this list is 1, rather than 0, based
NSAppleEventDescriptor *list = [[NSAppleEventDescriptor alloc] initListDescriptor];
int index = 0;
[list insertDescriptor:[NSAppleEventDescriptor descriptorWithString:libraryName] atIndex:++index];
@@ -201,7 +213,7 @@ -(void)createFibrePlaylist
[list insertDescriptor:pathDescriptor atIndex:++index];
}
- if (index > 1) //check that we actually have some tracks to play)
+ if (index > 1) //check that we actually have some tracks to play
{
NSAppleEventDescriptor *arguments = [[NSAppleEventDescriptor alloc] initListDescriptor];
@@ -210,8 +222,7 @@ -(void)createFibrePlaylist
errorInfo = nil;
- /* Call the handler using the method in our special category */
- NSAppleEventDescriptor *result = [script callHandler:@"launch_album" withArguments: arguments errorInfo: &errorInfo];
+ NSAppleEventDescriptor *result = [script callHandler:@"construct_playlist" withArguments: arguments errorInfo: &errorInfo];
#pragma unused(result)
/* Check for errors in running the handler */
@@ -222,9 +233,7 @@ -(void)createFibrePlaylist
[arguments release];
}
[list release];
-
-
-
+
}
@end
View
98 NanoFibre.xcodeproj/jon.mode2
@@ -266,8 +266,6 @@
<key>Tabs</key>
<array>
<dict>
- <key>BecomeActive</key>
- <true/>
<key>ContentConfiguration</key>
<dict>
<key>PBXBottomSmartGroupGIDs</key>
@@ -303,12 +301,16 @@
<string>080E96DDFE201D6D7F000001</string>
<string>29B97315FDCFA39411CA2CEA</string>
<string>29B97317FDCFA39411CA2CEA</string>
+ <string>29B97318FDCFA39411CA2CEA</string>
+ <string>29B97319FDCFA39411CA2CEA</string>
+ <string>29B97323FDCFA39411CA2CEA</string>
+ <string>19C28FACFE9D520D11CA2CBB</string>
</array>
<key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key>
<array>
<array>
- <integer>12</integer>
- <integer>11</integer>
+ <integer>28</integer>
+ <integer>26</integer>
<integer>0</integer>
</array>
</array>
@@ -335,13 +337,13 @@
<string>WarningsColumn</string>
<real>43</real>
</array>
- <key>RubberWindowFrame</key>
- <string>122 227 292 605 0 0 1280 832 </string>
</dict>
<key>Module</key>
<string>PBXSmartGroupTreeModule</string>
</dict>
<dict>
+ <key>BecomeActive</key>
+ <true/>
<key>ContentConfiguration</key>
<dict>
<key>PBXBottomSmartGroupGIDs</key>
@@ -371,10 +373,18 @@
<key>PBXSmartGroupTreeModuleOutlineStateExpansionKey</key>
<array>
<string>1C37FBAC04509CD000000102</string>
+ <string>FC96CCC20AEC17C900334757</string>
+ <string>FC96CCC30AEC17C900334757</string>
+ <string>FC96CCC40AEC17C900334757</string>
+ <string>FC96CCC50AEC17C900334757</string>
+ <string>FC96CCBA0AEC176A00334757</string>
+ <string>FC96CCC60AEC17C900334757</string>
+ <string>1C37FAAC04509CD000000102</string>
</array>
<key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key>
<array>
<array>
+ <integer>1</integer>
<integer>0</integer>
</array>
</array>
@@ -395,6 +405,8 @@
<string>MainColumn</string>
<real>275</real>
</array>
+ <key>RubberWindowFrame</key>
+ <string>931 211 292 605 0 0 1280 832 </string>
</dict>
<key>Module</key>
<string>PBXSmartGroupTreeModule</string>
@@ -475,8 +487,8 @@
</array>
<key>TableOfContents</key>
<array>
- <string>FC51A72E0AE2D964006B4D57</string>
- <string>FC51A72F0AE2D964006B4D57</string>
+ <string>FC96CBB10AEBECE100334757</string>
+ <string>FC96CBB20AEBECE100334757</string>
<string>1C9437FD063B20B00039CFAC</string>
<string>1C9437FE063B20B00039CFAC</string>
<string>1C9437FF063B20B00039CFAC</string>
@@ -494,7 +506,7 @@
<key>StatusbarIsVisible</key>
<true/>
<key>TimeStamp</key>
- <real>182638944.54651701</real>
+ <real>183247394.84825799</real>
<key>ToolbarDisplayMode</key>
<integer>1</integer>
<key>ToolbarIsVisible</key>
@@ -509,10 +521,18 @@
<integer>0</integer>
<key>WindowOrderList</key>
<array>
+ <string>1C530D57069F1CE1000CFCEE</string>
+ <string>1C0AD2B3069F1EA900FABCE6</string>
+ <string>FC96CBE40AEBF6BB00334757</string>
+ <string>FC96CBE50AEBF6BB00334757</string>
+ <string>1C530D5B069F1CE1000CFCEE</string>
+ <string>1C530D54069F1CE1000CFCEE</string>
+ <string>FC96CBE20AEBF6BB00334757</string>
+ <string>1C530D52069F1CE1000CFCEE</string>
<string>/Users/jon/Developer/NanoFibre/NanoFibre.xcodeproj</string>
</array>
<key>WindowString</key>
- <string>122 227 292 605 0 0 1280 832 </string>
+ <string>931 211 292 605 0 0 1280 832 </string>
<key>WindowTools</key>
<array>
<dict>
@@ -670,7 +690,7 @@
<key>PBXProjectModuleGUID</key>
<string>1CD0528F0623707200166675</string>
<key>PBXProjectModuleLabel</key>
- <string></string>
+ <string>AppController.m</string>
<key>StatusBarVisibility</key>
<true/>
</dict>
@@ -679,7 +699,7 @@
<key>Frame</key>
<string>{{0, 0}, {1244, 200}}</string>
<key>RubberWindowFrame</key>
- <string>22 231 1244 482 0 0 1280 832 </string>
+ <string>37 350 1244 482 0 0 1280 832 </string>
</dict>
<key>Module</key>
<string>PBXNavigatorGroup</string>
@@ -705,7 +725,7 @@
<key>Frame</key>
<string>{{0, 205}, {1244, 236}}</string>
<key>RubberWindowFrame</key>
- <string>22 231 1244 482 0 0 1280 832 </string>
+ <string>37 350 1244 482 0 0 1280 832 </string>
</dict>
<key>Module</key>
<string>PBXBuildResultsModule</string>
@@ -728,18 +748,18 @@
<key>TableOfContents</key>
<array>
<string>1C530D52069F1CE1000CFCEE</string>
- <string>FCE872A90AE260C600008832</string>
+ <string>FC96CBDB0AEBF6BB00334757</string>
<string>1CD0528F0623707200166675</string>
<string>XCMainBuildResultsModuleGUID</string>
</array>
<key>ToolbarConfiguration</key>
<string>xcode.toolbar.config.build</string>
<key>WindowString</key>
- <string>22 231 1244 482 0 0 1280 832 </string>
+ <string>37 350 1244 482 0 0 1280 832 </string>
<key>WindowToolGUID</key>
<string>1C530D52069F1CE1000CFCEE</string>
<key>WindowToolIsVisible</key>
- <true/>
+ <false/>
</dict>
<dict>
<key>FirstTimeWindowDisplayed</key>
@@ -770,8 +790,8 @@
<string>yes</string>
<key>sizes</key>
<array>
- <string>{{0, 0}, {478, 265}}</string>
- <string>{{478, 0}, {586, 265}}</string>
+ <string>{{0, 0}, {476, 266}}</string>
+ <string>{{476, 0}, {588, 266}}</string>
</array>
</dict>
<key>VerticalSplitView</key>
@@ -786,8 +806,8 @@
<string>yes</string>
<key>sizes</key>
<array>
- <string>{{0, 0}, {1064, 265}}</string>
- <string>{{0, 265}, {1064, 242}}</string>
+ <string>{{0, 0}, {1064, 266}}</string>
+ <string>{{0, 266}, {1064, 241}}</string>
</array>
</dict>
</dict>
@@ -811,7 +831,7 @@
<key>Frame</key>
<string>{{0, 0}, {1064, 507}}</string>
<key>RubberWindowFrame</key>
- <string>296 247 1064 548 0 0 1280 832 </string>
+ <string>168 268 1064 548 0 0 1280 832 </string>
</dict>
<key>Module</key>
<string>PBXDebugSessionModule</string>
@@ -834,19 +854,19 @@
<key>TableOfContents</key>
<array>
<string>1C530D54069F1CE1000CFCEE</string>
- <string>FC0F29DD0AE04DF500C72116</string>
+ <string>FC96CBDC0AEBF6BB00334757</string>
<string>1C162984064C10D400B95A72</string>
- <string>FC0F29DE0AE04DF500C72116</string>
- <string>FC0F29DF0AE04DF500C72116</string>
- <string>FC0F29E00AE04DF500C72116</string>
- <string>FC0F29E10AE04DF500C72116</string>
- <string>FC0F29E20AE04DF500C72116</string>
- <string>FC0F29E30AE04DF500C72116</string>
+ <string>FC96CBDD0AEBF6BB00334757</string>
+ <string>FC96CBDE0AEBF6BB00334757</string>
+ <string>FC96CBDF0AEBF6BB00334757</string>
+ <string>FC96CBE00AEBF6BB00334757</string>
+ <string>FC96CBE10AEBF6BB00334757</string>
+ <string>FC96CBE20AEBF6BB00334757</string>
</array>
<key>ToolbarConfiguration</key>
<string>xcode.toolbar.config.debug</string>
<key>WindowString</key>
- <string>296 247 1064 548 0 0 1280 832 </string>
+ <string>168 268 1064 548 0 0 1280 832 </string>
<key>WindowToolGUID</key>
<string>1C530D54069F1CE1000CFCEE</string>
<key>WindowToolIsVisible</key>
@@ -875,7 +895,7 @@
<key>PBXProjectModuleGUID</key>
<string>1CDD528C0622207200134675</string>
<key>PBXProjectModuleLabel</key>
- <string>Album.h</string>
+ <string>HumanDiskSizeTransformer.m</string>
<key>StatusBarVisibility</key>
<true/>
</dict>
@@ -931,8 +951,8 @@
<key>TableOfContents</key>
<array>
<string>1C530D57069F1CE1000CFCEE</string>
- <string>FCE872C20AE2B38B00008832</string>
- <string>FCE872C30AE2B38B00008832</string>
+ <string>FC96CC9F0AEC148A00334757</string>
+ <string>FC96CCA00AEC148A00334757</string>
<string>1CDD528C0622207200134675</string>
<string>1CD0528E0623707200166675</string>
</array>
@@ -974,7 +994,7 @@
<key>Frame</key>
<string>{{0, 0}, {599, 377}}</string>
<key>RubberWindowFrame</key>
- <string>1104 610 599 418 0 0 1280 832 </string>
+ <string>677 64 599 418 0 0 1280 832 </string>
</dict>
<key>Module</key>
<string>PBXDebugCLIModule</string>
@@ -997,11 +1017,11 @@
<key>TableOfContents</key>
<array>
<string>1C530D5B069F1CE1000CFCEE</string>
- <string>FC0F29E40AE04DF500C72116</string>
+ <string>FC96CBE30AEBF6BB00334757</string>
<string>1C78EAAC065D492600B07095</string>
</array>
<key>WindowString</key>
- <string>1104 610 599 418 0 0 1280 832 </string>
+ <string>677 64 599 418 0 0 1280 832 </string>
<key>WindowToolGUID</key>
<string>1C530D5B069F1CE1000CFCEE</string>
<key>WindowToolIsVisible</key>
@@ -1069,7 +1089,7 @@
<key>Frame</key>
<string>{{0, 0}, {932, 559}}</string>
<key>RubberWindowFrame</key>
- <string>392 232 932 600 0 0 1280 832 </string>
+ <string>182 139 932 600 0 0 1280 832 </string>
</dict>
<key>Module</key>
<string>PBXRunSessionModule</string>
@@ -1092,14 +1112,14 @@
<key>TableOfContents</key>
<array>
<string>1C0AD2B3069F1EA900FABCE6</string>
- <string>FC0F297E0AE0455100C72116</string>
+ <string>FC96CBFB0AEC07FB00334757</string>
<string>1CD0528B0623707200166675</string>
- <string>FC0F297F0AE0455100C72116</string>
+ <string>FC96CBFC0AEC07FB00334757</string>
</array>
<key>ToolbarConfiguration</key>
<string>xcode.toolbar.config.run</string>
<key>WindowString</key>
- <string>392 232 932 600 0 0 1280 832 </string>
+ <string>182 139 932 600 0 0 1280 832 </string>
<key>WindowToolGUID</key>
<string>1C0AD2B3069F1EA900FABCE6</string>
<key>WindowToolIsVisible</key>
View
47 NanoFibre.xcodeproj/project.pbxproj
@@ -14,6 +14,9 @@
FC0F2B380AE25E9D00C72116 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FC0F2B370AE25E9D00C72116 /* Cocoa.framework */; };
FC0F2B3E0AE25ECF00C72116 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FC0F2B3D0AE25ECF00C72116 /* Carbon.framework */; };
FC0F2B410AE25ED100C72116 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FC0F2B370AE25E9D00C72116 /* Cocoa.framework */; };
+ FC6DDFC20AEBE7FF00750E46 /* Nanofibre.plist in Resources */ = {isa = PBXBuildFile; fileRef = FC6DDFC10AEBE7FF00750E46 /* Nanofibre.plist */; };
+ FC96CC0F0AEC0BA300334757 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FC96CC0E0AEC0BA300334757 /* Security.framework */; };
+ FC96CCBF0AEC17B800334757 /* fibred in CopyFiles */ = {isa = PBXBuildFile; fileRef = FC0F29A70AE04CD700C72116 /* fibred */; };
FCB47F340AD990FE00634969 /* HumanDiskSizeTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = FCB47F330AD990FE00634969 /* HumanDiskSizeTransformer.m */; };
FCB4800A0AD9A53200634969 /* MusicLibrary.m in Sources */ = {isa = PBXBuildFile; fileRef = FCB480090AD9A53200634969 /* MusicLibrary.m */; };
FCBD155A0AD9ABD8004C200C /* NSAppleEventDescriptor+NDAppleScriptObject.m in Sources */ = {isa = PBXBuildFile; fileRef = FCBD15590AD9ABD8004C200C /* NSAppleEventDescriptor+NDAppleScriptObject.m */; };
@@ -26,15 +29,28 @@
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
- FC0F2AA80AE0E00B00C72116 /* PBXContainerItemProxy */ = {
+ FC96CCB70AEC175000334757 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 29B97313FDCFA39411CA2CEA /* Project object */;
proxyType = 1;
- remoteGlobalIDString = 8D1107260486CEB800E47090;
- remoteInfo = Spinner;
+ remoteGlobalIDString = FC0F29A60AE04CD700C72116 /* fibred */;
+ remoteInfo = fibred;
};
/* End PBXContainerItemProxy section */
+/* Begin PBXCopyFilesBuildPhase section */
+ FC96CCB90AEC176A00334757 /* CopyFiles */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 2147483647;
+ dstPath = "";
+ dstSubfolderSpec = 6;
+ files = (
+ FC96CCBF0AEC17B800334757 /* fibred in CopyFiles */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXCopyFilesBuildPhase section */
+
/* Begin PBXFileReference section */
089C165DFE840E0CC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
13E42FB307B3F0F600E4EEF1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; };
@@ -44,11 +60,13 @@
29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
32CA4F630368D1EE00C91783 /* Fibre_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Fibre_Prefix.pch; sourceTree = "<group>"; };
8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
- 8D1107320486CEB800E47090 /* NanoFibre.app */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.application; path = NanoFibre.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ 8D1107320486CEB800E47090 /* NanoFibre.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = NanoFibre.app; sourceTree = BUILT_PRODUCTS_DIR; };
FC0F29A70AE04CD700C72116 /* fibred */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = fibred; sourceTree = BUILT_PRODUCTS_DIR; };
FC0F29B60AE04D1000C72116 /* main_daemon.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main_daemon.m; sourceTree = "<group>"; };
FC0F2B370AE25E9D00C72116 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
FC0F2B3D0AE25ECF00C72116 /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/Carbon.framework; sourceTree = "<absolute>"; };
+ FC6DDFC10AEBE7FF00750E46 /* Nanofibre.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xml; path = Nanofibre.plist; sourceTree = "<group>"; };
+ FC96CC0E0AEC0BA300334757 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/Security.framework; sourceTree = "<absolute>"; };
FCB47F320AD990FE00634969 /* HumanDiskSizeTransformer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HumanDiskSizeTransformer.h; sourceTree = "<group>"; };
FCB47F330AD990FE00634969 /* HumanDiskSizeTransformer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HumanDiskSizeTransformer.m; sourceTree = "<group>"; };
FCB480080AD9A53200634969 /* MusicLibrary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MusicLibrary.h; sourceTree = "<group>"; };
@@ -74,6 +92,7 @@
buildActionMask = 2147483647;
files = (
FC0F2B380AE25E9D00C72116 /* Cocoa.framework in Frameworks */,
+ FC96CC0F0AEC0BA300334757 /* Security.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -93,12 +112,10 @@
isa = PBXGroup;
children = (
FC0F29810AE0456E00C72116 /* Utilities */,
- FCE434D40AD0379000415644 /* AppController.h */,
- FCE434D50AD0379000415644 /* AppController.m */,
FCE435030AD045ED00415644 /* Album.h */,
FCE435040AD045ED00415644 /* Album.m */,
- FCB47F320AD990FE00634969 /* HumanDiskSizeTransformer.h */,
- FCB47F330AD990FE00634969 /* HumanDiskSizeTransformer.m */,
+ FCE434D40AD0379000415644 /* AppController.h */,
+ FCE434D50AD0379000415644 /* AppController.m */,
FCB480080AD9A53200634969 /* MusicLibrary.h */,
FCB480090AD9A53200634969 /* MusicLibrary.m */,
);
@@ -108,6 +125,7 @@
1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = {
isa = PBXGroup;
children = (
+ FC96CC0E0AEC0BA300334757 /* Security.framework */,
FC0F2B3D0AE25ECF00C72116 /* Carbon.framework */,
FC0F2B370AE25E9D00C72116 /* Cocoa.framework */,
);
@@ -162,6 +180,7 @@
089C165CFE840E0CC02AAC07 /* InfoPlist.strings */,
29B97318FDCFA39411CA2CEA /* MainMenu.nib */,
FCBD15690AD9AC5C004C200C /* ConstructPlaylist.scpt */,
+ FC6DDFC10AEBE7FF00750E46 /* Nanofibre.plist */,
);
name = Resources;
sourceTree = "<group>";
@@ -178,6 +197,8 @@
FC0F29810AE0456E00C72116 /* Utilities */ = {
isa = PBXGroup;
children = (
+ FCB47F320AD990FE00634969 /* HumanDiskSizeTransformer.h */,
+ FCB47F330AD990FE00634969 /* HumanDiskSizeTransformer.m */,
FCBD15580AD9ABD8004C200C /* NSAppleEventDescriptor+NDAppleScriptObject.h */,
FCBD15590AD9ABD8004C200C /* NSAppleEventDescriptor+NDAppleScriptObject.m */,
FCBD155C0AD9ABE7004C200C /* NSURL+NDCarbonUtilities.m */,
@@ -200,10 +221,12 @@
8D1107290486CEB800E47090 /* Resources */,
8D11072C0486CEB800E47090 /* Sources */,
8D11072E0486CEB800E47090 /* Frameworks */,
+ FC96CCB90AEC176A00334757 /* CopyFiles */,
);
buildRules = (
);
dependencies = (
+ FC96CCB80AEC175000334757 /* PBXTargetDependency */,
);
name = NanoFibre;
productInstallPath = "$(HOME)/Applications";
@@ -221,7 +244,6 @@
buildRules = (
);
dependencies = (
- FC0F2AA90AE0E00B00C72116 /* PBXTargetDependency */,
);
name = fibred;
productName = spinnerd;
@@ -252,6 +274,7 @@
FCBD15E70AD9B010004C200C /* ConstructPlaylist.scpt in Resources */,
8D11072A0486CEB800E47090 /* MainMenu.nib in Resources */,
8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */,
+ FC6DDFC20AEBE7FF00750E46 /* Nanofibre.plist in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -285,10 +308,10 @@
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
- FC0F2AA90AE0E00B00C72116 /* PBXTargetDependency */ = {
+ FC96CCB80AEC175000334757 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
- target = 8D1107260486CEB800E47090 /* NanoFibre */;
- targetProxy = FC0F2AA80AE0E00B00C72116 /* PBXContainerItemProxy */;
+ target = FC0F29A60AE04CD700C72116 /* fibred */;
+ targetProxy = FC96CCB70AEC175000334757 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
View
21 Nanofibre.plist
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>Label</key>
+ <string>Nanofibre</string>
+ <key>Program</key>
+ <string>/usr/local/bin/fibred</string>
+ <key>ProgramArguments</key>
+ <array>
+ <string>/usr/local/bin/fibred</string>
+ </array>
+ <key>ServiceDescription</key>
+ <string>Launch Nanofibre to generate nano-sized playlists</string>
+ <key>StartCalendarInterval</key>
+ <dict>
+ <key>Hour</key>
+ <integer>3</integer>
+ </dict>
+</dict>
+</plist>
View
6 main.m
@@ -1,9 +1,9 @@
//
// main.m
-// Fibre
+// NanoFibre
//
// Created by Jonathan del Strother on 01/10/2006.
-// Copyright Best Before Media Ltd 2006. All rights reserved.
+// Copyright 2006. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@@ -11,5 +11,5 @@
int main(int argc, char *argv[])
{
srand(time(NULL));
- return NSApplicationMain(argc, (const char **) argv);
+ return NSApplicationMain(argc, (const char **) argv);
}
View
12 main_daemon.m
@@ -1,9 +1,9 @@
/*
* main_daemon.c
- * Fibre
+ * NanoFibre
*
* Created by Jonathan del Strother on 13/10/2006.
- * Copyright 2006 Best Before Media Ltd. All rights reserved.
+ * Copyright 2006. All rights reserved.
*
*/
@@ -19,24 +19,22 @@ int main(int argc, char *argv[])
FSRef appRef;
if (LSFindApplicationForInfo(kLSUnknownCreator, CFSTR("com.steelskies.nanofibre"), NULL, &appRef, NULL ) == kLSApplicationNotFoundErr)
{
- NSLog(@"Couldn't find Fibre app");
+ NSLog(@"Couldn't find NanoFibre app");
return 1;
}
- NSLog(@"launching %@", CFURLCreateFromFSRef( kCFAllocatorDefault, &appRef ));
-
LSApplicationParameters appParams;
appParams.version = 0;
appParams.flags = kLSLaunchAsync | kLSLaunchDontSwitch | kLSLaunchDontAddToRecents | kLSLaunchAndHide;
appParams.application = &appRef;
appParams.asyncLaunchRefCon = NULL;
+ //Tell the app that we want to run in daemon mode. We're using the environment vars to do this, because...
appParams.environment = (CFDictionaryRef)[NSDictionary dictionaryWithObject:@"yes" forKey:@"fibreDaemon"];
+ // ..."This field is ignored in Mac OS X v10.4". Cheers guys.
appParams.argv = NULL;
appParams.initialEvent = NULL;
LSOpenApplication(&appParams, NULL);
-
-// LSLaunchRefSpec
[pool release];
Please sign in to comment.
Something went wrong with that request. Please try again.