Permalink
Browse files

Add dsa file required for Sparkle Updates, Added "Scrobble" functiona…

…lity and iTunes detection outputs artist name as well, but not used yet. Version is now 0.2a
  • Loading branch information...
chikorita157 committed Mar 30, 2010
1 parent 5d90ffc commit c71ff5d9dee163a59fa0c8ed63f6b35151b7a6cc
View
0 English.lproj/InfoPlist.strings 100644 → 100755
No changes.
View
261 English.lproj/MainMenu.xib 100644 → 100755

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -22,6 +22,7 @@
3A313513114D89E10046D05E /* ASINSStringAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 3A31350E114D89E10046D05E /* ASINSStringAdditions.m */; };
3A33FEED11604686001D78D9 /* Preferences.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3A33FEEC11604686001D78D9 /* Preferences.xib */; };
3A33FF2C11604EBA001D78D9 /* BWToolkitFramework.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3A33FEE511604626001D78D9 /* BWToolkitFramework.framework */; };
+ 3A49BD411162A78E0048007B /* dsa_pub.pem in Resources */ = {isa = PBXBuildFile; fileRef = 3A49BD401162A78E0048007B /* dsa_pub.pem */; };
3A4D7E8C115C304B005266C2 /* login.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 3A4D7E8B115C304B005266C2 /* login.tiff */; };
3A51E9D411600F47005F1027 /* melativeicon.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 3A51E9D311600F47005F1027 /* melativeicon.tiff */; };
3A6DAA53115B066300695124 /* Melative_ExampleAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 3A6DAA51115B066300695124 /* Melative_ExampleAppDelegate.m */; };
@@ -85,6 +86,7 @@
3A31350E114D89E10046D05E /* ASINSStringAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASINSStringAdditions.m; sourceTree = "<group>"; };
3A33FEE511604626001D78D9 /* BWToolkitFramework.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = BWToolkitFramework.framework; path = /Users/Shared/tohnominagi/InstalledProducts/BWToolkitFramework.framework; sourceTree = "<absolute>"; };
3A33FEEC11604686001D78D9 /* Preferences.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = Preferences.xib; sourceTree = "<group>"; };
+ 3A49BD401162A78E0048007B /* dsa_pub.pem */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = dsa_pub.pem; sourceTree = "<group>"; };
3A4D7E8B115C304B005266C2 /* login.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = login.tiff; sourceTree = "<group>"; };
3A51E9D311600F47005F1027 /* melativeicon.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = melativeicon.tiff; sourceTree = "<group>"; };
3A6DAA51115B066300695124 /* Melative_ExampleAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Melative_ExampleAppDelegate.m; sourceTree = "<group>"; };
@@ -141,6 +143,7 @@
3A2E0EBD114DD93E0050E16D /* BGHUDAppKit.framework */,
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */,
3A004E6D115AF14800906875 /* iTunes.h */,
+ 3A49BD401162A78E0048007B /* dsa_pub.pem */,
);
name = "Linked Frameworks";
sourceTree = "<group>";
@@ -286,6 +289,7 @@
3A4D7E8C115C304B005266C2 /* login.tiff in Resources */,
3A51E9D411600F47005F1027 /* melativeicon.tiff in Resources */,
3A33FEED11604686001D78D9 /* Preferences.xib in Resources */,
+ 3A49BD411162A78E0048007B /* dsa_pub.pem in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
View
4 Melative.h 100644 → 100755
@@ -18,10 +18,12 @@
IBOutlet NSButton * postbutton;
IBOutlet NSPopUpButton * mediatypemenu;
int choice;
- IBOutlet NSProgressIndicator * progress;
+ IBOutlet NSTextField * artist;
}
@property(copy, readwrite) NSString *fieldpassword;
@property(copy, readwrite) NSString *fieldusername;
-(IBAction)postmessage:(id)sender;
-(IBAction)getnowplaying:(id)sender;
+-(IBAction)scrobble:(id)sender;
+-(void)loadlogin;
@end
View
61 Melative.m 100644 → 100755
@@ -169,11 +169,70 @@ -(IBAction)getnowplaying:(id)sender
else if ([mediatypemenu indexOfSelectedItem] == 1) {
// Init iTunes Scripting
iTunesApplication *iTunes = [[SBApplication applicationWithBundleIdentifier:@"com.apple.iTunes"]autorelease];
- //Obtain the Alubm and Track Name and place them in the Media Title and Segment Fields
+ //Obtain the Album, Artist and Track Name and place them in the Media Title and Segment Fields
[mediatitle setObjectValue:iTunes.currentTrack.album];
[segment setObjectValue:iTunes.currentTrack.name];
+ [artist setObjectValue:iTunes.currentTrack.artist];
}
}
+-(IBAction)scrobble:(id)sender
+{
+ //Scrobble the Title
+ NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
+ if (fieldusername == nil || fieldusername !=[defaults objectForKey:@"Username"]) {
+ //Load Login
+ NSLog(@"Loading Login");
+ [self loadlogin];
+ }
+ if ( fieldpassword == nil ) {
+ //No account information. Show error message.
+ choice = NSRunCriticalAlertPanel(@"MelScrobbleX was unable to scrobble since you didn't set any account information", @"Set your account information in Preferences and try again.", @"OK", nil, nil, 8);
+ }
+ else {
+ if ( [[segment stringValue] length] == 0 || [[mediatitle stringValue]length] == 0 ) {
+ //No segment or title
+ choice = NSRunCriticalAlertPanel(@"MelScrobbleX was unable to scrobble since you didn't enter a title or segment info.", @"Enter a media title or segment and try the scrobble command again", @"OK", nil, nil, 8);
+
+ }
+ else {
+ //Set library/scrobble API
+ NSURL *url = [NSURL URLWithString:@"http://melative.com/api/library/scrobble.json"];
+ ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
+ //Ignore Cookies
+ [request setUseCookiePersistence:NO];
+ //Set Username
+ [request setUsername:fieldusername];
+ [request setPassword:fieldpassword];
+ if ( [mediatypemenu indexOfSelectedItem] == 0) {
+ [request setPostValue:[mediatitle stringValue] forKey:@"anime"];
+ [request setPostValue:@"episode" forKey:@"atribute_type"];
+ [request setPostValue:[segment stringValue] forKey:@"atribute_name"];
+ }
+ else if ([mediatypemenu indexOfSelectedItem] == 1) {
+ [request setPostValue:[mediatitle stringValue] forKey:@"music"];
+ [request setPostValue:@"track" forKey:@"atribute_type"];
+ [request setPostValue:[segment stringValue] forKey:@"segment"];
+ }
+ [request startSynchronous];
+ // Get Status Code
+ int statusCode = [request responseStatusCode];
+ if (statusCode == 200 ) {
+ NSString *response = [request responseString];
+ //Post suggessful... or is it?
+ choice = NSRunAlertPanel(@"Scrobble Successful", response, @"OK", nil, nil, 8);
+ //release
+ response = nil;
+ }
+ else {
+ //Login Failed, show error message
+ choice = NSRunCriticalAlertPanel(@"MelScrobbleX was unable to scrobble since you don't have the correct username and/or password", @"Check your username and password and try the scrobble command again. If you recently changed your password, ener you new password and try again.", @"OK", nil, nil, 8);
+ }
+ //release
+ request = nil;
+ url = nil;
+ }
+}
+}
-(void)loadlogin
{
// Load Username
View
4 Melative_Example-Info.plist 100644 → 100755
@@ -25,11 +25,11 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleShortVersionString</key>
- <string>0.1a</string>
+ <string>0.2a</string>
<key>LSMinimumSystemVersion</key>
<string>${MACOSX_DEPLOYMENT_TARGET}</string>
<key>CFBundleVersion</key>
- <string>0.1a</string>
+ <string>0.2a</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSHumanReadableCopyright</key>
View
@@ -0,0 +1,20 @@
+-----BEGIN PUBLIC KEY-----
+MIIDOzCCAi0GByqGSM44BAEwggIgAoIBAQCQpIUwjkGVrz01zLl8MiSbb1Pwn67p
+mcT6ZUX4ygrTDxAEyuRgWXDmderxzODabtvkfdm8NSk0014J9ao4e6zK8a6EhXAP
+P+g97bYZOBZmXzRxQ2SNmg9VBiVxAKrq4b/2gnVqwmDuuruT9joreThTRCA9IhGi
+X2e04l4GzAirw0yeDciF3ys1ZTaCATd+5XRCEgT1lk3zyjust8cxFKzqtLfmNlhx
+VBr2Lp7y+l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