Skip to content

Commit

Permalink
Growl
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefano Pigozzi committed Aug 20, 2009
1 parent 2fe37ef commit dfa983e
Show file tree
Hide file tree
Showing 9 changed files with 607 additions and 211 deletions.
6 changes: 6 additions & 0 deletions AnimeRecognitionEngine.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
#import "MALHandler.h"
#import "UpdateOperation.h"

#import <Growl/GrowlApplicationBridge.h>

@implementation AnimeRecognitionEngine

-(void)awakeFromNib
Expand Down Expand Up @@ -168,6 +170,10 @@ - (BOOL) recognizeEpisodeByTryingNext:(NSArray *)a onName:(NSString *)title{
[values setObject:@"1" forKey:@"status"];
[values setObject:[NSString stringWithFormat:@"%d", next_episode] forKey:@"episode"];
[mal.queue addOperation:[[[UpdateOperation alloc] initWithEntry:(Entry *)anime values:values callback:nil] autorelease]];
[GrowlApplicationBridge notifyWithTitle:[NSString stringWithFormat:@"Scrobbling file", [(Entry*)anime imageTitle]]
description:[NSString stringWithFormat:@"Scrobbling episode %@ of %@", [values valueForKey:@"episode"], [(Entry*)anime imageTitle]]
notificationName:@"Scrobbled file" iconData:nil
priority:0 isSticky:NO clickContext:nil];
return YES;
}
}
Expand Down
79 changes: 74 additions & 5 deletions English.lproj/MainMenu.xib
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
<string key="IBDocument.HIToolboxVersion">353.00</string>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="566"/>
<integer value="21"/>
<integer value="656"/>
<integer value="566"/>
<integer value="554"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
Expand Down Expand Up @@ -486,6 +486,26 @@
<int key="NSPeriodicInterval">75</int>
</object>
</object>
<object class="NSButton" id="228994650">
<reference key="NSNextResponder" ref="754222286"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{68, 4}, {25, 18}}</string>
<reference key="NSSuperview" ref="754222286"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="728038371">
<int key="NSCellFlags">-2080244224</int>
<int key="NSCellFlags2">134348800</int>
<string key="NSContents">?</string>
<reference key="NSSupport" ref="26"/>
<reference key="NSControlView" ref="228994650"/>
<int key="NSButtonFlags">-2038152961</int>
<int key="NSButtonFlags2">160</int>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
<int key="NSPeriodicDelay">400</int>
<int key="NSPeriodicInterval">75</int>
</object>
</object>
</object>
<string key="NSFrameSize">{480, 360}</string>
<reference key="NSSuperview" ref="823886803"/>
Expand Down Expand Up @@ -1242,6 +1262,9 @@
<object class="NSCustomObject" id="769344718">
<string key="NSClassName">AnimeRecognitionEngine</string>
</object>
<object class="NSCustomObject" id="214163369">
<string key="NSClassName">MALNotificationsController</string>
</object>
</object>
<object class="IBObjectContainer" key="IBDocument.Objects">
<object class="NSMutableArray" key="connectionRecords">
Expand Down Expand Up @@ -1862,6 +1885,14 @@
</object>
<int key="connectionID">667</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">denwaAction:</string>
<reference key="source" ref="214163369"/>
<reference key="destination" ref="228994650"/>
</object>
<int key="connectionID">673</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
Expand Down Expand Up @@ -2413,6 +2444,7 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="497311029"/>
<reference ref="575204619"/>
<reference ref="228994650"/>
</object>
<reference key="parent" ref="823886803"/>
</object>
Expand Down Expand Up @@ -2629,6 +2661,25 @@
<reference key="object" ref="769344718"/>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">668</int>
<reference key="object" ref="214163369"/>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">669</int>
<reference key="object" ref="228994650"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="728038371"/>
</object>
<reference key="parent" ref="754222286"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">670</int>
<reference key="object" ref="728038371"/>
<reference key="parent" ref="228994650"/>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
Expand Down Expand Up @@ -2808,6 +2859,9 @@
<string>656.IBPluginDependency</string>
<string>662.IBPluginDependency</string>
<string>663.IBPluginDependency</string>
<string>668.IBPluginDependency</string>
<string>669.IBPluginDependency</string>
<string>670.IBPluginDependency</string>
<string>73.IBPluginDependency</string>
<string>73.ImportedFromIB2</string>
<string>81.IBEditorWindowLastContentRect</string>
Expand Down Expand Up @@ -2893,8 +2947,8 @@
<reference ref="9"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
<string>{{469, 53}, {480, 360}}</string>
<string>{{469, 53}, {480, 360}}</string>
<string>{{137, 14}, {480, 360}}</string>
<string>{{137, 14}, {480, 360}}</string>
<reference ref="9"/>
<reference ref="9"/>
<reference ref="9"/>
Expand Down Expand Up @@ -2992,6 +3046,9 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
<string>{{139, 941}, {118, 23}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
Expand Down Expand Up @@ -3020,7 +3077,7 @@
</object>
</object>
<nil key="sourceID"/>
<int key="maxID">667</int>
<int key="maxID">673</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
Expand Down Expand Up @@ -3104,6 +3161,18 @@
<string key="minorKey">ListWindowController.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">MALNotificationsController</string>
<string key="superclassName">NSObject</string>
<object class="NSMutableDictionary" key="actions">
<string key="NS.key.0">denwaAction:</string>
<string key="NS.object.0">id</string>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">MALNotificationsController.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">MPlayerHandler</string>
<string key="superclassName">NSObject</string>
Expand Down
1 change: 1 addition & 0 deletions Entry.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@
-(NSAttributedString *)__bold_title;
-(NSString *)imageTitle;
-(NSString *)imageSubtitle;
-(id)imageRepresentation;

@end
18 changes: 18 additions & 0 deletions MALNotificationsController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// MALNotificationsController.h
// iMAL
//
// Created by Stefano Pigozzi on 8/18/09.
// Copyright 2009 Stefano Pigozzi. All rights reserved.
//

#import <Cocoa/Cocoa.h>
#import <Growl/Growl.h>

@interface MALNotificationsController : NSObject <GrowlApplicationBridgeDelegate> {

}

- (IBAction) denwaAction: (id) sender;

@end
35 changes: 35 additions & 0 deletions MALNotificationsController.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//
// MALNotificationsController.m
// iMAL
//
// Created by Stefano Pigozzi on 8/18/09.
// Copyright 2009 Stefano Pigozzi. All rights reserved.
//

#import "MALNotificationsController.h"


@implementation MALNotificationsController


- (NSDictionary *) registrationDictionaryForGrowl{
NSArray * n_all = [NSArray arrayWithObjects:@"Denwa", @"Scrobbled file", nil];
NSArray * n_default = [NSArray arrayWithObjects:@"Denwa", @"Scrobbled file", nil];
return [NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:n_all, n_default, nil]
forKeys:[NSArray arrayWithObjects:GROWL_NOTIFICATIONS_ALL, GROWL_NOTIFICATIONS_DEFAULT, nil]];
}

