1
0
Fork 0

Final changes before branching

This commit is contained in:
magnolia-fan 2011-06-13 16:16:22 +04:00
parent 3bb393bbc7
commit 1606ef8c0e
3 changed files with 14 additions and 11 deletions

View File

@ -1,13 +1,17 @@
class TrackController < ApplicationController
require 'net/http'
require 'uri'
@@token_salt = '8FW*W#dWOH*FHW4j:Q@RQ{Qo[qF;fw0`0w4fkl'
def listen
pp track = Track.where(:id => params[:id].to_i).first
data = Vkontakte.get(track.artist_name, track.name, (track.length / 1000).round)
# data = Vkontakte.get(1, 1, 1)
url = URI.parse(data['url'])
nginx_url = '/proxy-stream/no-token/' << data['remixsid'] << '/' << '5' << '/' << url.host << url.path
token = Digest::SHA256.hexdigest(params[:id] << @@token_salt)
nginx_url = '/proxy-stream/' << token << '/' << data['remixsid'] << '/' << '5' << '/' << url.host << url.path
headers['Content-Type'] = 'audio/mpeg'
headers['X-Accel-Redirect'] = nginx_url

View File

@ -45,13 +45,13 @@ Paganini: # Tom_Orrow
user_agent: "Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.204 Safari/534.16"
# Stolen
Stolen_Moroz:
user_id: 9444259
email: 89232979779@mail.ru
password: beatcobot1
remixsid: d5b1289ae534887319f41bdebf435f9ed3721ccf9203d7
remixchk: 5
user_agent: "Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.204 Safari/534.16"
# Stolen_Moroz:
# user_id: 9444259
# email: 89232979779@mail.ru
# password: beatcobot1
# remixsid: d5b1289ae534887319f41bdebf435f9ed3721ccf9203d7
# remixchk: 5
# user_agent: "Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.204 Safari/534.16"
Stolen_NarutoSasuke:
user_id: 29280365

5
nginx/proxy.conf Normal file → Executable file
View File

@ -30,9 +30,8 @@ location ~* ^/proxy-stream/(.*?)/(.*?)/(.*?)/(.*?)/(.*) {
# backend does not support Content-Disposition
# headers used to specify file name browsers use
# when save content to the disk
proxy_ignore_headers Cache-Control;
#add_header Content-Disposition 'attachment; filename=audio.mp3';
#add_header Connection 'close';
proxy_ignore_headers Cache-Control Expires;
# Do not touch local disks when proxying
# content to clients