"songID": songID}
self._callRemote("markSongDownloaded", params)
- # Download a song to a temporary file
+ # Get the song URL
def getSongURL(self, songID):
- filename = os.path.join(self.cacheDir, songID + SONG_SUFFIX)
- print "Caching song " + songID + " to " + filename
- if os.path.isfile(filename) == False:
- if self._getStreamDetails(songID) == True:
- postData = {"streamKey": self._lastStreamKey}
- postData = urllib.urlencode(postData)
- urllib.FancyURLopener().retrieve( "http://" + self._lastStreamServer + "/stream.php", filename, data=postData)
- self._markSongDownloaded(songID)
- else:
- return ''
- return filename
+ if self._getStreamDetails(songID) == True:
+ postData = {"streamKey": self._lastStreamKey}
+ postData = urllib.urlencode(postData)
+ return "http://" + self._lastStreamServer + "/stream.php?" + str(postData)
+ else:
+ return ''
# Main API
class GrooveAPI:
# Get the url to link to a song on Grooveshark
def getSongURLFromSongID(self, songID):
song = GrooveSong()
- return song.getSongURL(songID)
+ url = song.getSongURL(songID)
+ print "Got song URL " + url
+ return url
# Get the url to link to a song on Grooveshark
def getSongInfo(self, songID):