Latest 1.0
Homepage https://github.com/elliotchance/GoogleMusicClient
License MIT
Platforms osx 10.8, requires ARC
Dependencies CollectionFactory, NSURL+QueryDictionary, MBHMAC
Authors

Build Status

This is an implementation of the Unofficial Google Music API written in Objective-C.

Usage

Use it with CocoaPods:

pod 'GoogleMusicClient'

Then include it in your source code:

#import <GoogleMusicClient.h>

Basic Client

Login

GoogleMusicClient *client = [GoogleMusicClient new];
[client loginWithEmail:@"[email protected]" password:@"foobar" delegate:self];

The delegate is an asynchronous id<GoogleMusicClientDelegate> which will return one of the following callbacks:

  • - loginDidSucceed
  • - loginDidFail
  • - doesNotHaveInternet

The protocol that wraps the client provides - (BOOL)isLoggedIn so you can check the connection status at any time.

Profile Settings

The client provides the following settings, these are synchronous but are cached until the next time you connect:

  • - (NSDictionary *)profileSettings – get all profile settings as a dictionary.
  • - (BOOL)desktopNotications – has the client enabled desktop notifcations.
  • - (BOOL)useHTML5Audio – does the client wish to use HTML5 audio instead of Adobe Flash.
  • - (BOOL)use5StarRatings – does the client want to use the "5 star rating" system over the thumbs up/down.
  • - (BOOL)viewTrackComments – does the client which to show track comments.
  • - (BOOL)chromecastFireplaceVisualizer – does the client with use the visualiser on chromecast.

Account Settings

Various status flags are available – most of them are pretty self-explanitory:

  • - (BOOL)accountIsCanceled
  • - (BOOL)accountIsSubscription
  • - (BOOL)accountIsTrial
  • - (BOOL)accountIsSubscribedToNewsletter
  • - (NSInteger)accountMaximumAllowedTracks – this should be 20,000 for normal paid accounts.
  • - (NSDate *)accountExpireTime

Media Library

Fetch All Tracks

You may fetch the entire library asynchronously with:

- (void)fetchAllTracksWithDelegate:(id<GoogleMusicLibraryParserDelegate>)delegate

delegate will callback with:

- (void)didFinishReceivingTracks:(NSArray *)tracks

tracks will contain an array of Track objects.

Track

The following meta data is available:

  • - (NSString *)album
  • - (NSString *)albumArtUrl
  • - (NSString *)albumArtist
  • - (NSString *)artist
  • - (NSUInteger)bitRate
  • - (NSString *)composer
  • - (NSString *)comment
  • - (NSDate *)creationDate
  • - (NSUInteger)discNumber
  • - (NSUInteger)discTotal
  • - (NSTimeInterval)duration
  • - (NSString *)genre
  • - (NSString *)largeAlbumArtUrl
  • - (NSDate *)lastPlayedDate
  • - (NSString *)matchedId
  • - (NSDate *)modificationDate
  • - (NSArray *)origin
  • - (NSUInteger)playCount
  • - (NSUInteger)rating
  • - (NSString *)storeId
  • - (NSString *)trackId
  • - (NSString *)title
  • - (NSUInteger)trackNumber
  • - (NSUInteger)trackTotal
  • - (enum TrackType)type
  • - (NSUInteger)year

Getting the Track Stream URL

- (NSURL *)streamUrl is provided on the Track class that will make a synchronous call (the stream URL is not provided with the track, it must be fetched afterwards) to get the stream URL. This URL can be used with any media player that understands streaming MP3.

Latest podspec

{
    "name": "GoogleMusicClient",
    "version": "1.0",
    "summary": "Google Music client",
    "homepage": "https://github.com/elliotchance/GoogleMusicClient",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Elliot Chance": "[email protected]"
    },
    "source": {
        "git": "https://github.com/elliotchance/GoogleMusicClient.git",
        "tag": "v1.0"
    },
    "source_files": "GoogleMusicClient/*.{h,m}",
    "requires_arc": true,
    "platforms": {
        "osx": "10.8"
    },
    "dependencies": {
        "CollectionFactory": [],
        "NSURL+QueryDictionary": [],
        "MBHMAC": []
    }
}

Pin It on Pinterest

Share This