Permalink
Browse files

- Added tracking of what's currently playing in Spotify (code from Sp…

…otifyScrobbler)

- Hooked up Love/Ban GUI to the relevant Last.fm methods with the current track information

As of this commit, the Love and Ban buttons are fully functional although error responses from Last.fm (particularly HTTP errors) currently crash Spotify
  • Loading branch information...
1 parent e63dbaa commit cfc5ef6ba857afb9d07862a97335d662bfa3f0c3 @georgebrock committed Jan 17, 2009
@@ -15,6 +15,7 @@
C6D68BFA0F21418D000CB3C6 /* lastfm_black.png in Resources */ = {isa = PBXBuildFile; fileRef = C6D68BF90F21418D000CB3C6 /* lastfm_black.png */; };
C6D68C060F214DAA000CB3C6 /* LastifyLastfmClient.m in Sources */ = {isa = PBXBuildFile; fileRef = C6D68C050F214DAA000CB3C6 /* LastifyLastfmClient.m */; };
C6D68C9A0F21EF55000CB3C6 /* NSString+Lastify.m in Sources */ = {isa = PBXBuildFile; fileRef = C6D68C990F21EF55000CB3C6 /* NSString+Lastify.m */; };
+ C6D68CF90F21FE2C000CB3C6 /* SPGrowlDelegate+Lastify.m in Sources */ = {isa = PBXBuildFile; fileRef = C6D68CF80F21FE2C000CB3C6 /* SPGrowlDelegate+Lastify.m */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@@ -36,6 +37,10 @@
C6D68C050F214DAA000CB3C6 /* LastifyLastfmClient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LastifyLastfmClient.m; sourceTree = "<group>"; };
C6D68C980F21EF55000CB3C6 /* NSString+Lastify.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+Lastify.h"; sourceTree = "<group>"; };
C6D68C990F21EF55000CB3C6 /* NSString+Lastify.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+Lastify.m"; sourceTree = "<group>"; };
+ C6D68CF60F21FE13000CB3C6 /* SPGrowlDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SPGrowlDelegate.h; path = "class-dump-headers/SPGrowlDelegate.h"; sourceTree = "<group>"; };
+ C6D68CF70F21FE2C000CB3C6 /* SPGrowlDelegate+Lastify.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "SPGrowlDelegate+Lastify.h"; sourceTree = "<group>"; };
+ C6D68CF80F21FE2C000CB3C6 /* SPGrowlDelegate+Lastify.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "SPGrowlDelegate+Lastify.m"; sourceTree = "<group>"; };
+ C6D68D000F21FFBB000CB3C6 /* SPTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPTypes.h; sourceTree = "<group>"; };
D2F7E65807B2D6F200F64583 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; };
/* End PBXFileReference section */
@@ -88,6 +93,10 @@
children = (
C6D68C980F21EF55000CB3C6 /* NSString+Lastify.h */,
C6D68C990F21EF55000CB3C6 /* NSString+Lastify.m */,
+ C6D68D000F21FFBB000CB3C6 /* SPTypes.h */,
+ C6D68CF60F21FE13000CB3C6 /* SPGrowlDelegate.h */,
+ C6D68CF70F21FE2C000CB3C6 /* SPGrowlDelegate+Lastify.h */,
+ C6D68CF80F21FE2C000CB3C6 /* SPGrowlDelegate+Lastify.m */,
C6D68B9A0F213660000CB3C6 /* SPController.h */,
C6D68B9C0F2136BE000CB3C6 /* SPController+Lastify.h */,
C6D68B9D0F2136BE000CB3C6 /* SPController+Lastify.m */,
@@ -193,6 +202,7 @@
C6D68B9E0F2136BE000CB3C6 /* SPController+Lastify.m in Sources */,
C6D68C060F214DAA000CB3C6 /* LastifyLastfmClient.m in Sources */,
C6D68C9A0F21EF55000CB3C6 /* NSString+Lastify.m in Sources */,
+ C6D68CF90F21FE2C000CB3C6 /* SPGrowlDelegate+Lastify.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
View
@@ -14,9 +14,14 @@
{
IBOutlet NSDrawer *drawer;
LastifyLastfmClient *lastfm;
+
+ NSString *currentTrack;
+ NSString *currentArtist;
}
@property(readonly, retain) LastifyLastfmClient *lastfm;
+@property(readwrite, retain) NSString *currentTrack;
+@property(readwrite, retain) NSString *currentArtist;
+ (BOOL)renameSelector:(SEL)originalSelector toSelector:(SEL)newSelector onClass:(Class)class;
+ (LastifyController*)sharedInstance;
View
@@ -10,14 +10,19 @@
#import "LastifyController.h"
#import "SPController.h"
#import "SPController+Lastify.h"
+#import "SPGrowlDelegate+Lastify.h"
@implementation LastifyController
-@synthesize lastfm;
+@synthesize
+ lastfm,
+ currentTrack,
+ currentArtist;
+ (void)load
{
[SPController initLastify];
+ [SPGrowlDelegate initLastify];
[[LastifyController sharedInstance] initLastfmConnection];
}
@@ -46,6 +51,8 @@ + (BOOL)renameSelector:(SEL)originalSelector toSelector:(SEL)newSelector onClass
- (void)dealloc
{
[lastfm release], lastfm = nil;
+ [currentTrack release], currentTrack = nil;
+ [currentArtist release], currentArtist = nil;
[super dealloc];
}
@@ -76,13 +83,18 @@ - (IBAction)authComplete:(id)sender
- (IBAction)loveTrack:(id)sender
{
- NSLog(@"***** LASTIFY: Love track");
- //[lastfm loveTrack:@"Bright Idea" byArtist:@"Orson"];
+ if(!currentTrack || !currentArtist)
+ return;
+
+ [lastfm loveTrack:currentTrack byArtist:currentArtist];
}
- (IBAction)banTrack:(id)sender
{
- NSLog(@"***** LASTIFY: Ban track");
+ if(!currentTrack || !currentArtist)
+ return;
+
+ [lastfm banTrack:currentTrack byArtist:currentArtist];
}
- (BOOL)drawerShouldClose:(NSDrawer *)sender
Oops, something went wrong.

0 comments on commit cfc5ef6

Please sign in to comment.