cleanup
This commit is contained in:
parent
d635b321f4
commit
1d9a0398c6
|
@ -1,54 +0,0 @@
|
|||
# encoding: utf-8
|
||||
class ArtistController < ApplicationController
|
||||
require 'open-uri'
|
||||
def view
|
||||
# Dirty auth block START
|
||||
# unless request.session['session_id'].nil? or MainController.logged_in request.session['session_id']
|
||||
# redirect_to '/login'
|
||||
# return
|
||||
# else
|
||||
# if request.session['session_id'].nil?
|
||||
# redirect_to '/login'
|
||||
# return
|
||||
# end
|
||||
# end
|
||||
# Dirty auth block END
|
||||
if params[:name].nil?
|
||||
name = ''
|
||||
else
|
||||
if request.request_method == 'POST'
|
||||
redirect_to :action => 'view', :name => params[:name].gsub(' ', '+')
|
||||
end
|
||||
name = params[:name].gsub('+', ' ')
|
||||
end
|
||||
@artist = Artist.getByName(name)
|
||||
if @artist.nil?
|
||||
render :file => "#{Rails.root}/public/404.html", :status => 404, :layout => false
|
||||
else
|
||||
@albums = []
|
||||
@artist.albums.each do |album|
|
||||
unless album.releases.empty?
|
||||
tracks = album.tracksInDb()
|
||||
@albums << {
|
||||
:object => album,
|
||||
:tracks => tracks
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
def autocomplete
|
||||
autocomplete = Artist.getLastFmAutocomplete(params[:query])
|
||||
return render :nothing => true if autocomplete.nil?
|
||||
suggestions = []
|
||||
autocomplete["response"]["docs"].each do |doc|
|
||||
suggestions << doc["artist"] unless suggestions.include?(doc["artist"])
|
||||
end
|
||||
|
||||
render :json => {
|
||||
:query => params[:query],
|
||||
:suggestions => suggestions
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
@ -1,131 +0,0 @@
|
|||
class BotController < ApplicationController
|
||||
require 'daemons'
|
||||
|
||||
PIDS_PATH = "#{Rails.root.to_s}/tmp/pids"
|
||||
|
||||
@@accounts = YAML.load_file("#{Rails.root.to_s}/config/vk_accounts.yml")
|
||||
@error = ""
|
||||
|
||||
def list
|
||||
@bots = []
|
||||
@@accounts.each do |bot_name, data|
|
||||
bot = Bot.new(bot_name)
|
||||
@bots << {
|
||||
:name => bot_name,
|
||||
:started => bot.running?,
|
||||
:current_track => bot.getCurrentTrack,
|
||||
:started_at => bot.running? ? bot.startedAt : nil
|
||||
}
|
||||
end
|
||||
pp @bots
|
||||
end
|
||||
|
||||
def stats
|
||||
end
|
||||
|
||||
|
||||
def queue
|
||||
bot_name = params['bot_name']
|
||||
group_by_artist = params['group_by_artist']
|
||||
limit = params['limit']
|
||||
|
||||
if not bot_name.nil?
|
||||
if not @@accounts.include?(bot_name)
|
||||
throw "Wrong bot name."
|
||||
end
|
||||
end
|
||||
if not group_by_artist.nil?
|
||||
group_by_artist = true
|
||||
end
|
||||
if params['limit'].to_i != 0
|
||||
limit = params['limit'].to_i
|
||||
end
|
||||
|
||||
statuses = [0, 1, 4]
|
||||
data = ParseQueue.any_in(status: statuses)
|
||||
if not bot_name.nil?
|
||||
data = data.where(:bot_name => bot_name)
|
||||
end
|
||||
# if group_by_artist
|
||||
# data = data.only(:artist_name).group
|
||||
# end
|
||||
if not limit.nil?
|
||||
data = data.limit(limit)
|
||||
end
|
||||
@queue = []
|
||||
unless data.nil?
|
||||
data.each do |track|
|
||||
@queue << track
|
||||
end
|
||||
end
|
||||
pp @queue
|
||||
end
|
||||
|
||||
def start
|
||||
name = params['name']
|
||||
begin
|
||||
if name.nil? or name.strip.empty?
|
||||
throw "Empty bot name"
|
||||
end
|
||||
|
||||
bot = Bot.new(name)
|
||||
bot.start
|
||||
rescue
|
||||
return render :file => "#{Rails.root}/public/404.html", :status => 404, :layout => false
|
||||
end
|
||||
end
|
||||
|
||||
def stop
|
||||
name = params['name']
|
||||
begin
|
||||
if name.nil? or name.strip.empty?
|
||||
throw "Empty bot name"
|
||||
end
|
||||
bot = Bot.new(name)
|
||||
bot.stop
|
||||
rescue
|
||||
return render :file => "#{Rails.root}/public/404.html", :status => 404, :layout => false
|
||||
end
|
||||
end
|
||||
|
||||
# Add artist to parse_queue
|
||||
def add
|
||||
name = params['name']
|
||||
if name.nil? or name.strip.empty?
|
||||
redirect_to '/'
|
||||
end
|
||||
|
||||
artist = Artist.getByName(name)
|
||||
if artist.nil?
|
||||
@error = "There is no such artist."
|
||||
else
|
||||
data = ParseQueue.where(:artist_id => artist.id).first
|
||||
if not data.nil?
|
||||
throw "This artist already exist in queue."
|
||||
else
|
||||
tracks = []
|
||||
artist.albums.each do |album|
|
||||
unless album.releases.empty?
|
||||
album.releases.first.tracks.each do |track|
|
||||
tracks << track
|
||||
end
|
||||
end
|
||||
end
|
||||
tracks.each do |track|
|
||||
ParseQueue.collection.insert({
|
||||
:track_id => track.id,
|
||||
:artist_id => artist.id,
|
||||
:artist_name => artist.name,
|
||||
:track_name => track.name,
|
||||
:bot_name => nil,
|
||||
:status => 0,
|
||||
:date => nil,
|
||||
:times_failed => 0
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
class MainController < ApplicationController
|
||||
def index
|
||||
# unless User.logged_in
|
||||
# redirect_to '/login'
|
||||
# end
|
||||
end
|
||||
end
|
|
@ -1,20 +0,0 @@
|
|||
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'])
|
||||
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
|
||||
render :nothing => true
|
||||
end
|
||||
end
|
|
@ -1,92 +0,0 @@
|
|||
class UserController < ApplicationController
|
||||
|
||||
@@invite_salt = 'Gouranga gives a fuck?!'
|
||||
@@email_regex = /^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/
|
||||
|
||||
def login
|
||||
@hide_player = 1
|
||||
unless params[:email].nil? or params[:password].nil?
|
||||
user_data = User.collection.find({email: params[:email], password: Digest::SHA256.hexdigest(params[:password])}).first
|
||||
unless user_data.nil?
|
||||
user_data['session_key'] = Digest::SHA256.hexdigest(request.session['session_id'])
|
||||
User.collection.update({_id: user_data._id}, user_data.attributes)
|
||||
redirect_to '/'
|
||||
else
|
||||
redirect_to '/login'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def register
|
||||
@hide_player = 1
|
||||
data = Invite.where(:email => params[:email], :code => params[:code]).first
|
||||
unless data.nil?
|
||||
@code = data.code
|
||||
@email = data.email
|
||||
else
|
||||
redirect_to '/login'
|
||||
end
|
||||
end
|
||||
|
||||
def complete
|
||||
@hide_player = 1
|
||||
data = Invite.where(:email => params[:invite_email], :code => params[:invite_code]).first
|
||||
unless data.nil?
|
||||
if params[:email].match(@@email_regex).nil? or
|
||||
params[:password].length < 6 or
|
||||
params[:password] != params[:password_c]
|
||||
redirect_to '/'
|
||||
end
|
||||
|
||||
User.collection.insert({
|
||||
email: params[:email],
|
||||
password: Digest::SHA256.hexdigest(params[:password]),
|
||||
name: '',
|
||||
regdate: Time.now(),
|
||||
referer: data.referer,
|
||||
lastvisit: Time.now(),
|
||||
invites: 0
|
||||
})
|
||||
|
||||
Invite.collection.remove({email: params[:invite_email], code: params[:invite_code]})
|
||||
else
|
||||
redirect_to '/login'
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
@data = User.collection.find({session_key: Digest::SHA256.hexdigest(request.session['session_id'])}).first
|
||||
unless @data.nil?
|
||||
if request.request_method == 'POST'
|
||||
if params[:name]
|
||||
@data.name = params[:name]
|
||||
end
|
||||
User.collection.update({_id: @data._id}, @data.attributes)
|
||||
end
|
||||
else
|
||||
render :json => 'wtf?'
|
||||
end
|
||||
end
|
||||
|
||||
def invite
|
||||
@data = User.collection.find({session_key: Digest::SHA256.hexdigest(request.session['session_id'])}).first
|
||||
unless @data.nil?
|
||||
if @data.invites > 0
|
||||
pp 1
|
||||
if request.request_method == 'POST'
|
||||
unless params[:email].nil?
|
||||
if params[:email].match(@@email_regex)
|
||||
Invite.collection.insert({email: params[:email], code: Digest::SHA256.hexdigest(params[:email] << @@invite_salt), referer: @data._id})
|
||||
@data.invites -= 1
|
||||
User.collection.update({_id: @data._id}, @data.attributes)
|
||||
@ok = true
|
||||
end
|
||||
end
|
||||
end
|
||||
pp 2
|
||||
else
|
||||
render :json => 'wtf?'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,2 +0,0 @@
|
|||
module ArtistHelper
|
||||
end
|
|
@ -1,2 +0,0 @@
|
|||
module MainHelper
|
||||
end
|
|
@ -1,2 +0,0 @@
|
|||
module TrackHelper
|
||||
end
|
|
@ -1,61 +0,0 @@
|
|||
# encoding: UTF-8
|
||||
class Album < ActiveRecord::Base
|
||||
set_table_name 'musicbrainz.bh_release_group'
|
||||
belongs_to :artist
|
||||
has_many :releases, :conditions => "release_type = 1", :order => 'date ASC, id ASC'
|
||||
|
||||
require 'iconv'
|
||||
|
||||
def cover artist
|
||||
covers = AlbumPic.where(album_id: id).first
|
||||
unless covers.nil?
|
||||
covers.extralarge
|
||||
else
|
||||
q_artist = CGI::escape(artist)
|
||||
q_album = CGI::escape(name)
|
||||
path = open(
|
||||
'http://ws.audioscrobbler.com/2.0/' <<
|
||||
'?method=album.getinfo' <<
|
||||
'&api_key=04fda005dbf61a50af5abc3e90f111f2' <<
|
||||
'&artist=' << q_artist <<
|
||||
'&album=' << q_album
|
||||
).read
|
||||
m = path.scan(/<image\ssize=\"(.*)\">(.*)<\/image>/i)
|
||||
AlbumPic.where(
|
||||
album_id: id,
|
||||
small: m[0][1],
|
||||
medium: m[1][1],
|
||||
large: m[2][1],
|
||||
extralarge: m[3][1],
|
||||
mega: m[4][1]
|
||||
).create
|
||||
m[3][1]
|
||||
end
|
||||
end
|
||||
|
||||
def tracksInDb
|
||||
tracks = []
|
||||
result = []
|
||||
tracks_in_db = []
|
||||
track_ids = []
|
||||
|
||||
self.releases.first.tracks.each do |track|
|
||||
tracks << track
|
||||
track_ids << track.id.to_s
|
||||
end
|
||||
in_db = TrackData.any_in(id: track_ids).only("id")
|
||||
unless in_db.nil?
|
||||
in_db.each do |track|
|
||||
tracks_in_db << track["id"].to_i;
|
||||
end
|
||||
end
|
||||
tracks.each do |track|
|
||||
result << {
|
||||
:object => track,
|
||||
:in_db => tracks_in_db.include?(track.id) ? nil : true
|
||||
}
|
||||
end
|
||||
result
|
||||
end
|
||||
end
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
class AlbumPic
|
||||
include Mongoid::Document
|
||||
store_in :album_pics
|
||||
|
||||
key :album_id, Integer
|
||||
key :small, String
|
||||
key :medium, String
|
||||
key :large, String
|
||||
key :extralarge, String
|
||||
key :mega, String
|
||||
end
|
|
@ -1,19 +0,0 @@
|
|||
class Artist < ActiveRecord::Base
|
||||
set_table_name 'musicbrainz.bh_artist'
|
||||
has_many :albums, :conditions => "release_type = 1", :order => 'year ASC, id ASC'
|
||||
|
||||
def self.getByName(name)
|
||||
Artist.first(:conditions => ['name = ? AND id=credit_id', name], :order => 'rating DESC')
|
||||
end
|
||||
|
||||
def self.getLastFmAutocomplete(query)
|
||||
return nil if query.nil? or query.strip.empty?
|
||||
|
||||
json = ActiveSupport::JSON.decode(open(
|
||||
'http://www.last.fm/search/autocomplete' <<
|
||||
'?q=' << URI.escape(query)
|
||||
).read)
|
||||
return json.empty? ? nil : json
|
||||
end
|
||||
end
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
class BeatDB
|
||||
@@db_root = '/www/beatdb'
|
||||
|
||||
def self.get key
|
||||
unless self.exists(key) || File.readable?(self.filePathByKey(key))
|
||||
return false
|
||||
end
|
||||
h = File.open(self.filePathByKey(key), 'r')
|
||||
JSON.decode(h.readline)
|
||||
end
|
||||
|
||||
def self.set key, data
|
||||
unless self.exists(key) || File.writable?(self.filePathByKey(key))
|
||||
return false
|
||||
end
|
||||
h = File.open(self.filePathByKey(key), 'w')
|
||||
h.puts(JSON.encode(data))
|
||||
end
|
||||
|
||||
def self.delete key
|
||||
|
||||
end
|
||||
|
||||
def self.exists key
|
||||
File.exists?(self.filePathByKey(key))
|
||||
end
|
||||
|
||||
def self.filePathByKey key
|
||||
path = ''
|
||||
key.to_s.each_char {|c| path << '/' + c}
|
||||
@@db_root + path[0..(path.length-2)] << key.to_s + '.json'
|
||||
end
|
||||
end
|
|
@ -1,54 +0,0 @@
|
|||
# encoding: UTF-8
|
||||
class Bot < Daemons::PidFile
|
||||
require "daemons"
|
||||
|
||||
PIDS_PATH = "#{Rails.root.to_s}/tmp/pids"
|
||||
DAEMON_PATH = "#{Rails.root.to_s}/lib/daemons"
|
||||
@@accounts = YAML.load_file("#{Rails.root.to_s}/config/vk_accounts.yml")
|
||||
|
||||
def initialize(name)
|
||||
unless @@accounts.include?(name)
|
||||
throw "Empty bot name."
|
||||
end
|
||||
|
||||
@dir = File.expand_path(PIDS_PATH)
|
||||
@progname = name
|
||||
@multiple = false
|
||||
@number = nil
|
||||
end
|
||||
|
||||
def getCurrentTrack
|
||||
current_track = ParseQueue.where(:status => 4, :bot_name => @progname).first
|
||||
end
|
||||
|
||||
def startedAt
|
||||
unless self.running?
|
||||
return false
|
||||
end
|
||||
ts = eval('`date -d "\`ps -p ' + self.pid.to_s + ' -o lstart=\`" +"%Y-%m-%d %H:%M:%S"`')
|
||||
ts = ts.strip
|
||||
end
|
||||
|
||||
def start
|
||||
if bot.running?
|
||||
throw "This bot already started."
|
||||
end
|
||||
eval('`ruby ' + DAEMON_PATH + '/parse_controller.rb ' + Rails.root.to_s + ' ' + name + '`')
|
||||
end
|
||||
|
||||
def stop
|
||||
if not self.running?
|
||||
throw "This bot already stopped."
|
||||
end
|
||||
|
||||
signal = (RUBY_PLATFORM =~ /win32/ ? 'KILL' : 'TERM')
|
||||
pid = self.pid
|
||||
begin
|
||||
Process.kill(signal, self.pid)
|
||||
self.cleanup
|
||||
rescue Errno::ESRCH => e
|
||||
throw "#{e} #{pid}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
class Invite
|
||||
include Mongoid::Document
|
||||
store_in :invites
|
||||
|
||||
key :referer, Integer
|
||||
key :email, String
|
||||
key :code, String
|
||||
key :date, Date
|
||||
end
|
|
@ -1,14 +0,0 @@
|
|||
class ParseQueue
|
||||
include Mongoid::Document
|
||||
store_in :bot_parse_queue
|
||||
|
||||
key :track_id, Integer
|
||||
key :artist_id, Integer
|
||||
key :artist_name, String
|
||||
key :track_name, String
|
||||
key :bot_name, String
|
||||
key :status, Integer
|
||||
key :date, Array
|
||||
key :times_failed, Integer
|
||||
end
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
class Release < ActiveRecord::Base
|
||||
set_table_name 'musicbrainz.bh_release'
|
||||
belongs_to :album
|
||||
has_many :tracks, :order => 'position ASC'
|
||||
end
|
|
@ -1,5 +0,0 @@
|
|||
class Track < ActiveRecord::Base
|
||||
set_table_name 'musicbrainz.bh_track'
|
||||
belongs_to :release
|
||||
end
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
class TrackData
|
||||
include Mongoid::Document
|
||||
store_in :track_data
|
||||
|
||||
key :id, Integer
|
||||
key :artist, String
|
||||
key :title, String
|
||||
key :length, Integer
|
||||
key :files, Array
|
||||
end
|
|
@ -1,24 +0,0 @@
|
|||
class User
|
||||
include Mongoid::Document
|
||||
store_in :users
|
||||
|
||||
key :name, String
|
||||
key :password, String
|
||||
key :email, String
|
||||
key :regdate, Date
|
||||
key :invites, Integer
|
||||
key :referer, Integer
|
||||
key :active, Integer
|
||||
|
||||
def logged_in
|
||||
unless request.session['session_id'].nil? or MainController.logged_in session['session_id']
|
||||
redirect_to '/login'
|
||||
return
|
||||
else
|
||||
if request.session['session_id'].nil?
|
||||
redirect_to '/login'
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,36 +0,0 @@
|
|||
<% if @artist.nil? %>
|
||||
<div class="search">
|
||||
<h1>We don`t know such artist yet..</h1>
|
||||
<%= link_to "Try again", main_path %>
|
||||
</div>
|
||||
<% else %>
|
||||
<h1 class="artist">
|
||||
<span>
|
||||
<span><%= @artist.name %></span>
|
||||
<span class="play"><img src="/images/player/add.svg" alt="play" /></span>
|
||||
</span>
|
||||
</h1>
|
||||
<% @albums.each do |album| %>
|
||||
<div class="album">
|
||||
<div class="pic"><img src="<%= album[:object].cover(@artist.name) %>" width="250" height="250" alt=""/></div>
|
||||
<h3 class="name">
|
||||
<span><%= album[:object].name %> <%= (album[:object].year ? album[:object].year : '') %></span>
|
||||
<span class="play"><img src="/images/player/add.svg" alt="play" /></span>
|
||||
</h3>
|
||||
<ul class="tracks">
|
||||
<% album[:tracks].each do |track| %>
|
||||
<li id="<%= track[:object].id %>">
|
||||
<span class="play<%= (track[:in_db].nil? ? '' : ' disabled') %>">
|
||||
<img src="/images/player/add.svg" alt="play" />
|
||||
</span>
|
||||
<span class="track-name"><%= track[:object].name %></span>
|
||||
<% unless track[:object].length.nil? %>
|
||||
<span class="duration" data-length="<%= track[:object].length %>"><%= track[:object].length.toTime %></span>
|
||||
<% end %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
<h1>Bot#list</h1>
|
||||
<p>Find me in app/views/bot/list.html.erb</p>
|
|
@ -1,2 +0,0 @@
|
|||
<h1>Bot#stats</h1>
|
||||
<p>Find me in app/views/bot/stats.html.erb</p>
|
|
@ -1,19 +0,0 @@
|
|||
<script type="text/javascript">
|
||||
jQuery(function(){
|
||||
var ac = $('#name').autocomplete({
|
||||
serviceUrl: 'search/autocomplete', // Страница для обработки запросов автозаполнения
|
||||
minChars: 2, // Минимальная длина запроса для срабатывания автозаполнения
|
||||
delimiter: /(,|;)\s*/, // Разделитель для нескольких запросов, символ или регулярное выражение
|
||||
maxHeight: 400, // Максимальная высота списка подсказок, в пикселях
|
||||
width: 300, // Ширина списка
|
||||
zIndex: 9999, // z-index списка
|
||||
deferRequestBy: 150, // Задержка запроса (мсек)
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="search">
|
||||
<%= form_tag('/artist', :method => 'post') %>
|
||||
<%= text_field_tag 'name', nil %>
|
||||
</div>
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
<div id="nav">
|
||||
<ul>
|
||||
<li><a href="/">Search</a></li>
|
||||
<li><a href="/user/profile">Profile</a></li>
|
||||
<li><a href="/logout">Logout</a></li>
|
||||
</ul>
|
||||
</div>
|
|
@ -1,3 +0,0 @@
|
|||
<div id="registration">
|
||||
<h1>Welcome aboard, friend!</h1>
|
||||
</div>
|
|
@ -1,23 +0,0 @@
|
|||
<div id="registration">
|
||||
<h1>Help BeatHaven dominate those lousy humans!</h1>
|
||||
<%= form_tag('/reg/complete', :method => 'post') do -%>
|
||||
<%= label_tag 'email', 'E-mail' %><%= email_field_tag 'email', @email %><div id="email_error"></div>
|
||||
<div class="complete">
|
||||
<%= submit_tag 'I wanna get this guy in!' %>
|
||||
</div>
|
||||
<% end -%>
|
||||
</div>
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
$(function(){
|
||||
$('#email').focus();
|
||||
$('form').submit(function(){
|
||||
$('#email, #email_error').html('');
|
||||
if (! $('#email').val().match(/^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/)) {
|
||||
$('#email_error').html('* Invalid email');
|
||||
$('#email').focus();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
})
|
||||
})
|
||||
</script>
|
|
@ -1,24 +0,0 @@
|
|||
<div id="registration">
|
||||
<h1>Do BeatHaven know you?</h1>
|
||||
<%= form_tag('/login', :method => 'post') do -%>
|
||||
<%= label_tag 'email', 'E-mail' %><%= email_field_tag 'email', nil %>
|
||||
<%= label_tag 'password', 'Password' %><%= password_field_tag 'password', nil %><div id="password_error"></div>
|
||||
<div class="complete">
|
||||
<%= submit_tag 'Let me in!' %>
|
||||
</div>
|
||||
<% end -%>
|
||||
</div>
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
$(function(){
|
||||
$('#email').focus();
|
||||
$('form').submit(function(){
|
||||
$('#password_error, #password_c_error').html('');
|
||||
if ($('#password').val().length < 6) {
|
||||
$('#password_error').html('* You must be kidding?');
|
||||
$('#password').focus();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
})
|
||||
})
|
||||
</script>
|
|
@ -1,31 +0,0 @@
|
|||
<div id="registration">
|
||||
<h1>Greetings from BeatHaven!</h1>
|
||||
<%= form_tag('/reg/complete', :method => 'post') do -%>
|
||||
<%= hidden_field_tag 'invite_code', @code %>
|
||||
<%= hidden_field_tag 'invite_email', @email %>
|
||||
<%= label_tag 'email', 'E-mail' %><%= email_field_tag 'email', @email %>
|
||||
<%= label_tag 'password', 'Password' %><%= password_field_tag 'password', nil %><div id="password_error"></div>
|
||||
<%= label_tag 'password_c', 'Confirm' %><%= password_field_tag 'password_c', nil %><div id="password_c_error"></div>
|
||||
<div class="complete">
|
||||
<%= submit_tag 'Complete' %>
|
||||
</div>
|
||||
<% end -%>
|
||||
</div>
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
$(function(){
|
||||
$('#password').focus();
|
||||
$('form').submit(function(){
|
||||
$('#password_error, #password_c_error').html('');
|
||||
if ($('#password').val().length < 6) {
|
||||
$('#password_error').html('* Password must be 6+ characters length');
|
||||
$('#password').focus();
|
||||
return false;
|
||||
} else if ($('#password').val() != $('#password_c').val()) {
|
||||
$('#password_c_error').html('* Password and confirmation doesn\'t match');
|
||||
$('#password_c').focus();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
})
|
||||
})
|
||||
</script>
|
|
@ -1,31 +0,0 @@
|
|||
<div id="registration">
|
||||
<h1>Update ur profile!</h1>
|
||||
<%= form_tag('/user/profile', :method => 'post') do -%>
|
||||
<%= label_tag 'email', 'E-mail' %><%= email_field_tag 'email', @data.email %>
|
||||
<%= label_tag 'name', 'Name' %><%= text_field_tag 'name', @data.name %>
|
||||
<%= label_tag 'password', 'Password' %><%= password_field_tag 'password', nil %><div id="password_error"></div>
|
||||
<%= label_tag 'password_c', 'Confirm' %><%= password_field_tag 'password_c', nil %><div id="password_c_error"></div>
|
||||
<div class="complete">
|
||||
<%= submit_tag 'I\'m done!' %>
|
||||
</div>
|
||||
<% end -%>
|
||||
|
||||
</div>
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
$(function(){
|
||||
$('#password').focus();
|
||||
$('form').submit(function(){
|
||||
$('#password_error, #password_c_error').html('');
|
||||
if ($('#password').val().length > 0 && $('#password').val().length < 6) {
|
||||
$('#password_error').html('* Password must be 6+ characters length');
|
||||
$('#password').focus();
|
||||
return false;
|
||||
} else if ($('#password').val().length > 0 && $('#password').val() != $('#password_c').val()) {
|
||||
$('#password_c_error').html('* Password and confirmation doesn\'t match');
|
||||
$('#password_c').focus();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
})
|
||||
})
|
||||
</script>
|
|
@ -1,73 +0,0 @@
|
|||
ENV["RAILS_ENV"] ||= "development"
|
||||
|
||||
require ARGV[0] + "/config/environment.rb"
|
||||
require "daemons"
|
||||
require "pp"
|
||||
|
||||
ROOT_PATH = ARGV[0]
|
||||
LOGS_PATH = ROOT_PATH + "/log"
|
||||
BOT_NAME = ARGV[1]
|
||||
|
||||
@@logger = Logger.new("/var/www/bh/log/Parser.log")
|
||||
@@logger.info(ARGV)
|
||||
|
||||
loop {
|
||||
sleep(10)
|
||||
}
|
||||
#loop {
|
||||
|
||||
# Получаем список песен для загрузки, помечаем в очереди, что мы их взяли в работу
|
||||
# bot_name =
|
||||
# ParseQueue.collection.update({status: {$in: [0, 1, 4]}, $atomic: true}, {$set: {bot_name: bot_name}})
|
||||
# $queue = $db->getRows($db->q("SELECT * FROM beathaven.queue WHERE status=0 ORDER BY priority DESC, times_failed ASC LIMIT ". QUEUE_PACK));
|
||||
# $ids = array();
|
||||
# foreach ($queue as $t) {
|
||||
# $ids[] = $t['track_id'];
|
||||
# }
|
||||
# $db->q('UPDATE beathaven.queue SET status=1 WHERE track_id IN('. implode(',', $ids) .')');
|
||||
# $db->q('COMMIT');
|
||||
|
||||
# if (!$queue || count($queue) == 0) {
|
||||
# sleep(EMPTY_QUEUE_TIMEOUT);
|
||||
# } else {
|
||||
# $stats['queue_size'] = count($queue);
|
||||
# foreach ($queue as $t) {
|
||||
# $t1 = microtime(true);
|
||||
# echo "{$t['track_id']} {$t['track_title']} -- ";
|
||||
# $ok = $vk->getTracks($t['track_title']);
|
||||
|
||||
# if (strpos($vk->getHtml(), 'searchOffset') === false) {
|
||||
# echo "Session kaput!\n";
|
||||
# die;
|
||||
# }
|
||||
|
||||
# if ($ok) {
|
||||
# echo "OK\n";
|
||||
# $db->q("UPDATE beathaven.queue SET status=3 WHERE track_id=". $t['track_id']);
|
||||
# $file_name = Config::get('app:Parser:good_html_dir'). $t['track_id'] .'.html';
|
||||
# $stats['good_results']++;
|
||||
# } else {
|
||||
# echo "FAILED\n";
|
||||
# $db->q("UPDATE beathaven.queue SET status = 2, times_failed = times_failed + 1 WHERE track_id=". $t['track_id']);
|
||||
# $file_name = Config::get('app:Parser:bad_html_dir'). $t['track_id'] .'.html';
|
||||
# $stats['bad_results']++;
|
||||
# }
|
||||
# file_put_contents($file_name, $vk->getHtml());
|
||||
# chmod($file_name, 0777);
|
||||
|
||||
# $stats['last_request'] = $t['track_title'];
|
||||
# $stats['queue_size']--;
|
||||
# $stats['eneded_job'] = time();
|
||||
|
||||
# $bot_stats_file_name = Config::get('app:Parser:bot_stats_dir'). $bot_name .'.json';
|
||||
# file_put_contents($bot_stats_file_name, json_encode($stats));
|
||||
# chmod($bot_stats_file_name, 0777);
|
||||
|
||||
# $t2 = microtime(true);
|
||||
# if ($t2 - $t1 < VKTIMEOUT) {
|
||||
# sleep(ceil(VKTIMEOUT - ($t2 - $t1)));
|
||||
# }
|
||||
# }
|
||||
# }
|
||||
#}
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
ENV["RAILS_ENV"] ||= "development"
|
||||
|
||||
return false if ARGV.empty?
|
||||
|
||||
require ARGV[0] + "/config/environment.rb"
|
||||
require "daemons"
|
||||
require "pp"
|
||||
|
||||
ROOT_PATH = ARGV[0]
|
||||
PIDS_PATH = ROOT_PATH + "/tmp/pids"
|
||||
|
||||
options = {
|
||||
:app_name => ARGV[1],
|
||||
:dir_mode => :normal,
|
||||
:ARGV => ["start", "--", ROOT_PATH, ARGV[1]],
|
||||
:dir => PIDS_PATH,
|
||||
:ontop => false,
|
||||
:backtrace => false
|
||||
}
|
||||
Daemons.run(File.dirname(__FILE__) << '/parse.rb', options)
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
#!/opt/local/bin/php
|
||||
<?php
|
||||
|
||||
chdir('..');
|
||||
require_once 'common.php';
|
||||
Config::loadFile('app', 'config/app.ini');
|
||||
|
||||
$artist_name = $argv[1];
|
||||
|
||||
$db = Db::getInstance();
|
||||
$a_model = Model::factory('musicbrainz', 'Artist');
|
||||
$rg_model = Model::factory('musicbrainz', 'ReleaseGroup');
|
||||
$r_model = Model::factory('musicbrainz', 'Release');
|
||||
$t_model = Model::factory('musicbrainz', 'Track');
|
||||
|
||||
$artist_id = $a_model->getId($artist_name);
|
||||
|
||||
if (!$artist_id) {
|
||||
echo "Bad artist name!\n\n\n"; die;
|
||||
}
|
||||
|
||||
$albums = $rg_model->getArtistAlbums($artist_id);
|
||||
$release_groups = $r_model->getReleases(array_keys($albums), true);
|
||||
|
||||
$g_tracks = array();
|
||||
foreach ($release_groups as $release_group => $releases) {
|
||||
$g_tracks[$release_group] = $t_model->getUniqueReleaseTracks(array_keys($releases));
|
||||
}
|
||||
|
||||
foreach($g_tracks as $release_group => $tracks) {
|
||||
$tracks = $tracks['tracks'] + $tracks['bonus'];
|
||||
foreach ($tracks as $track) {
|
||||
$track_id = $track['id'];
|
||||
$track_title = addslashes($artist_name .' - '. $track['name']);
|
||||
$track_length = $track['length'];
|
||||
$q = "INSERT INTO beathaven.queue VALUES({$track_id}, 0, E'{$track_title}', {$track_length});";
|
||||
echo $q."\n";
|
||||
$db->q($q);
|
||||
}
|
||||
}
|
|
@ -1,90 +0,0 @@
|
|||
#!/opt/local/bin/php
|
||||
<?php
|
||||
|
||||
require_once '/www/server/php/common.php';
|
||||
|
||||
$tmp = array_slice(scandir(Config::get('app:Parser:bot_stats_dir')), 2);
|
||||
$bots = array();
|
||||
foreach ($tmp as $bfile) {
|
||||
$bots[str_replace('.json', '', $bfile)] = json_decode(file_get_contents(Config::get('app:Parser:bot_stats_dir').$bfile));
|
||||
}
|
||||
|
||||
foreach ($bots as $name => $bot) {
|
||||
$tmp = exec("ps ".$bot->pid);
|
||||
$bot->active = (int) (strpos($tmp, strval($bot->pid)) !== false);
|
||||
}
|
||||
|
||||
if (!isset($argv[1])) {
|
||||
echo "Bad action\n";
|
||||
die;
|
||||
}
|
||||
|
||||
switch ($argv[1]) {
|
||||
case 'add':
|
||||
$bot_name = (isset($argv[2]) ? ucfirst($argv[2]) : false);
|
||||
if ($bot_name && isset($bots[$bot_name])) {
|
||||
$bot = $bots[$bot_name];
|
||||
if($bot->active) {
|
||||
echo $bot_name ." is working already\n";
|
||||
} else {
|
||||
echo "Launching ". $bot_name ."\n";
|
||||
shell_exec(ROOT_DIR ."/bin/parser/worker_html_grabber.php ". $bot_name ." > /www/parser_data/log/". $bot_name .".log &");
|
||||
}
|
||||
} else {
|
||||
$bots = custom_shuffle($bots);
|
||||
foreach ($bots as $name => $bot) {
|
||||
if (!$bot->active) {
|
||||
echo "Launching ". $name ."\n";
|
||||
shell_exec(ROOT_DIR ."/bin/parser/worker_html_grabber.php ". $name ." > /www/parser_data/log/". $name .".log &");
|
||||
if ($bot_name != 'All') {
|
||||
die;
|
||||
}
|
||||
sleep(1);
|
||||
}
|
||||
}
|
||||
echo "All bots are working.\n";
|
||||
}
|
||||
break;
|
||||
case 'retire':
|
||||
$bot_name = (isset($argv[2]) ? ucfirst($argv[2]) : false);
|
||||
if ($bot_name && isset($bots[$bot_name])) {
|
||||
$bot = $bots[$bot_name];
|
||||
if(!$bot->active) {
|
||||
echo $bot_name ." is not working now\n";
|
||||
} else {
|
||||
echo "Stopping ". $bot_name ."\n";
|
||||
shell_exec("kill ". $bot->pid);
|
||||
}
|
||||
} else {
|
||||
$bots = custom_shuffle($bots);
|
||||
foreach ($bots as $name => $bot) {
|
||||
if ($bot->active) {
|
||||
echo "Stopping ". $name ."\n";
|
||||
shell_exec("kill ". $bot->pid);
|
||||
if ($bot_name != 'All') {
|
||||
die;
|
||||
}
|
||||
}
|
||||
}
|
||||
echo "All bots are stopped.\n";
|
||||
}
|
||||
break;
|
||||
case 'list':
|
||||
foreach($bots as $name => $bot) {
|
||||
echo $name .': '. ($bot->active ? 'working' : 'down') ."\n";
|
||||
}
|
||||
break;
|
||||
default:
|
||||
echo "Bad action\n";
|
||||
break;
|
||||
}
|
||||
|
||||
function custom_shuffle($my_array = array()) {
|
||||
$copy = array();
|
||||
while (count($my_array)) {
|
||||
$element = array_rand($my_array);
|
||||
$copy[$element] = $my_array[$element];
|
||||
unset($my_array[$element]);
|
||||
}
|
||||
return $copy;
|
||||
}
|
|
@ -1,83 +0,0 @@
|
|||
#!/opt/local/bin/php
|
||||
<?php
|
||||
|
||||
chdir('../..');
|
||||
require_once 'common.php';
|
||||
|
||||
// Минимальный интервал между запросами
|
||||
define('QUEUE_PACK', 50);
|
||||
define('EMPTY_QUEUE_TIMEOUT', 60);
|
||||
|
||||
$bot_name = 'Chopin';
|
||||
|
||||
// Данные о работе бота
|
||||
$stats = array(
|
||||
'started_job' => time(),
|
||||
'eneded_job' => time(),
|
||||
'pid' => getmypid(),
|
||||
'good_results' => 0,
|
||||
'bad_results' => 0,
|
||||
'queue_size' => 0,
|
||||
'last_request' => ''
|
||||
);
|
||||
|
||||
// Устанавливаем коннект с БД
|
||||
$db = Db::getInstance();
|
||||
|
||||
$vk = new Vkontakte();
|
||||
|
||||
// Бот работает все время
|
||||
while (true) {
|
||||
|
||||
// Получаем список песен для проверки, помечаем в очереди, что мы их взяли в работу
|
||||
$db->q('BEGIN');
|
||||
$queue = $db->getRows($db->q("SELECT * FROM beathaven.queue WHERE status=3 LIMIT ". QUEUE_PACK));
|
||||
$ids = array();
|
||||
foreach ($queue as $t) {
|
||||
$ids[] = $t['track_id'];
|
||||
}
|
||||
$db->q('UPDATE beathaven.queue SET status=4 WHERE track_id IN('. implode(',', $ids) .')');
|
||||
$db->q('COMMIT');
|
||||
|
||||
if (!$queue || count($queue) == 0) {
|
||||
sleep(EMPTY_QUEUE_TIMEOUT);
|
||||
} else {
|
||||
$stats['queue_size'] = count($queue);
|
||||
foreach ($queue as $t) {
|
||||
$t1 = microtime(true);
|
||||
echo "#{$t['track_id']} {$t['track_title']} -- ";
|
||||
|
||||
$html = file_get_contents(Config::get('app:Parser:good_html_dir'). $t['track_id'] .'.html');
|
||||
$vk->setHtml($html);
|
||||
$vk->parseHtml();
|
||||
$files = $vk->getFiles();
|
||||
|
||||
$tmp = explode(' - ', $t['track_title']);
|
||||
$artist_name = $tmp[0];
|
||||
unset($tmp[0]);
|
||||
$track_name = implode(' - ', $tmp);
|
||||
|
||||
$files = VkontakteMP3::check($files, $artist_name, $track_name, $t['track_length']);
|
||||
BeatDB::set($t['track_id'], $files);
|
||||
echo count($files) ."\n";
|
||||
|
||||
if (count($files) > 0) {
|
||||
$db->q("UPDATE beathaven.queue SET status=6 WHERE track_id=". $t['track_id']);
|
||||
$stats['good_results']++;
|
||||
} else {
|
||||
$db->q("UPDATE beathaven.queue SET status=5, times_failed = times_failed + 1 WHERE track_id=". $t['track_id']);
|
||||
$stats['bad_results']++;
|
||||
}
|
||||
|
||||
$stats['last_request'] = $t['track_title'];
|
||||
$stats['queue_size']--;
|
||||
$stats['eneded_job'] = time();
|
||||
|
||||
$bot_stats_file_name = Config::get('app:Parser:bot_stats_dir'). $bot_name .'.json';
|
||||
file_put_contents($bot_stats_file_name, json_encode($stats));
|
||||
chmod($bot_stats_file_name, 0777);
|
||||
|
||||
$t2 = microtime(true);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,98 +0,0 @@
|
|||
#!/opt/local/bin/php
|
||||
<?php
|
||||
// Демонизация процесса
|
||||
$child_pid = pcntl_fork();
|
||||
|
||||
if ($child_pid == -1) {
|
||||
die('Error while forking process.');
|
||||
} elseif ($child_pid) {
|
||||
// Выходим из родительского, привязанного к консоли, процесса
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once '/www/server/php/common.php';
|
||||
|
||||
// Минимальный интервал между запросами
|
||||
define('VKTIMEOUT', 10);
|
||||
define('QUEUE_PACK', 30);
|
||||
define('EMPTY_QUEUE_TIMEOUT', 60);
|
||||
|
||||
// Получаем имя бота
|
||||
if (!isset($argv[1]) || !Config::get('bot:'. $argv[1])) {
|
||||
die('Wrong bot name: '. @$argv[1]);
|
||||
}
|
||||
$bot_name = ucfirst($argv[1]);
|
||||
|
||||
// Инициализация бота по имени
|
||||
$vk = new Vkontakte($bot_name);
|
||||
|
||||
// Данные о работе бота
|
||||
$stats = array(
|
||||
'started_job' => time(),
|
||||
'eneded_job' => time(),
|
||||
'pid' => getmypid(),
|
||||
'good_results' => 0,
|
||||
'bad_results' => 0,
|
||||
'queue_size' => 0,
|
||||
'last_request' => ''
|
||||
);
|
||||
|
||||
// Устанавливаем коннект с БД
|
||||
$db = Db::getInstance();
|
||||
|
||||
// Бот работает все время
|
||||
while (true) {
|
||||
|
||||
// Получаем список песен для загрузки, помечаем в очереди, что мы их взяли в работу
|
||||
$db->q('BEGIN');
|
||||
$queue = $db->getRows($db->q("SELECT * FROM beathaven.queue WHERE status=0 ORDER BY priority DESC, times_failed ASC LIMIT ". QUEUE_PACK));
|
||||
$ids = array();
|
||||
foreach ($queue as $t) {
|
||||
$ids[] = $t['track_id'];
|
||||
}
|
||||
$db->q('UPDATE beathaven.queue SET status=1 WHERE track_id IN('. implode(',', $ids) .')');
|
||||
$db->q('COMMIT');
|
||||
|
||||
if (!$queue || count($queue) == 0) {
|
||||
sleep(EMPTY_QUEUE_TIMEOUT);
|
||||
} else {
|
||||
$stats['queue_size'] = count($queue);
|
||||
foreach ($queue as $t) {
|
||||
$t1 = microtime(true);
|
||||
echo "#{$t['track_id']} {$t['track_title']} -- ";
|
||||
$ok = $vk->getTracks($t['track_title']);
|
||||
|
||||
if (strpos($vk->getHtml(), 'searchOffset') === false) {
|
||||
echo "Session kaput!\n";
|
||||
die;
|
||||
}
|
||||
|
||||
if ($ok) {
|
||||
echo "OK\n";
|
||||
$db->q("UPDATE beathaven.queue SET status=3 WHERE track_id=". $t['track_id']);
|
||||
$file_name = Config::get('app:Parser:good_html_dir'). $t['track_id'] .'.html';
|
||||
$stats['good_results']++;
|
||||
} else {
|
||||
echo "FAILED\n";
|
||||
$db->q("UPDATE beathaven.queue SET status = 2, times_failed = times_failed + 1 WHERE track_id=". $t['track_id']);
|
||||
$file_name = Config::get('app:Parser:bad_html_dir'). $t['track_id'] .'.html';
|
||||
$stats['bad_results']++;
|
||||
}
|
||||
file_put_contents($file_name, $vk->getHtml());
|
||||
chmod($file_name, 0777);
|
||||
|
||||
$stats['last_request'] = $t['track_title'];
|
||||
$stats['queue_size']--;
|
||||
$stats['eneded_job'] = time();
|
||||
|
||||
$bot_stats_file_name = Config::get('app:Parser:bot_stats_dir'). $bot_name .'.json';
|
||||
file_put_contents($bot_stats_file_name, json_encode($stats));
|
||||
chmod($bot_stats_file_name, 0777);
|
||||
|
||||
$t2 = microtime(true);
|
||||
if ($t2 - $t1 < VKTIMEOUT) {
|
||||
sleep(ceil(VKTIMEOUT - ($t2 - $t1)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
|
||||
|
||||
# This model initially had no columns defined. If you add columns to the
|
||||
# model remove the '{}' from the fixture names and add the columns immediately
|
||||
# below each fixture, per the syntax in the comments below
|
||||
#
|
||||
one: {}
|
||||
# column: value
|
||||
#
|
||||
two: {}
|
||||
# column: value
|
|
@ -1,11 +0,0 @@
|
|||
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
|
||||
|
||||
# This model initially had no columns defined. If you add columns to the
|
||||
# model remove the '{}' from the fixture names and add the columns immediately
|
||||
# below each fixture, per the syntax in the comments below
|
||||
#
|
||||
one: {}
|
||||
# column: value
|
||||
#
|
||||
two: {}
|
||||
# column: value
|
|
@ -1,11 +0,0 @@
|
|||
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
|
||||
|
||||
# This model initially had no columns defined. If you add columns to the
|
||||
# model remove the '{}' from the fixture names and add the columns immediately
|
||||
# below each fixture, per the syntax in the comments below
|
||||
#
|
||||
one: {}
|
||||
# column: value
|
||||
#
|
||||
two: {}
|
||||
# column: value
|
|
@ -1,19 +0,0 @@
|
|||
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
|
||||
|
||||
one:
|
||||
name:
|
||||
password:
|
||||
email:
|
||||
regdate:
|
||||
invites:
|
||||
referer:
|
||||
active: 1
|
||||
|
||||
two:
|
||||
name:
|
||||
password:
|
||||
email:
|
||||
regdate:
|
||||
invites:
|
||||
referer:
|
||||
active: 1
|
|
@ -1,8 +0,0 @@
|
|||
require 'test_helper'
|
||||
|
||||
class ArtistControllerTest < ActionController::TestCase
|
||||
# Replace this with your real tests.
|
||||
test "the truth" do
|
||||
assert true
|
||||
end
|
||||
end
|
|
@ -1,34 +0,0 @@
|
|||
require 'test_helper'
|
||||
|
||||
class BotControllerTest < ActionController::TestCase
|
||||
test "should get list" do
|
||||
get :list
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should get stats" do
|
||||
get :stats
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should get queue" do
|
||||
get :queue
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should get start" do
|
||||
get :start
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should get stop" do
|
||||
get :stop
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should get add" do
|
||||
get :add
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
end
|
|
@ -1,9 +0,0 @@
|
|||
require 'test_helper'
|
||||
|
||||
class MainControllerTest < ActionController::TestCase
|
||||
test "should get index" do
|
||||
get :index
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
end
|
|
@ -1,8 +0,0 @@
|
|||
require 'test_helper'
|
||||
|
||||
class TrackControllerTest < ActionController::TestCase
|
||||
# Replace this with your real tests.
|
||||
test "the truth" do
|
||||
assert true
|
||||
end
|
||||
end
|
|
@ -1,8 +0,0 @@
|
|||
require 'test_helper'
|
||||
|
||||
class AlbumPicTest < ActiveSupport::TestCase
|
||||
# Replace this with your real tests.
|
||||
test "the truth" do
|
||||
assert true
|
||||
end
|
||||
end
|
|
@ -1,8 +0,0 @@
|
|||
require 'test_helper'
|
||||
|
||||
class ArtistsTest < ActiveSupport::TestCase
|
||||
# Replace this with your real tests.
|
||||
test "the truth" do
|
||||
assert true
|
||||
end
|
||||
end
|
|
@ -1,4 +0,0 @@
|
|||
require 'test_helper'
|
||||
|
||||
class ArtistHelperTest < ActionView::TestCase
|
||||
end
|
|
@ -1,4 +0,0 @@
|
|||
require 'test_helper'
|
||||
|
||||
class BotHelperTest < ActionView::TestCase
|
||||
end
|
|
@ -1,4 +0,0 @@
|
|||
require 'test_helper'
|
||||
|
||||
class MainHelperTest < ActionView::TestCase
|
||||
end
|
|
@ -1,4 +0,0 @@
|
|||
require 'test_helper'
|
||||
|
||||
class TrackHelperTest < ActionView::TestCase
|
||||
end
|
|
@ -1,8 +0,0 @@
|
|||
require 'test_helper'
|
||||
|
||||
class TrackDataTest < ActiveSupport::TestCase
|
||||
# Replace this with your real tests.
|
||||
test "the truth" do
|
||||
assert true
|
||||
end
|
||||
end
|
|
@ -1,8 +0,0 @@
|
|||
require 'test_helper'
|
||||
|
||||
class UserTest < ActiveSupport::TestCase
|
||||
# Replace this with your real tests.
|
||||
test "the truth" do
|
||||
assert true
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue