Permalink
Browse files

Added getNewReleasesForUserBasedOnRecommendations and getBuyLinksForA…

…lbum
  • Loading branch information...
1 parent 305891f commit 6a40e474bab191f95594241f8e9a901fd0bf46ed @kevinrenskers kevinrenskers committed Sep 26, 2012
Showing with 70 additions and 2 deletions.
  1. +6 −1 AUTHORS
  2. +13 −0 CHANGELOG
  3. +8 −0 Example.xcodeproj/project.pbxproj
  4. +1 −1 LICENSE
  5. +2 −0 LastFm/LastFm.h
  6. +40 −0 LastFm/LastFm.m
View
@@ -1 +1,6 @@
-Kevin Renskers - https://github.com/kevinrenskers https://twitter.com/mixedcase
+PRIMARY AUTHORS
+Kevin Renskers - https://github.com/kevinrenskers
+
+CONTRIBUTORS
+Atli Thorbjornsson - https://github.com/atlithorn
+Piers Biddlestone - https://github.com/eightytwo
View
@@ -0,0 +1,13 @@
+0.3.0 - September 26
+- Feature: added getNewReleasesForUserBasedOnRecommendations and getBuyLinksForAlbum
+- Feature: added a changelog
+
+0.2.1 - September 21
+- Bugfix: having no successHandler should never crash the code
+
+0.2.0 - September 21
+- Feature: added a bunch of track methods: loveTrack, unloveTrack, banTrack, unbanTrack, getBuyLinksForTrack
+- Bugfix: passing in nil instead of a string argument won't result in a crash
+
+0.0.1 - September 17
+- First public release on CocoaPods.
@@ -22,6 +22,8 @@
0A49B90C15E267E0006ED696 /* DDXMLElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 0A49B90415E267E0006ED696 /* DDXMLElement.m */; };
0A49B90D15E267E0006ED696 /* DDXMLNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 0A49B90615E267E0006ED696 /* DDXMLNode.m */; };
0ABB9D18160766D200503C5B /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = 0ABB9D17160766D200503C5B /* README.md */; };
+ 0AC05DA91613089000D49E39 /* AUTHORS in Resources */ = {isa = PBXBuildFile; fileRef = 0AC05DA71613089000D49E39 /* AUTHORS */; };
+ 0AC05DAA1613089000D49E39 /* CHANGELOG in Resources */ = {isa = PBXBuildFile; fileRef = 0AC05DA81613089000D49E39 /* CHANGELOG */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@@ -53,6 +55,8 @@
0A49B90615E267E0006ED696 /* DDXMLNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DDXMLNode.m; sourceTree = "<group>"; };
0A49B90815E267E0006ED696 /* DDXMLPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DDXMLPrivate.h; sourceTree = "<group>"; };
0ABB9D17160766D200503C5B /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.md; sourceTree = "<group>"; };
+ 0AC05DA71613089000D49E39 /* AUTHORS */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = AUTHORS; sourceTree = "<group>"; };
+ 0AC05DA81613089000D49E39 /* CHANGELOG */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CHANGELOG; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -76,6 +80,8 @@
0A49B8CE15E26300006ED696 /* Frameworks */,
0A49B8CC15E26300006ED696 /* Products */,
0ABB9D17160766D200503C5B /* README.md */,
+ 0AC05DA71613089000D49E39 /* AUTHORS */,
+ 0AC05DA81613089000D49E39 /* CHANGELOG */,
);
sourceTree = "<group>";
};
@@ -229,6 +235,8 @@
0A49B8DA15E26300006ED696 /* InfoPlist.strings in Resources */,
0A49B8E315E26300006ED696 /* MainStoryboard.storyboard in Resources */,
0ABB9D18160766D200503C5B /* README.md in Resources */,
+ 0AC05DA91613089000D49E39 /* AUTHORS in Resources */,
+ 0AC05DAA1613089000D49E39 /* CHANGELOG in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
View
@@ -1,4 +1,4 @@
-Copyright (c) 2012 Kevin Renskers (http://mixedcase.nl/)
+Copyright (c) 2012 Gangverk ehf. http://gangverk.is
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
View
@@ -63,6 +63,7 @@ typedef void (^LastFmReturnBlockWithError)(NSError *error);
- (void)getInfoForAlbum:(NSString *)album artist:(NSString *)artist successHandler:(LastFmReturnBlockWithDictionary)successHandler failureHandler:(LastFmReturnBlockWithError)failureHandler;
- (void)getTracksForAlbum:(NSString *)album artist:(NSString *)artist successHandler:(LastFmReturnBlockWithArray)successHandler failureHandler:(LastFmReturnBlockWithError)failureHandler;
+- (void)getBuyLinksForAlbum:(NSString *)album artist:(NSString *)artist country:(NSString *)country successHandler:(LastFmReturnBlockWithArray)successHandler failureHandler:(LastFmReturnBlockWithError)failureHandler;
#pragma mark Track methods
@@ -81,6 +82,7 @@ typedef void (^LastFmReturnBlockWithError)(NSError *error);
- (void)getInfoForUserOrNil:(NSString *)username successHandler:(LastFmReturnBlockWithDictionary)successHandler failureHandler:(LastFmReturnBlockWithError)failureHandler;
- (void)sendNowPlayingTrack:(NSString *)track byArtist:(NSString *)artist onAlbum:(NSString *)album withDuration:(NSTimeInterval)duration successHandler:(LastFmReturnBlockWithDictionary)successHandler failureHandler:(LastFmReturnBlockWithError)failureHandler;
- (void)sendScrobbledTrack:(NSString *)track byArtist:(NSString *)artist onAlbum:(NSString *)album withDuration:(NSTimeInterval)duration atTimestamp:(NSTimeInterval)timestamp successHandler:(LastFmReturnBlockWithDictionary)successHandler failureHandler:(LastFmReturnBlockWithError)failureHandler;
+- (void)getNewReleasesForUserBasedOnRecommendations:(BOOL)basedOnRecommendations successHandler:(LastFmReturnBlockWithArray)successHandler failureHandler:(LastFmReturnBlockWithError)failureHandler;
#pragma mark Chart methods
View
@@ -425,6 +425,24 @@ - (void)getTracksForAlbum:(NSString *)album artist:(NSString *)artist successHan
failureHandler:failureHandler];
}
+- (void)getBuyLinksForAlbum:(NSString *)album artist:(NSString *)artist country:(NSString *)country successHandler:(LastFmReturnBlockWithArray)successHandler failureHandler:(LastFmReturnBlockWithError)failureHandler {
+ NSDictionary *mappingObject = @{
+ @"url": @[ @"./buyLink", @"NSURL" ],
+ @"price": @[ @"./price/amount", @"NSNumber" ],
+ @"currency": @[ @"./price/currency", @"NSString" ],
+ @"name": @[ @"./supplierName", @"NSString" ],
+ @"icon": @[ @"./supplierIcon", @"NSURL" ]
+ };
+
+ [self performApiCallForMethod:@"album.getBuylinks"
+ withParams:@{ @"artist": [self forceString:artist], @"album": [self forceString:album], @"country": [self forceString:country] }
+ rootXpath:@"./affiliations/downloads/affiliation"
+ returnDictionary:NO
+ mappingObject:mappingObject
+ successHandler:successHandler
+ failureHandler:failureHandler];
+}
+
#pragma mark Track methods
- (void)getInfoForTrack:(NSString *)title artist:(NSString *)artist successHandler:(LastFmReturnBlockWithDictionary)successHandler failureHandler:(LastFmReturnBlockWithError)failureHandler {
@@ -637,6 +655,28 @@ - (void)sendScrobbledTrack:(NSString *)track byArtist:(NSString *)artist onAlbum
failureHandler:failureHandler];
}
+- (void)getNewReleasesForUserBasedOnRecommendations:(BOOL)basedOnRecommendations successHandler:(LastFmReturnBlockWithArray)successHandler failureHandler:(LastFmReturnBlockWithError)failureHandler {
+ NSDictionary *mappingObject = @{
+ @"name": @[ @"./name", @"NSString" ],
+ @"artist": @[ @"./artist/name", @"NSString" ],
+ @"image": @[ @"./image[@size=\"large\"]", @"NSURL" ],
+ @"releasedate": @[ @"@releasedate", @"NSString" ]
+ };
+
+ NSDictionary *params = @{
+ @"user": [self forceString:[self username]],
+ @"userec": @(basedOnRecommendations)
+ };
+
+ [self performApiCallForMethod:@"user.getNewReleases"
+ withParams:params
+ rootXpath:@"./albums/album"
+ returnDictionary:NO
+ mappingObject:mappingObject
+ successHandler:successHandler
+ failureHandler:failureHandler];
+}
+
#pragma mark Chart methods
- (void)getTopTracksWithLimit:(NSInteger)limit page:(NSInteger)page successHandler:(LastFmReturnBlockWithArray)successHandler failureHandler:(LastFmReturnBlockWithError)failureHandler {

0 comments on commit 6a40e47

Please sign in to comment.