class TrackController < ApplicationController require 'net/http' require 'uri' def listen pp track = Track.where(:id => params[:id].to_i).first pp release = Release.where(:id => track.release_id).first pp album = Album.where(:id => release.album_id).first pp artist = Artist.where(:id => album.artist_id).first data = Vkontakte.get(artist.name, track.name, (track.length / 1000).round) #data = open('/Users/chez/Sites/beathaven/tmp/media.mp3').read #send_data data, :type=>"audio/mp3" #render :text => data redirect_to data end end