Almost fixed streaming. The only thing left is to fix headers.
This commit is contained in:
@@ -7,8 +7,13 @@ class TrackController < ApplicationController
|
||||
pp album = Album.where(:id => release.album_id).first
|
||||
pp artist = Artist.where(:id => album.artist_id).first
|
||||
|
||||
url = Vkontakte.get(artist.name, track.name, (track.length / 1000).round)
|
||||
|
||||
redirect_to url
|
||||
data = Vkontakte.get(artist.name, track.name, (track.length / 1000).round)
|
||||
|
||||
url = URI.parse(data['url'])
|
||||
nginx_url = '/proxy-stream/no-token/' << data['remixsid'] << '/' << '5' << '/' << url.host << url.path
|
||||
#render :inline => nginx_url
|
||||
headers['Content-Type'] = 'audio/mpeg'
|
||||
headers['X-Accel-Redirect'] = nginx_url
|
||||
render :nothing => true
|
||||
end
|
||||
end
|
||||
|
||||
@@ -16,7 +16,12 @@ module Vkontakte
|
||||
files = self.parseHtml(html)
|
||||
files = self.calcWeight(files, artist, track, length)
|
||||
#self.stream files.first['url']
|
||||
files.first['url']
|
||||
|
||||
return {
|
||||
'url' => files.first['url'],
|
||||
'remixsid' => @@bot['remixsid'],
|
||||
'remixchk' => @@bot['remixchk']
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
@@ -108,4 +113,4 @@ module Vkontakte
|
||||
|
||||
data
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user