- (void) awakeFromNib
{
[GrowlApplicationBridge setGrowlDelegate:self];
}

- (IBAction) denwaAction: (id) sender
{
[GrowlApplicationBridge notifyWithTitle:@"KYON-KUN DENWA!!!"
description:@"Phone is ringing and iMAL is awesome!"
notificationName:@"Denwa" iconData:nil
priority:0 isSticky:NO clickContext:nil];
}

@end
4 changes: 2 additions & 2 deletions MPlayerHandler.m
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,14 @@ -(void) sample
} else {
self.playingPath = nil;
}
[self performSelector:@selector(sample) withObject:nil afterDelay: 10];
[self performSelector:@selector(sample) withObject:nil afterDelay: 60];
}

- (id) init
{
self = [super init];
if (self != nil) {
[self performSelector:@selector(sample) withObject:nil afterDelay: 10];
[self performSelector:@selector(sample) withObject:nil afterDelay: 60];
}
return self;
}
Expand Down
20 changes: 20 additions & 0 deletions iMAL.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@
7BCD895E1036AA6A0081692E /* MPlayerHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 7BCD895D1036AA6A0081692E /* MPlayerHandler.m */; };
7BD2337D10282BC0009447A6 /* SearchPanel.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7BD2337C10282BC0009447A6 /* SearchPanel.xib */; };
7BD7BE3F1036FD62009C9A66 /* AnimeRecognitionEngine.m in Sources */ = {isa = PBXBuildFile; fileRef = 7BD7BE3E1036FD62009C9A66 /* AnimeRecognitionEngine.m */; };
7BE7C903103B0F9F00E12105 /* Growl-WithInstaller.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7BE7C902103B0F9F00E12105 /* Growl-WithInstaller.framework */; };
7BE7C911103B0FAA00E12105 /* Growl-WithInstaller.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 7BE7C902103B0F9F00E12105 /* Growl-WithInstaller.framework */; };
7BE7C9D5103B1F9D00E12105 /* MALNotificationsController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7BE7C9D4103B1F9D00E12105 /* MALNotificationsController.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 */; };
Expand All @@ -63,6 +66,7 @@
dstPath = "";
dstSubfolderSpec = 10;
files = (
7BE7C911103B0FAA00E12105 /* Growl-WithInstaller.framework in CopyFiles */,
7BBBABB310258D8A00E33747 /* RegexKit.framework in CopyFiles */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -147,6 +151,9 @@
7BD2337C10282BC0009447A6 /* SearchPanel.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = SearchPanel.xib; sourceTree = "<group>"; };
7BD7BE3D1036FD62009C9A66 /* AnimeRecognitionEngine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AnimeRecognitionEngine.h; sourceTree = "<group>"; };
7BD7BE3E1036FD62009C9A66 /* AnimeRecognitionEngine.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AnimeRecognitionEngine.m; sourceTree = "<group>"; };
7BE7C902103B0F9F00E12105 /* Growl-WithInstaller.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; name = "Growl-WithInstaller.framework"; path = "/Library/Frameworks/Growl-WithInstaller.framework"; sourceTree = "<absolute>"; };
7BE7C9D3103B1F9D00E12105 /* MALNotificationsController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MALNotificationsController.h; sourceTree = "<group>"; };
7BE7C9D4103B1F9D00E12105 /* MALNotificationsController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MALNotificationsController.m; sourceTree = "<group>"; };
8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
8D1107320486CEB800E47090 /* iMAL.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = iMAL.app; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
Expand All @@ -159,6 +166,7 @@
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */,
7BBBABB110258D2B00E33747 /* RegexKit.framework in Frameworks */,
7B94E786102C4D68005D6501 /* Quartz.framework in Frameworks */,
7BE7C903103B0F9F00E12105 /* Growl-WithInstaller.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -168,6 +176,7 @@
080E96DDFE201D6D7F000001 /* Classes */ = {
isa = PBXGroup;
children = (
7BE7C976103B101600E12105 /* Notifications */,
7BCD895B1036AA100081692E /* Recognition */,
7BCCF93A102C31A6000423D9 /* Widgets */,
7B98FB94102AFB3200173E92 /* List */,
Expand All @@ -184,6 +193,7 @@
1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = {
isa = PBXGroup;
children = (
7BE7C902103B0F9F00E12105 /* Growl-WithInstaller.framework */,
7B94E785102C4D68005D6501 /* Quartz.framework */,
7BBBABB010258D2B00E33747 /* RegexKit.framework */,
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */,
Expand Down Expand Up @@ -379,6 +389,15 @@
name = Search;
sourceTree = "<group>";
};
7BE7C976103B101600E12105 /* Notifications */ = {
isa = PBXGroup;
children = (
7BE7C9D3103B1F9D00E12105 /* MALNotificationsController.h */,
7BE7C9D4103B1F9D00E12105 /* MALNotificationsController.m */,
);
name = Notifications;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand Down Expand Up @@ -476,6 +495,7 @@
7B5E36E01036DCC300C0FA69 /* RecognitionPrefsViewController.m in Sources */,
7BD7BE3F1036FD62009C9A66 /* AnimeRecognitionEngine.m in Sources */,
7B09FA0F1037FD560031C5DF /* IndexOperation.m in Sources */,
7BE7C9D5103B1F9D00E12105 /* MALNotificationsController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
Loading

0 comments on commit dfa983e

Please sign in to comment.