def songinfo(self, songID): """ View lastfm info about a song @param songID """ c.song = musicDB.findsong(songID) return render("/derived/music/lastfm.html")
def listen(self, songID): """ Generate a stream for the music that is requested. Since the songs are outsite the webservers control area we need to load the music into a stream and return the stream. @param songID - ID of the song to stream. @return content - The music stream. """ songID = re.sub('\.mp3$', '', songID) path = musicDB.findsong(songID).path stream = open(path) content = stream.read() stream.close() response.content_type = "audio/mpeg" response.content_length = len(content) return content