Coder Social home page Coder Social logo

lastfm's Introduction

LastFm - block based Last.fm SDK for iOS and Mac OS X

Badge w/ Version Badge w/ Platform

Loosely based on LastFMService from the old Last.fm iPhone app, but non-blocking, more readable, much easier to use (and to extend) and with less dependencies.

Features

  • Block based for easier usage
  • Only one dependency (KissXML)
  • Returns values in the correct data type (NSDate, NSURL, NSNumber, etc)
  • Hook in your own caching methods (GVCache, NSCache, Core Data, SYCache, EGOCache, ...)
  • Cancelable operations, perfect for when cells are scrolled off screen and you don't need to make the API calls after all
  • Actively developed and maintained (it's used in the official Last.fm Scrobbler app!)

Usage

// Set the Last.fm session info
[LastFm sharedInstance].apiKey = @"xxx";
[LastFm sharedInstance].apiSecret = @"xxx";
[LastFm sharedInstance].session = session;
[LastFm sharedInstance].username = username;

// Get artist info
[[LastFm sharedInstance] getInfoForArtist:@"Pink Floyd" successHandler:^(NSDictionary *result) {
    NSLog(@"result: %@", result);
} failureHandler:^(NSError *error) {
    NSLog(@"error: %@", error);
}];

// Scrobble a track
[[LastFm sharedInstance] sendScrobbledTrack:@"Wish You Were Here" byArtist:@"Pink Floyd" onAlbum:@"Wish You Were Here" withDuration:534 atTimestamp:(int)[[NSDate date] timeIntervalSince1970] successHandler:^(NSDictionary *result) {
    NSLog(@"result: %@", result);
} failureHandler:^(NSError *error) {
    NSLog(@"error: %@", error);
}];

Save the username and session you get with getSessionForUser:password:successHandler:failureHandler: somewhere, for example in NSUserDefaults, and on app start up set it back on [LastFm sharedInstance].username and [LastFm sharedInstance].session.

See the included iOS project for examples on login, logout, getting artist info and more.

Example app

There's an extensive example app available which handles login, logout, getting lots of artists in a tableview and showing their details, caching, canceling API calls, and much more.

To install the example app, you need to use CocoaPods: pod install. You can also try it by running pod try LastFm.

The example app only works in iOS 5 and higher due to the usage of storyboards. The SDK itself works in iOS 4 and higher.

Installation

You can install LastFm with CocoaPods. Just add the following line to your Podfile, and run pod install:

pod 'LastFm'

You can also simply clone the repository and drag the LastFm subfolder into your Xcode project. Be sure to install KissXML yourself.

Requirements

  • LastFm is built using ARC and modern Objective-C syntax. You will need iOS 4 and Xcode 4.4 or higher to use it in your project.
  • You will need your own API key by registering at http://www.last.fm/api.
  • KissXML

Issues and questions

Have a bug? Please create an issue on GitHub!

Apps using LastFm

Are you using LastFm in your iOS or Mac OS X app? Send a pull request with an updated README.md file to be included.

Test the LastFM API on RapidAPI.

License

LastFm is available under the MIT license. See the LICENSE file for more info.

lastfm's People

Contributors

atlithorn avatar chrismou avatar darvin avatar eightytwo avatar kevinrenskers avatar stephanebruckert avatar username0x0a avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lastfm's Issues

AFNetworking?

Hi

Any plans on using AFNetworking for the underlying communications? Has this been discussed before? If yes, what were the reasons not to use AFNetworking?

(I'm thinking about adding it myself, and I wanna find out if it would be appreciated.)

Cheers
Simon

Example Project horked?

Hi - I've been trying to work through issues with the Example project to get it to work -but it's seems to be suffering from problems from an include file not being properly included in one file, to KissXML podspec version in the podspec that doesn't work right, to Swift code that can't run in XCode 9. Also, podfile doesn't use frameworks.... Still can't get it to run even after getting through most of these (stuck on the Swift problem).

would love to see the Example in action. Thanks!

Authentication Failed - You do not have permissions to access the service

I just tried the demo and I get this error:

Error Domain=LastFmServiceErrorDomain Code=4 "Authentication Failed - You do not have permissions to access the service" UserInfo={NSLocalizedDescription=Authentication Failed - You do not have permissions to access the service, method=auth.getMobileSession}

What am I doing wrong?

Add Xcode project / workspace

In order to consume this with Carthage a shared scheme is needed. That in turn requires the project (or workspace file) to be included in the git repository.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.