class Grooveshark
Attributes
session[R]
Public Class Methods
new(key, secret)
click to toggle source
# File lib/grooveshark-ruby/new.rb, line 5 def initialize(key, secret) @key = key @secret = secret @session = startSession # @ipaddress = request.remote_ip end
Public Instance Methods
addSongToAutoplay(song, autoplayState)
click to toggle source
# File lib/grooveshark-ruby/autoplay.rb, line 27 def addSongToAutoplay(song, autoplayState) request('addSongToAutoplay', {'song' => song, 'autoplayState' => autoplayState}) end
addUserFavoriteSong(songID)
click to toggle source
# File lib/grooveshark-ruby/core.rb, line 43 def addUserFavoriteSong(songID) request('addUserFavoriteSong', {'songID' => songID}) end
addUserLibrarySongs(songIDs, albumIDs, artistIDs)
click to toggle source
# File lib/grooveshark-ruby/core.rb, line 3 def addUserLibrarySongs(songIDs, albumIDs, artistIDs) request('addUserLibrarySongs', {'songIDs' => songIDs, 'albumIDs' => albumIDs, 'artistIDs' => artistIDs}) end
authenticate(login, password)
click to toggle source
# File lib/grooveshark-ruby/core.rb, line 151 def authenticate(login, password) password = Digest::MD5.hexdigest(password) user = request('authenticate', {'login' => login, 'password' => password}, true)['result'] end
authenticateToken(token)
click to toggle source
# File lib/grooveshark-ruby/core.rb, line 160 def authenticateToken(token) request('authenticateToken', {'token' => token}, true)['result'] end
authenticateUser(username, token)
click to toggle source
# File lib/grooveshark-ruby/core.rb, line 156 def authenticateUser(username, token) request('authenticateUser', {'username' => username, 'token' => token}, true)['result'] end
createPlaylist(name, songIDs)
click to toggle source
# File lib/grooveshark-ruby/core.rb, line 83 def createPlaylist(name, songIDs) request('createPlaylist', {'name' => name, 'songIDs' => songIDs}) end
createTrial(uniqueID)
click to toggle source
# File lib/grooveshark-ruby/trials.rb, line 7 def createTrial(uniqueID) request('createTrial', {'uniqueID' => uniqueID}) end
deletePlaylist(playlistID)
click to toggle source
# File lib/grooveshark-ruby/core.rb, line 91 def deletePlaylist(playlistID) request('deletePlaylist', {'playlistID' => playlistID}) end
getAlbumSearchResults(query, limit = false, offset = false)
click to toggle source
# File lib/grooveshark-ruby/search.rb, line 11 def getAlbumSearchResults(query, limit = false, offset = false) request('getAlbumSearchResults', { 'query' => query, 'limit' => limit, 'offset' => offset })['result']['albums'] end
getAlbumSongs(albumID, limit = nil)
click to toggle source
# File lib/grooveshark-ruby/core.rb, line 115 def getAlbumSongs(albumID, limit = nil) request('getAlbumSongs', {'albumID' => albumID, 'limit' => limit})['result']['songs'] end
getAlbumsInfo(albumIDs)
click to toggle source
# File lib/grooveshark-ruby/core.rb, line 111 def getAlbumsInfo(albumIDs) request('getAlbumsInfo', {'albumIDs' => albumIDs})['result']['albums'] end
getArtistAlbums(artistID)
click to toggle source
# File lib/grooveshark-ruby/core.rb, line 147 def getArtistAlbums(artistID) request('getArtistAlbums', {'artistID' => artistID})['result']['albums'] end
getArtistPopularSongs(artistID)
click to toggle source
# File lib/grooveshark-ruby/core.rb, line 143 def getArtistPopularSongs(artistID) request('getArtistPopularSongs', {'artistID' => artistID})['result']['songs'] end
getArtistSearchResults(query, limit = false, offset = false)
click to toggle source
# File lib/grooveshark-ruby/search.rb, line 15 def getArtistSearchResults(query, limit = false, offset = false) request('getArtistSearchResults', { 'query' => query, 'limit' => limit, 'offset' => offset })['result']['artists'] end
getArtistVerifiedAlbums(artistID)
click to toggle source
# File lib/grooveshark-ruby/core.rb, line 139 def getArtistVerifiedAlbums(artistID) request('getArtistVerifiedAlbums', {'artistID' => artistID})['result']['albums'] end
getArtistsInfo(artistIDs)
click to toggle source
# File lib/grooveshark-ruby/core.rb, line 119 def getArtistsInfo(artistIDs) request('getArtistsInfo', {'artistIDs' => artistIDs})['result']['artists'] end
getAutocompleteSearchResults(query, type, limit = false)
click to toggle source
# File lib/grooveshark-ruby/autocomplete.rb, line 3 def getAutocompleteSearchResults(query, type, limit = false) request('getAutocompleteSearchResults', {'query' => query, 'type' => type, 'limit' => limit}) end
getAutoplaySong(autoplayState)
click to toggle source
# File lib/grooveshark-ruby/autoplay.rb, line 3 def getAutoplaySong(autoplayState) request('getAutoplaySong', {'autoplayState' => autoplayState}) end
getAutoplayTags()
click to toggle source
# File lib/grooveshark-ruby/autoplay.rb, line 7 def getAutoplayTags request('getAutoplayTags') end
getCountry(ip = nil)
click to toggle source
# File lib/grooveshark-ruby/core.rb, line 59 def getCountry(ip = nil) request('getCountry', {'ip' => ip})['result'] end
getDoesAlbumExist(albumID)
click to toggle source
# File lib/grooveshark-ruby/core.rb, line 127 def getDoesAlbumExist(albumID) request('getDoesAlbumExist', {'albumID' => albumID})['result'] end
getDoesArtistExist(artistID)
click to toggle source
# File lib/grooveshark-ruby/core.rb, line 135 def getDoesArtistExist(artistID) request('getDoesArtistExist', {'artistID' => artistID})['result'] end
getDoesSongExist(songID)
click to toggle source
# File lib/grooveshark-ruby/core.rb, line 131 def getDoesSongExist(songID) request('getDoesSongExist', {'songID' => songID})['result'] end
getPlaylist(playlistID, limit = nil)
click to toggle source
# File lib/grooveshark-ruby/core.rb, line 51 def getPlaylist(playlistID, limit = nil) request('getPlaylist', {'playlistID' => playlistID, 'limit' => limit})['result'] end
getPlaylistInfo(playlistID)
click to toggle source
# File lib/grooveshark-ruby/core.rb, line 75 def getPlaylistInfo(playlistID) request('getPlaylistInfo', {'playlistID' => playlistID})['result'] end
getPlaylistSearchResults(query, limit = false, offset = false)
click to toggle source
# File lib/grooveshark-ruby/search.rb, line 7 def getPlaylistSearchResults(query, limit = false, offset = false) request('getPlaylistSearchResults', { 'query' => query, 'limit' => limit, 'offset' => offset })['result']['playlists'] end
getPlaylistSongs(playlistID, limit = nil)
click to toggle source
# File lib/grooveshark-ruby/core.rb, line 99 def getPlaylistSongs(playlistID, limit = nil) request('getPlaylistSongs', {'playlistID' => playlistID, 'limit' => limit}) end
getPlaylistURLFromPlaylistID(playlistID)
click to toggle source
# File lib/grooveshark-ruby/urls.rb, line 11 def getPlaylistURLFromPlaylistID(playlistID) request('getPlaylistURLFromPlaylistID', {'playlistID' => playlistID})['result']['url'] end
getPopularSongsMonth(limit = nil)
click to toggle source
# File lib/grooveshark-ruby/core.rb, line 63 def getPopularSongsMonth(limit = nil) request('getPopularSongsMonth', {'limit' => limit})['result']['songs'] end
getPopularSongsToday(limit = nil)
click to toggle source
# File lib/grooveshark-ruby/core.rb, line 55 def getPopularSongsToday(limit = nil) request('getPopularSongsToday', {'limit' => limit})['result']['songs'] end
getServiceDescription()
click to toggle source
# File lib/grooveshark-ruby/core.rb, line 67 def getServiceDescription request('getServiceDescription')['result'] end
getSimilarArtists(artistID, limit = nil, page = nil)
click to toggle source
# File lib/grooveshark-ruby/recs.rb, line 3 def getSimilarArtists(artistID, limit = nil, page = nil) request('getSimilarArtists', {'artistID' => artistID, 'limit' => limit, 'page' => page}) end
getSongIDFromTinysongBase62(base62)
click to toggle source
# File lib/grooveshark-ruby/tinysong.rb, line 3 def getSongIDFromTinysongBase62(base62) request('getSongIDFromTinysongBase62', {'base62' => base62}) end
getSongSearchResults(query, country, limit = nil, offset = nil)
click to toggle source
# File lib/grooveshark-ruby/search.rb, line 3 def getSongSearchResults(query, country, limit = nil, offset = nil) request('getSongSearchResults', { 'query' => query, 'country' => country, 'limit' => limit, 'offset' => offset })['result']['songs'] end
getSongURLFromSongID(songID)
click to toggle source
# File lib/grooveshark-ruby/urls.rb, line 7 def getSongURLFromSongID(songID) request('getSongURLFromSongID', {'songID' => songID})['result']['url'] end
getSongURLFromTinysongBase62(base62)
click to toggle source
# File lib/grooveshark-ruby/urls.rb, line 3 def getSongURLFromTinysongBase62(base62) request('getSongURLFromTinysongBase62', {'base62' => base62})['result']['url'] end
getSongsInfo(songIDs)
click to toggle source
# File lib/grooveshark-ruby/core.rb, line 123 def getSongsInfo(songIDs) request('getSongsInfo', {'songIDs' => songIDs})['result']['songs'] end
getSubscriberStreamKey(songID, country, lowBitrate = nil, uniqueID = nil)
click to toggle source
# File lib/grooveshark-ruby/subscriberstreams.rb, line 3 def getSubscriberStreamKey(songID, country, lowBitrate = nil, uniqueID = nil) request('getSubscriberStreamKey', {'songID' => songID, 'country' => country, 'lowBitrate' => lowBitrate, 'uniqueID' => uniqueID}) end
getTinysongURLFromSongID(songID)
click to toggle source
# File lib/grooveshark-ruby/urls.rb, line 15 def getTinysongURLFromSongID(songID) request('getTinysongURLFromSongID', {'songID' => songID})['result']['url'] end
getTrialInfo(uniqueID)
click to toggle source
# File lib/grooveshark-ruby/trials.rb, line 3 def getTrialInfo(uniqueID) request('getTrialInfo', {'uniqueID' => uniqueID}) end
getUserFavoriteSongs(limit = nil)
click to toggle source
# File lib/grooveshark-ruby/core.rb, line 27 def getUserFavoriteSongs(limit = nil) request('getUserFavoriteSongs', {'limit' => limit})['result']['songs'] end
getUserIDFromUsername(username)
click to toggle source
# File lib/grooveshark-ruby/core.rb, line 107 def getUserIDFromUsername(username) request('getUserIDFromUsername', {'username' => username}) end
getUserInfo()
click to toggle source
# File lib/grooveshark-ruby/core.rb, line 35 def getUserInfo request('getUserInfo')['result'] end
getUserInfoFromUserID(userID)
click to toggle source
# File lib/grooveshark-ruby/users.rb, line 7 def getUserInfoFromUserID(userID) request('getUserInfoFromUserID', {'userID' => userID}) end
getUserLibrarySongs(limit = nil, page = nil)
click to toggle source
# File lib/grooveshark-ruby/core.rb, line 7 def getUserLibrarySongs(limit = nil, page = nil) request('getUserLibrarySongs', {'limit' => limit, 'page' => page})['result'] end
getUserPlaylists(limit = nil)
click to toggle source
# File lib/grooveshark-ruby/core.rb, line 15 def getUserPlaylists(limit = nil) request('getUserPlaylists', {'limit' => limit})['result']['playlists'] end
getUserPlaylistsByUserID(userID, limit = nil)
click to toggle source
# File lib/grooveshark-ruby/users.rb, line 3 def getUserPlaylistsByUserID(userID, limit = nil) request('getUserPlaylistsByUserID', {'userID' => userID, 'limit' => limit}) end
getUserPlaylistsSubscribed()
click to toggle source
# File lib/grooveshark-ruby/core.rb, line 23 def getUserPlaylistsSubscribed request('getUserPlaylistsSubscribed')['result']['playlists'] end
getUserSubscriptionDetails()
click to toggle source
# File lib/grooveshark-ruby/core.rb, line 39 def getUserSubscriptionDetails request('getUserSubscriptionDetails')['result'] end
logout()
click to toggle source
# File lib/grooveshark-ruby/core.rb, line 164 def logout request('logout') end
makeToken(username, password)
click to toggle source
# File lib/grooveshark-ruby/core.rb, line 103 def makeToken(username, password) Digest::MD5.hexdigest(username.downcase + Digest::MD5.hexdigest(password)) end
markSongComplete(songID, streamKey, streamServerID, autoplayState = nil)
click to toggle source
# File lib/grooveshark-ruby/subscriberstreams.rb, line 11 def markSongComplete(songID, streamKey, streamServerID, autoplayState = nil) request('markSongComplete', {'songID' => songID, 'streamKey' => streamKey, 'streamServerID' => streamServerID, 'autoplayState' => autoplayState}) end
markStreamKeyOver30Secs(streamKey, streamServerID, uniqueID = nil)
click to toggle source
# File lib/grooveshark-ruby/subscriberstreams.rb, line 7 def markStreamKeyOver30Secs(streamKey, streamServerID, uniqueID = nil) request('markStreamKeyOver30Secs', {'streamKey' => streamKey, 'streamServerID' => streamServerID, 'uniqueID' => uniqueID}) end
pingService()
click to toggle source
# File lib/grooveshark-ruby/core.rb, line 71 def pingService request('pingService')['result'] end
registerUser(emailAddress, password, fullName, username = nil, gender = nil, birthDate = nil)
click to toggle source
# File lib/grooveshark-ruby/register.rb, line 3 def registerUser(emailAddress, password, fullName, username = nil, gender = nil, birthDate = nil) request('registerUser', {'emailAddress' => emailAddress, 'password' => password, 'fullName' => fullName, 'username' => username, 'gender' => gender, 'birthDate' => birthDate}, true) end
removeSongFromAutoplay(song, autoplayState)
click to toggle source
# File lib/grooveshark-ruby/autoplay.rb, line 31 def removeSongFromAutoplay(song, autoplayState) request('removeSongFromAutoplay', {'song' => song, 'autoplayState' => autoplayState}) end
removeUserFavoriteSongs(songIDs)
click to toggle source
# File lib/grooveshark-ruby/core.rb, line 31 def removeUserFavoriteSongs(songIDs) request('removeUserFavoriteSongs', {'songIDs' => songIDs}) end
removeUserLibrarySongs(songIDs, albumIDs, artistIDs)
click to toggle source
# File lib/grooveshark-ruby/core.rb, line 11 def removeUserLibrarySongs(songIDs, albumIDs, artistIDs) request('removeUserLibrarySongs', {'songIDs' => songIDs, 'albumIDs' => albumIDs, 'artistIDs' => artistIDs}) end
removeVoteDownAutoplaySong(song, autoplayState)
click to toggle source
# File lib/grooveshark-ruby/autoplay.rb, line 35 def removeVoteDownAutoplaySong(song, autoplayState) request('removeVoteDownAutoplaySong', {'song' => song, 'autoplayState' => autoplayState}) end
removeVoteUpAutoplaySong(song, autoplayState)
click to toggle source
# File lib/grooveshark-ruby/autoplay.rb, line 19 def removeVoteUpAutoplaySong(song, autoplayState) request('removeVoteUpAutoplaySong', {'song' => song, 'autoplayState' => autoplayState}) end
renamePlaylist(playlistID, name)
click to toggle source
# File lib/grooveshark-ruby/core.rb, line 87 def renamePlaylist(playlistID, name) request('renamePlaylist', {'playlistID' => playlistID, 'name' => name}) end
request(method, params = {}, secure = false, session = @session)
click to toggle source
# File lib/grooveshark-ruby/request.rb, line 3 def request(method, params = {}, secure = false, session = @session) data = { "method" => method, "parameters" => params, "header" => { "wsKey" => @key, "sessionID" => session } }.to_json sig = OpenSSL::HMAC.hexdigest(OpenSSL::Digest::MD5.new, @secret, data) url = "#{secure ? 'https' : 'http'}://api.grooveshark.com/ws3.php?sig=#{sig}" response = RestClient.post(url, data) JSON.parse(response) end
setPlaylistSongs(playlistID, songIDs)
click to toggle source
# File lib/grooveshark-ruby/core.rb, line 95 def setPlaylistSongs(playlistID, songIDs) request('setPlaylistSongs', {'playlistID' => playlistID, 'songIDs' => songIDs}) end
startAutoplay(artistIDs, songIDs = nil)
click to toggle source
# File lib/grooveshark-ruby/autoplay.rb, line 15 def startAutoplay(artistIDs, songIDs = nil) request('startAutoplay', {'artistIDs' => artistIDs, 'songIDs' => songIDs}) end
startAutoplayTag(tagID)
click to toggle source
# File lib/grooveshark-ruby/autoplay.rb, line 11 def startAutoplayTag(tagID) request('startAutoplayTag', {'tagID' => tagID}) end
startSession()
click to toggle source
# File lib/grooveshark-ruby/sessions.rb, line 3 def startSession request('startSession', {}, true, nil)['result']['sessionID'] end
subscribePlaylist(playlistID)
click to toggle source
# File lib/grooveshark-ruby/core.rb, line 19 def subscribePlaylist(playlistID) request('subscribePlaylist', {'playlistID' => playlistID}) end
undeletePlaylist(playlistID)
click to toggle source
# File lib/grooveshark-ruby/core.rb, line 79 def undeletePlaylist(playlistID) request('undeletePlaylist', {'playlistID' => playlistID}) end
unsubscribePlaylist(playlistID)
click to toggle source
# File lib/grooveshark-ruby/core.rb, line 47 def unsubscribePlaylist(playlistID) request('unsubscribePlaylist', {'playlistID' => playlistID}) end
voteDownAutoplaySong(song, autoplayState)
click to toggle source
# File lib/grooveshark-ruby/autoplay.rb, line 39 def voteDownAutoplaySong(song, autoplayState) request('voteDownAutoplaySong', {'song' => song, 'autoplayState' => autoplayState}) end
voteUpAutoplaySong(song, autoplayState)
click to toggle source
# File lib/grooveshark-ruby/autoplay.rb, line 23 def voteUpAutoplaySong(song, autoplayState) request('voteUpAutoplaySong', {'song' => song, 'autoplayState' => autoplayState}) end