Compare commits
8 Commits
develop
...
feature/ja
| Author | SHA1 | Date |
|---|---|---|
|
|
ff5411f33e | |
|
|
ccec9abbc8 | |
|
|
4288ebe0d0 | |
|
|
7f32ccced4 | |
|
|
cde055ca0d | |
|
|
ea239ca9dc | |
|
|
73d211eb93 | |
|
|
852503ad2c |
|
|
@ -16,7 +16,6 @@ class JamRuby::JamTrack
|
||||||
end
|
end
|
||||||
|
|
||||||
def jmep_json_generate
|
def jmep_json_generate
|
||||||
self.genre_id = nil if self.genre_id == ''
|
|
||||||
self.licensor_id = nil if self.licensor_id == ''
|
self.licensor_id = nil if self.licensor_id == ''
|
||||||
self.jmep_json = nil if self.jmep_json == ''
|
self.jmep_json = nil if self.jmep_json == ''
|
||||||
self.time_signature = nil if self.time_signature == ''
|
self.time_signature = nil if self.time_signature == ''
|
||||||
|
|
|
||||||
|
|
@ -297,3 +297,4 @@ alter_genre_player_unique_constraint.sql
|
||||||
musician_search.sql
|
musician_search.sql
|
||||||
enhance_band_profile.sql
|
enhance_band_profile.sql
|
||||||
alter_band_profile_rate_defaults.sql
|
alter_band_profile_rate_defaults.sql
|
||||||
|
jam_track_onboarding_enhancements.sql
|
||||||
|
|
@ -0,0 +1,65 @@
|
||||||
|
UPDATE instruments SET id = 'double bass', description = 'Double Bass' WHERE id = 'upright bass';
|
||||||
|
INSERT INTO instruments (id, description, popularity) VALUES ('steel guitar', 'Steel Guitar', 1);
|
||||||
|
INSERT INTO instruments (id, description, popularity) VALUES ('orchestra', 'Orchestra', 1);
|
||||||
|
INSERT INTO instruments (id, description, popularity) VALUES ('glockenspiel', 'Glockenspiel', 1);
|
||||||
|
INSERT INTO instruments (id, description, popularity) VALUES ('dobro', 'Dobro', 1);
|
||||||
|
INSERT INTO instruments (id, description, popularity) VALUES ('harp', 'Harp', 1);
|
||||||
|
INSERT INTO instruments (id, description, popularity) VALUES ('vocoder', 'Vocoder', 1);
|
||||||
|
INSERT INTO instruments (id, description, popularity) VALUES ('flugelhorn', 'Flugelhorn', 1);
|
||||||
|
INSERT INTO instruments (id, description, popularity) VALUES ('timpani', 'Timpani', 1);
|
||||||
|
INSERT INTO instruments (id, description, popularity) VALUES ('bassoon', 'Bassoon', 1);
|
||||||
|
INSERT INTO instruments (id, description, popularity) VALUES ('charango', 'Charango', 1);
|
||||||
|
INSERT INTO instruments (id, description, popularity) VALUES ('theremin', 'Theremin', 1);
|
||||||
|
INSERT INTO instruments (id, description, popularity) VALUES ('sitar', 'Sitar', 1);
|
||||||
|
INSERT INTO instruments (id, description, popularity) VALUES ('piccolo', 'Piccolo', 1);
|
||||||
|
INSERT INTO instruments (id, description, popularity) VALUES ('bagpipes', 'Bagpipes', 1);
|
||||||
|
ALTER TABLE jam_tracks ADD COLUMN onboarding_exceptions JSON;
|
||||||
|
ALTER TABLE jam_track_tracks ADD COLUMN original_filename VARCHAR;
|
||||||
|
ALTER TABLE jam_tracks ADD COLUMN additional_info VARCHAR;
|
||||||
|
ALTER TABLE jam_tracks ADD COLUMN language VARCHAR NOT NULL DEFAULT 'eng';
|
||||||
|
ALTER TABLE jam_tracks ADD COLUMN year INTEGER;
|
||||||
|
ALTER TABLE jam_tracks ADD COLUMN vendor_id VARCHAR;
|
||||||
|
|
||||||
|
INSERT INTO jam_track_licensors (name, description) VALUES ('Tency Music', 'Tency Music is a music production company specialized in re-recordings.');
|
||||||
|
|
||||||
|
CREATE TABLE genres_jam_tracks (
|
||||||
|
id VARCHAR(64) PRIMARY KEY DEFAULT uuid_generate_v4(),
|
||||||
|
jam_track_id VARCHAR(64) NOT NULL REFERENCES jam_tracks(id) ON DELETE CASCADE,
|
||||||
|
genre_id VARCHAR(64) NOT NULL REFERENCES genres(id) ON DELETE CASCADE,
|
||||||
|
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
|
|
||||||
|
INSERT INTO genres_jam_tracks (jam_track_id, genre_id) ((SELECT jam_tracks.id, jam_tracks.genre_id FROM jam_tracks));
|
||||||
|
ALTER TABLE jam_tracks DROP COLUMN genre_id;
|
||||||
|
|
||||||
|
-- holds precount, click.wav, click.txt
|
||||||
|
CREATE TABLE jam_track_files (
|
||||||
|
id VARCHAR(64) PRIMARY KEY DEFAULT uuid_generate_v4(),
|
||||||
|
jam_track_id VARCHAR(64) REFERENCES jam_tracks(id) ON DELETE CASCADE,
|
||||||
|
file_type VARCHAR NOT NULL,
|
||||||
|
original_filename VARCHAR NOT NULL,
|
||||||
|
precount_num INTEGER,
|
||||||
|
url VARCHAR,
|
||||||
|
md5 VARCHAR,
|
||||||
|
length bigint,
|
||||||
|
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
|
|
||||||
|
INSERT INTO genres (id, description) VALUES ('soft rock', 'Soft Rock');
|
||||||
|
INSERT INTO genres (id, description) VALUES ('rap', 'Rap');
|
||||||
|
INSERT INTO genres (id, description) VALUES ('tv & movie soundtrack', 'TV & Movie Soundtrack');
|
||||||
|
INSERT INTO genres (id, description) VALUES ('holiday', 'Holiday');
|
||||||
|
INSERT INTO genres (id, description) VALUES ('kids', 'Kids');
|
||||||
|
INSERT INTO genres (id, description) VALUES ('disco', 'Disco');
|
||||||
|
INSERT INTO genres (id, description) VALUES ('soul', 'Soul');
|
||||||
|
INSERT INTO genres (id, description) VALUES ('hard rock', 'Hard Rock');
|
||||||
|
INSERT INTO genres (id, description) VALUES ('funk', 'Funk');
|
||||||
|
INSERT INTO genres (id, description) VALUES ('dance', 'Dance');
|
||||||
|
INSERT INTO genres (id, description) VALUES ('creole', 'Creole');
|
||||||
|
INSERT INTO genres (id, description) VALUES ('traditional', 'Traditional');
|
||||||
|
INSERT INTO genres (id, description) VALUES ('oldies', 'Oldies');
|
||||||
|
INSERT INTO genres (id, description) VALUES ('world', 'World');
|
||||||
|
INSERT INTO genres (id, description) VALUES ('musical', 'Musical');
|
||||||
|
INSERT INTO genres (id, description) VALUES ('celtic', 'Celtic');
|
||||||
|
|
@ -206,6 +206,8 @@ require "jam_ruby/models/jam_track"
|
||||||
require "jam_ruby/models/jam_track_track"
|
require "jam_ruby/models/jam_track_track"
|
||||||
require "jam_ruby/models/jam_track_right"
|
require "jam_ruby/models/jam_track_right"
|
||||||
require "jam_ruby/models/jam_track_tap_in"
|
require "jam_ruby/models/jam_track_tap_in"
|
||||||
|
require "jam_ruby/models/jam_track_file"
|
||||||
|
require "jam_ruby/models/genre_jam_track"
|
||||||
require "jam_ruby/app/mailers/async_mailer"
|
require "jam_ruby/app/mailers/async_mailer"
|
||||||
require "jam_ruby/app/mailers/batch_mailer"
|
require "jam_ruby/app/mailers/batch_mailer"
|
||||||
require "jam_ruby/app/mailers/progress_mailer"
|
require "jam_ruby/app/mailers/progress_mailer"
|
||||||
|
|
@ -238,6 +240,7 @@ require "jam_ruby/models/performance_sample"
|
||||||
require "jam_ruby/models/online_presence"
|
require "jam_ruby/models/online_presence"
|
||||||
require "jam_ruby/models/json_store"
|
require "jam_ruby/models/json_store"
|
||||||
require "jam_ruby/models/musician_search"
|
require "jam_ruby/models/musician_search"
|
||||||
|
require "jam_ruby/import/tency_stem_mapping"
|
||||||
|
|
||||||
include Jampb
|
include Jampb
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,360 @@
|
||||||
|
module JamRuby
|
||||||
|
|
||||||
|
# this is probably a one-off class used to map Tency-named stems into JamKazam-named stems
|
||||||
|
class TencyStemMapping
|
||||||
|
|
||||||
|
@@log = Logging.logger[TencyStemMapping]
|
||||||
|
|
||||||
|
def s3_manager
|
||||||
|
@s3_manager ||= S3Manager.new('jamkazam-tency', APP_CONFIG.aws_access_key_id, APP_CONFIG.aws_secret_access_key)
|
||||||
|
end
|
||||||
|
|
||||||
|
def initialize
|
||||||
|
@originals_folder = "/Volumes/sethcall/Dropbox/seth@jamkazam.com/JamTracks - Tency Music - Original Folder for Normalization Map"
|
||||||
|
@mapping_folder = "/Volumes/sethcall/Dropbox/seth@jamkazam.com/JamTracks - Tency Music"
|
||||||
|
@original_songs = {}
|
||||||
|
@mapping_songs = {}
|
||||||
|
@mappings = {}
|
||||||
|
end
|
||||||
|
|
||||||
|
def create_map
|
||||||
|
tency_originals
|
||||||
|
tency_maps
|
||||||
|
|
||||||
|
dump
|
||||||
|
end
|
||||||
|
|
||||||
|
def create_mapping_map
|
||||||
|
tency_maps
|
||||||
|
|
||||||
|
dump_map
|
||||||
|
end
|
||||||
|
|
||||||
|
def hydrate
|
||||||
|
@original_songs = YAML.load_file('original_songs.yml')
|
||||||
|
@mapping_songs = YAML.load_file('mapping_songs.yml')
|
||||||
|
end
|
||||||
|
|
||||||
|
def parse_sanitized_filename(filename)
|
||||||
|
instrument = nil
|
||||||
|
part = nil
|
||||||
|
|
||||||
|
basename = File.basename(filename)
|
||||||
|
stem = basename.index('Stem')
|
||||||
|
|
||||||
|
if stem
|
||||||
|
stripped = basename[(stem + 'Stem'.length)..-5] # takes of 'stem' and '.wav'
|
||||||
|
stripped.strip!
|
||||||
|
dash = stripped.index('-')
|
||||||
|
|
||||||
|
if dash == 0
|
||||||
|
stripped = stripped[1..-1].strip!
|
||||||
|
# now we should have something like "Vocal - Lead" (instrument - part)
|
||||||
|
instrument, part = stripped.split('-')
|
||||||
|
instrument.strip! if instrument
|
||||||
|
part.strip! if part
|
||||||
|
else
|
||||||
|
"no or misplaced dash for #{filename}"
|
||||||
|
end
|
||||||
|
|
||||||
|
else
|
||||||
|
raise "no stem for #{filename}"
|
||||||
|
end
|
||||||
|
|
||||||
|
[instrument, part]
|
||||||
|
end
|
||||||
|
|
||||||
|
# For all the tracks that I have labeled manually as
|
||||||
|
# Instrument = Upright Bass and Part = Upright Bass,
|
||||||
|
# can you please change both the Instrument and Part to Double Bass instead?
|
||||||
|
#
|
||||||
|
def check_mappings
|
||||||
|
missing_instrument = 0
|
||||||
|
missing_part = 0
|
||||||
|
part_names = []
|
||||||
|
|
||||||
|
hydrate
|
||||||
|
@mapping_songs.each do |cache_id, data|
|
||||||
|
mapped_filename = data[:filename]
|
||||||
|
@@log.debug("parsing #{mapped_filename}")
|
||||||
|
instrument, part = parse_sanitized_filename(mapped_filename)
|
||||||
|
@@log.debug("parsed #{instrument} (#{part})")
|
||||||
|
missing_instrument = missing_instrument + 1 unless instrument
|
||||||
|
missing_part = missing_part + 1 unless part
|
||||||
|
part_names << mapped_filename unless part
|
||||||
|
end
|
||||||
|
|
||||||
|
@@log.info("SUMMARY")
|
||||||
|
@@log.info("-------")
|
||||||
|
@@log.info("missing instruments:#{missing_instrument} missing parts: #{missing_part}")
|
||||||
|
@@log.info("files with no parts: #{part_names}")
|
||||||
|
|
||||||
|
# files with no parts:
|
||||||
|
# ["Huey Lewis And The News - Heart And Soul - 31957/Heart And Soul Stem - Synth 2.wav",
|
||||||
|
# "ZZ Top - Tush - 20852/Tush Stem - Clicktrack.wav",
|
||||||
|
# "Crosby Stills And Nash - Teach Your Children - 15440/Teach Your Children Stem - Bass Guitar.wav",
|
||||||
|
# /Brad Paisley - She's Everything - 19886/She's Everything Stem - Clicktrack.wav",
|
||||||
|
# "Toby Keith - Beer For My Horses - 7221/Beer For My Horses Stem - Lap Steel.wav",
|
||||||
|
# Toby Keith - Beer For My Horses - 7221/Beer For My Horses Stem - Acoustic Guitar.wav"
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def track_mapping(basename, instr_part)
|
||||||
|
instrument = instr_part[:instrument]
|
||||||
|
part = instr_part[:part]
|
||||||
|
|
||||||
|
basename.downcase!
|
||||||
|
|
||||||
|
info = @mappings[basename]
|
||||||
|
|
||||||
|
unless info
|
||||||
|
info = {matches:[]}
|
||||||
|
@mappings[basename] = info
|
||||||
|
end
|
||||||
|
|
||||||
|
info[:matches] << instr_part
|
||||||
|
end
|
||||||
|
|
||||||
|
def correlate
|
||||||
|
mapped = 0
|
||||||
|
unmapped = 0
|
||||||
|
unmapped_details = []
|
||||||
|
no_instrument = []
|
||||||
|
common_unknown_instruments = {}
|
||||||
|
|
||||||
|
hydrate
|
||||||
|
@mapping_songs.each do |cache_id, data|
|
||||||
|
# go through each track hand-mapped, and find it's matching song if any.
|
||||||
|
|
||||||
|
mapped_filename = data[:filename]
|
||||||
|
found_original = @original_songs[cache_id]
|
||||||
|
if found_original
|
||||||
|
# mapping made
|
||||||
|
|
||||||
|
original_filename = found_original[:filename]
|
||||||
|
original_basename = File.basename(original_filename).downcase
|
||||||
|
|
||||||
|
mapped = mapped + 1
|
||||||
|
|
||||||
|
instrument, part = parse_sanitized_filename(mapped_filename)
|
||||||
|
instr_part = JamTrackImporter.determine_instrument(instrument, part)
|
||||||
|
|
||||||
|
instr_part[:instrument]
|
||||||
|
|
||||||
|
if instr_part[:instrument]
|
||||||
|
|
||||||
|
# track the mapping of this one
|
||||||
|
track_mapping(original_basename, instr_part)
|
||||||
|
|
||||||
|
else
|
||||||
|
@@log.error("unable to determine instrument for #{File.basename(mapped_filename)}")
|
||||||
|
no_instrument << ({filename: File.basename(mapped_filename), instrument: instrument, part: part})
|
||||||
|
common_unknown_instruments["#{instrument}-(#{part})"] = 1
|
||||||
|
end
|
||||||
|
|
||||||
|
else
|
||||||
|
unmapped = unmapped + 1
|
||||||
|
unmapped_details << {filename: mapped_filename}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
puts("SUMMARY")
|
||||||
|
puts("-------")
|
||||||
|
puts("MAPPED:#{mapped} UNMAPPED:#{unmapped}")
|
||||||
|
unmapped_details.each do |unmapped_detail|
|
||||||
|
puts "UNMAPPED FILE: #{File.basename(unmapped_detail[:filename])}"
|
||||||
|
end
|
||||||
|
puts("UNKNOWN INSTRUMENT: #{no_instrument.length}")
|
||||||
|
no_instrument.each do |item|
|
||||||
|
puts("UNKNOWN INSTRUMENT: #{item[:filename]}")
|
||||||
|
end
|
||||||
|
common_unknown_instruments.each do |key, value|
|
||||||
|
puts("#{key}")
|
||||||
|
end
|
||||||
|
@mappings.each do |basename, mapping|
|
||||||
|
matches = mapping[:matches]
|
||||||
|
counts = matches.each_with_object(Hash.new(0)) { |word,counts| counts[word] += 1 }
|
||||||
|
ordered_matches = counts.sort_by {|k, v| -v}
|
||||||
|
output = ""
|
||||||
|
ordered_matches.each do |match|
|
||||||
|
detail = match[0]
|
||||||
|
count = match[1]
|
||||||
|
output << "#{detail[:instrument]}(#{detail[:part]})/#{count}, "
|
||||||
|
end
|
||||||
|
|
||||||
|
puts "map detail: #{basename}: #{output}"
|
||||||
|
|
||||||
|
mapping[:ordered] = ordered_matches
|
||||||
|
mapping[:detail] = output
|
||||||
|
end
|
||||||
|
CSV.open("mapping.csv", "wb") do |csv|
|
||||||
|
@mappings.each do |basename, mapping|
|
||||||
|
item = mapping[:ordered]
|
||||||
|
|
||||||
|
trust_worthy = item.length == 1
|
||||||
|
unless trust_worthy
|
||||||
|
# if the 1st item is at least 4 'counts' more than the next item, we can consider it trust_worthy
|
||||||
|
if item[0][1] - 4 > item[1][1]
|
||||||
|
trust_worthy = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
csv << [ basename, item[0][0][:instrument], item[0][0][:part], item[0][1], trust_worthy ]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
CSV.open("determinate-single-matches.csv", "wb") do |csv|
|
||||||
|
@mappings.each do |basename, mapping|
|
||||||
|
if mapping[:ordered].length == 1 && mapping[:ordered][0][1] == 1
|
||||||
|
item = mapping[:ordered]
|
||||||
|
csv << [ basename, item[0][0][:instrument], item[0][0][:part], item[0][1] ]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
CSV.open("determinate-multi-matches.csv", "wb") do |csv|
|
||||||
|
@mappings.each do |basename, mapping|
|
||||||
|
if mapping[:ordered].length == 1 && mapping[:ordered][0][1] > 1
|
||||||
|
item = mapping[:ordered]
|
||||||
|
csv << [ basename, item[0][0][:instrument], item[0][0][:part], item[0][1] ]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
CSV.open("ambiguous-matches.csv", "wb") do |csv|
|
||||||
|
@mappings.each do |basename, mapping|
|
||||||
|
if mapping[:ordered].length > 1
|
||||||
|
csv << [ basename, mapping[:detail] ]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def dump
|
||||||
|
File.open('original_songs.yml', 'w') {|f| f.write(YAML.dump(@original_songs)) }
|
||||||
|
File.open('mapping_songs.yml', 'w') {|f| f.write(YAML.dump(@mapping_songs)) }
|
||||||
|
end
|
||||||
|
def dump_map
|
||||||
|
File.open('mapping_songs.yml', 'w') {|f| f.write(YAML.dump(@mapping_songs)) }
|
||||||
|
end
|
||||||
|
|
||||||
|
def md5(filepath)
|
||||||
|
Digest::MD5.file(filepath).hexdigest
|
||||||
|
end
|
||||||
|
|
||||||
|
def tency_original_check
|
||||||
|
songs = Pathname.new(@originals_folder).children.select { |c| c.directory? }
|
||||||
|
songs.each do |song|
|
||||||
|
dirs = Pathname.new(song).children.select {|c| c.directory? }
|
||||||
|
|
||||||
|
@@log.debug "SONG #{song}"
|
||||||
|
dirs.each do |dir|
|
||||||
|
@@log.debug "#{dir.basename.to_s}"
|
||||||
|
end
|
||||||
|
@@log.debug ""
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def tency_originals
|
||||||
|
songs = Pathname.new(@originals_folder).children.select { |c| c.directory? }
|
||||||
|
songs.each do |filename|
|
||||||
|
id = parse_id(filename.basename.to_s )
|
||||||
|
files = Pathname.new(filename).children.select {|c| c.file? }
|
||||||
|
|
||||||
|
# also look into any 1st level folders we might find
|
||||||
|
|
||||||
|
dirs = Pathname.new(filename).children.select {|c| c.directory? }
|
||||||
|
dirs.each do |dir|
|
||||||
|
more_tracks = Pathname.new(dir).children.select {|c| c.file? }
|
||||||
|
files = files + more_tracks
|
||||||
|
end
|
||||||
|
|
||||||
|
files.each do |file|
|
||||||
|
@@log.debug("processing original track #{file.to_s}")
|
||||||
|
md5 = md5(file.to_s)
|
||||||
|
song = {md5:md5, filename:file.to_s, id:id}
|
||||||
|
@original_songs[cache_id(id, md5)] = song
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def tency_maps
|
||||||
|
songs = Pathname.new(@mapping_folder).children.select { |c| c.directory? }
|
||||||
|
songs.each do |song_filename|
|
||||||
|
id = parse_id_mapped(song_filename.basename.to_s )
|
||||||
|
@@log.debug "processing song #{song_filename.to_s}"
|
||||||
|
|
||||||
|
tracks = Pathname.new(song_filename).children.select {|c| c.file? }
|
||||||
|
tracks.each do |track|
|
||||||
|
if track.to_s.include? "Stem"
|
||||||
|
@@log.debug("processing mapped track #{track.to_s}")
|
||||||
|
md5 = md5(track.to_s)
|
||||||
|
|
||||||
|
song = {md5:md5, filename:track.to_s}
|
||||||
|
@mapping_songs[cache_id(id, md5)] = song
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def cache_id(id, md5)
|
||||||
|
"#{id}-#{md5}"
|
||||||
|
end
|
||||||
|
|
||||||
|
def parse_id(filename)
|
||||||
|
#amy-winehouse_you-know-i-m-no-good-feat-ghostface-killah_11767
|
||||||
|
|
||||||
|
index = filename.rindex('_')
|
||||||
|
if index
|
||||||
|
id = filename[(index + 1)..-1]
|
||||||
|
|
||||||
|
if id.end_with?('/')
|
||||||
|
id = id[0...-1]
|
||||||
|
end
|
||||||
|
|
||||||
|
id = id.to_i
|
||||||
|
|
||||||
|
if id == 0
|
||||||
|
raise "no valid ID in filename: #{filename}"
|
||||||
|
end
|
||||||
|
else
|
||||||
|
raise "no _ in filename: #{filename}"
|
||||||
|
end
|
||||||
|
id
|
||||||
|
end
|
||||||
|
|
||||||
|
def parse_id_mapped(filename)
|
||||||
|
#Flyleaf - I'm So Sick - 15771
|
||||||
|
|
||||||
|
index = filename.rindex('-')
|
||||||
|
if index
|
||||||
|
id = filename[(index + 1)..-1]
|
||||||
|
|
||||||
|
if id.end_with?('/')
|
||||||
|
id = id[0...-1]
|
||||||
|
end
|
||||||
|
|
||||||
|
id.strip!
|
||||||
|
|
||||||
|
id = id.to_i
|
||||||
|
|
||||||
|
if id == 0
|
||||||
|
raise "no valid ID in filename: #{filename}"
|
||||||
|
end
|
||||||
|
else
|
||||||
|
raise "no - in filename: #{filename}"
|
||||||
|
end
|
||||||
|
id
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def tency_originals2
|
||||||
|
s3_manager.list_directories('mapper').each do |song_folder|
|
||||||
|
@@log.debug("searching through tency directory. song folder:'#{song_folder}'")
|
||||||
|
|
||||||
|
id = parse_id(song_folder)
|
||||||
|
@@log.debug("ID #{id}")
|
||||||
|
|
||||||
|
top_folder = s3_manager.list_directories(song_folder)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -16,7 +16,8 @@ module JamRuby
|
||||||
has_and_belongs_to_many :recordings, :class_name => "JamRuby::Recording", :join_table => "recordings_genres"
|
has_and_belongs_to_many :recordings, :class_name => "JamRuby::Recording", :join_table => "recordings_genres"
|
||||||
|
|
||||||
# jam tracks
|
# jam tracks
|
||||||
has_many :jam_tracks, :class_name => "JamRuby::JamTrack"
|
has_many :genres_jam_tracks, :class_name => "JamRuby::GenreJamTrack", :foreign_key => "genre_id"
|
||||||
|
has_many :jam_tracks, :through => :genres_jam_tracks, :class_name => "JamRuby::JamTrack", :source => :genre
|
||||||
|
|
||||||
def to_s
|
def to_s
|
||||||
description
|
description
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
module JamRuby
|
||||||
|
class GenreJamTrack < ActiveRecord::Base
|
||||||
|
|
||||||
|
self.table_name = 'genres_jam_tracks'
|
||||||
|
belongs_to :jam_track, class_name: 'JamRuby::JamTrack'
|
||||||
|
belongs_to :genre, class_name: 'JamRuby::Genre'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -14,7 +14,7 @@ module JamRuby
|
||||||
|
|
||||||
attr_accessor :uploading_preview
|
attr_accessor :uploading_preview
|
||||||
attr_accessible :name, :description, :bpm, :time_signature, :status, :recording_type,
|
attr_accessible :name, :description, :bpm, :time_signature, :status, :recording_type,
|
||||||
:original_artist, :songwriter, :publisher, :licensor, :licensor_id, :pro, :genre, :genre_id, :sales_region, :price,
|
:original_artist, :songwriter, :publisher, :licensor, :licensor_id, :pro, :genres_jam_tracks_attributes, :sales_region, :price,
|
||||||
:reproduction_royalty, :public_performance_royalty, :reproduction_royalty_amount,
|
:reproduction_royalty, :public_performance_royalty, :reproduction_royalty_amount,
|
||||||
:licensor_royalty_amount, :pro_royalty_amount, :plan_code, :initial_play_silence, :jam_track_tracks_attributes,
|
:licensor_royalty_amount, :pro_royalty_amount, :plan_code, :initial_play_silence, :jam_track_tracks_attributes,
|
||||||
:jam_track_tap_ins_attributes, :version, :jmep_json, :jmep_text, :pro_ascap, :pro_bmi, :pro_sesac, :duration, as: :admin
|
:jam_track_tap_ins_attributes, :version, :jmep_json, :jmep_text, :pro_ascap, :pro_bmi, :pro_sesac, :duration, as: :admin
|
||||||
|
|
@ -39,14 +39,17 @@ module JamRuby
|
||||||
validates :public_performance_royalty, inclusion: {in: [nil, true, false]}
|
validates :public_performance_royalty, inclusion: {in: [nil, true, false]}
|
||||||
validates :duration, numericality: {only_integer: true}, :allow_nil => true
|
validates :duration, numericality: {only_integer: true}, :allow_nil => true
|
||||||
|
|
||||||
validates_format_of :reproduction_royalty_amount, with: /^\d+\.*\d{0,3}$/
|
validates_format_of :reproduction_royalty_amount, with: /^\d+\.*\d{0,4}$/, :allow_blank => true
|
||||||
validates_format_of :licensor_royalty_amount, with: /^\d+\.*\d{0,3}$/
|
validates_format_of :licensor_royalty_amount, with: /^\d+\.*\d{0,4}$/, :allow_blank => true
|
||||||
|
|
||||||
belongs_to :genre, class_name: "JamRuby::Genre"
|
|
||||||
belongs_to :licensor , class_name: 'JamRuby::JamTrackLicensor', foreign_key: 'licensor_id'
|
belongs_to :licensor , class_name: 'JamRuby::JamTrackLicensor', foreign_key: 'licensor_id'
|
||||||
|
|
||||||
|
has_many :genres_jam_tracks, :class_name => "JamRuby::GenreJamTrack", :foreign_key => "jam_track_id"
|
||||||
|
has_many :genres, :through => :genres_jam_tracks, :class_name => "JamRuby::Genre", :source => :genre
|
||||||
|
|
||||||
has_many :jam_track_tracks, :class_name => "JamRuby::JamTrackTrack", order: 'track_type ASC, position ASC, part ASC, instrument_id ASC'
|
has_many :jam_track_tracks, :class_name => "JamRuby::JamTrackTrack", order: 'track_type ASC, position ASC, part ASC, instrument_id ASC'
|
||||||
has_many :jam_track_tap_ins, :class_name => "JamRuby::JamTrackTapIn", order: 'offset_time ASC'
|
has_many :jam_track_tap_ins, :class_name => "JamRuby::JamTrackTapIn", order: 'offset_time ASC'
|
||||||
|
has_many :jam_track_files, :class_name => "JamRuby::JamTrackFile"
|
||||||
|
|
||||||
has_many :jam_track_rights, :class_name => "JamRuby::JamTrackRight" #, inverse_of: 'jam_track', :foreign_key => "jam_track_id" # '
|
has_many :jam_track_rights, :class_name => "JamRuby::JamTrackRight" #, inverse_of: 'jam_track', :foreign_key => "jam_track_id" # '
|
||||||
|
|
||||||
|
|
@ -67,6 +70,82 @@ module JamRuby
|
||||||
accepts_nested_attributes_for :jam_track_tracks, allow_destroy: true
|
accepts_nested_attributes_for :jam_track_tracks, allow_destroy: true
|
||||||
accepts_nested_attributes_for :jam_track_tap_ins, allow_destroy: true
|
accepts_nested_attributes_for :jam_track_tap_ins, allow_destroy: true
|
||||||
|
|
||||||
|
|
||||||
|
# we can make sure a few things stay in sync here.
|
||||||
|
# 1) the reproduction_royalty_amount has to stay in sync based on duration
|
||||||
|
# 2) the onboarding_exceptions JSON column
|
||||||
|
after_save :sync_reproduction_royalty
|
||||||
|
after_save :sync_onboarding_exceptions
|
||||||
|
|
||||||
|
|
||||||
|
def sync_reproduction_royalty
|
||||||
|
|
||||||
|
# reproduction royalty table based on duration
|
||||||
|
|
||||||
|
# The statutory mechanical royalty rate for permanent digital downloads is:
|
||||||
|
# 9.10¢ per copy for songs 5 minutes or less, or
|
||||||
|
# 1.75¢ per minute or fraction thereof, per copy for songs over 5 minutes.
|
||||||
|
# So the base rate is 9.1 cents for anything up to 5 minutes.
|
||||||
|
# 5.01 to 6 minutes should be 10.5 cents.
|
||||||
|
# 6.01 to 7 minutes should be 12.25 cents.
|
||||||
|
# Etc.
|
||||||
|
|
||||||
|
royalty = nil
|
||||||
|
if self.duration
|
||||||
|
minutes = (self.duration - 1) / 60
|
||||||
|
extra_minutes = minutes - 4
|
||||||
|
extra_minutes = 0 if extra_minutes < 0
|
||||||
|
royalty = (0.091 + (0.0175 * extra_minutes)).round(5)
|
||||||
|
end
|
||||||
|
self.update_column(:reproduction_royalty_amount, royalty)
|
||||||
|
|
||||||
|
true
|
||||||
|
end
|
||||||
|
|
||||||
|
def sync_onboarding_exceptions
|
||||||
|
|
||||||
|
exceptions = {}
|
||||||
|
if self.duration.nil?
|
||||||
|
exceptions[:no_duration] = true
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.genres.count == 0
|
||||||
|
exceptions[:no_genres] = true
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.year.nil?
|
||||||
|
exceptions[:no_year] = true
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.licensor.nil?
|
||||||
|
exceptions[:no_licensor] = true
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.missing_instrument_info?
|
||||||
|
exceptions[:unknown_instrument] = true
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.master_track.nil?
|
||||||
|
exceptions[:no_master] = true
|
||||||
|
end
|
||||||
|
|
||||||
|
if missing_previews?
|
||||||
|
exceptions[:missing_previews] = true
|
||||||
|
end
|
||||||
|
|
||||||
|
if duplicate_positions?
|
||||||
|
exceptions[:duplicate_positions] = true
|
||||||
|
end
|
||||||
|
|
||||||
|
if exceptions.keys.length == 0
|
||||||
|
self.update_column(:onboarding_exceptions, nil)
|
||||||
|
else
|
||||||
|
self.update_column(:onboarding_exceptions, exceptions.to_json)
|
||||||
|
end
|
||||||
|
|
||||||
|
true
|
||||||
|
end
|
||||||
|
|
||||||
def duplicate_positions?
|
def duplicate_positions?
|
||||||
counter = {}
|
counter = {}
|
||||||
jam_track_tracks.each do |track|
|
jam_track_tracks.each do |track|
|
||||||
|
|
@ -87,6 +166,17 @@ module JamRuby
|
||||||
duplicate
|
duplicate
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def missing_instrument_info?
|
||||||
|
missing_instrument_info = false
|
||||||
|
self.jam_track_tracks.each do |track|
|
||||||
|
if track.instrument_id == 'other' && (track.part == nil || track.part.start_with?('Other'))
|
||||||
|
missing_instrument_info = true
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
missing_instrument_info
|
||||||
|
end
|
||||||
|
|
||||||
def missing_previews?
|
def missing_previews?
|
||||||
missing_preview = false
|
missing_preview = false
|
||||||
self.jam_track_tracks.each do |track|
|
self.jam_track_tracks.each do |track|
|
||||||
|
|
@ -171,7 +261,7 @@ module JamRuby
|
||||||
end
|
end
|
||||||
|
|
||||||
if options[:group_artist]
|
if options[:group_artist]
|
||||||
query = query.select("original_artist, array_agg(jam_tracks.id) AS id, MIN(name) AS name, MIN(description) AS description, MIN(recording_type) AS recording_type, MIN(original_artist) AS original_artist, MIN(songwriter) AS songwriter, MIN(publisher) AS publisher, MIN(sales_region) AS sales_region, MIN(price) AS price, MIN(version) AS version, MIN(genre_id) AS genre_id")
|
query = query.select("original_artist, array_agg(jam_tracks.id) AS id, MIN(name) AS name, MIN(description) AS description, MIN(recording_type) AS recording_type, MIN(original_artist) AS original_artist, MIN(songwriter) AS songwriter, MIN(publisher) AS publisher, MIN(sales_region) AS sales_region, MIN(price) AS price, MIN(version) AS version")
|
||||||
query = query.group("original_artist")
|
query = query.group("original_artist")
|
||||||
query = query.order('jam_tracks.original_artist')
|
query = query.order('jam_tracks.original_artist')
|
||||||
else
|
else
|
||||||
|
|
@ -180,7 +270,12 @@ module JamRuby
|
||||||
end
|
end
|
||||||
|
|
||||||
query = query.where("jam_tracks.status = ?", 'Production') unless user.admin
|
query = query.where("jam_tracks.status = ?", 'Production') unless user.admin
|
||||||
query = query.where("jam_tracks.genre_id = '#{options[:genre]}'") unless options[:genre].blank?
|
|
||||||
|
unless options[:genre].blank?
|
||||||
|
query = query.joins(:genres)
|
||||||
|
query = query.where('genre_id = ? ', options[:genre])
|
||||||
|
end
|
||||||
|
|
||||||
query = query.where("jam_track_tracks.instrument_id = '#{options[:instrument]}' and jam_track_tracks.track_type != 'Master'") unless options[:instrument].blank?
|
query = query.where("jam_track_tracks.instrument_id = '#{options[:instrument]}' and jam_track_tracks.track_type != 'Master'") unless options[:instrument].blank?
|
||||||
query = query.where("jam_tracks.sales_region = '#{options[:availability]}'") unless options[:availability].blank?
|
query = query.where("jam_tracks.sales_region = '#{options[:availability]}'") unless options[:availability].blank?
|
||||||
|
|
||||||
|
|
@ -231,7 +326,12 @@ module JamRuby
|
||||||
query = query.order('jam_tracks.original_artist')
|
query = query.order('jam_tracks.original_artist')
|
||||||
|
|
||||||
query = query.where("jam_tracks.status = ?", 'Production') unless user.admin
|
query = query.where("jam_tracks.status = ?", 'Production') unless user.admin
|
||||||
query = query.where("jam_tracks.genre_id = '#{options[:genre]}'") unless options[:genre].blank?
|
|
||||||
|
unless options[:genre].blank?
|
||||||
|
query = query.joins(:genres)
|
||||||
|
query = query.where('genre_id = ? ', options[:genre])
|
||||||
|
end
|
||||||
|
|
||||||
query = query.where("jam_track_tracks.instrument_id = '#{options[:instrument]}'") unless options[:instrument].blank?
|
query = query.where("jam_track_tracks.instrument_id = '#{options[:instrument]}'") unless options[:instrument].blank?
|
||||||
query = query.where("jam_tracks.sales_region = '#{options[:availability]}'") unless options[:availability].blank?
|
query = query.where("jam_tracks.sales_region = '#{options[:availability]}'") unless options[:availability].blank?
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,78 @@
|
||||||
|
module JamRuby
|
||||||
|
|
||||||
|
# holds a click track or precount file
|
||||||
|
class JamTrackFile < ActiveRecord::Base
|
||||||
|
include JamRuby::S3ManagerMixin
|
||||||
|
|
||||||
|
# there should only be one Master per JamTrack, but there can be N Track per JamTrack
|
||||||
|
FILE_TYPE = %w{ClickWav ClickTxt Precount}
|
||||||
|
|
||||||
|
@@log = Logging.logger[JamTrackFile]
|
||||||
|
|
||||||
|
before_destroy :delete_s3_files
|
||||||
|
|
||||||
|
attr_accessible :jam_track_id, :file_type, :filename, as: :admin
|
||||||
|
attr_accessible :url, :md5, :length, as: :admin
|
||||||
|
|
||||||
|
attr_accessor :original_audio_s3_path, :skip_uploader, :preview_generate_error
|
||||||
|
|
||||||
|
before_destroy :delete_s3_files
|
||||||
|
|
||||||
|
validates :file_type, inclusion: {in: FILE_TYPE }
|
||||||
|
|
||||||
|
belongs_to :jam_track, class_name: "JamRuby::JamTrack"
|
||||||
|
|
||||||
|
# create storage directory that will house this jam_track, as well as
|
||||||
|
def store_dir
|
||||||
|
"jam_track_files"
|
||||||
|
end
|
||||||
|
|
||||||
|
# create name of the file
|
||||||
|
def filename(original_name)
|
||||||
|
"#{store_dir}/#{jam_track.original_artist}/#{jam_track.name}/#{original_name}"
|
||||||
|
end
|
||||||
|
|
||||||
|
def manually_uploaded_filename
|
||||||
|
if click_wav?
|
||||||
|
filename('click.wav')
|
||||||
|
elsif click_txt?
|
||||||
|
filename('click.txt')
|
||||||
|
elsif precount?
|
||||||
|
filename('precount.wav')
|
||||||
|
else
|
||||||
|
raise 'unknown file type: ' + file_type
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def click_wav?
|
||||||
|
track_type == 'ClickWav'
|
||||||
|
end
|
||||||
|
|
||||||
|
def click_txt?
|
||||||
|
track_type == 'ClickTxt'
|
||||||
|
end
|
||||||
|
|
||||||
|
def precount?
|
||||||
|
track_type == 'Precount'
|
||||||
|
end
|
||||||
|
|
||||||
|
# creates a short-lived URL that has access to the object.
|
||||||
|
# the idea is that this is used when a user who has the rights to this tries to download this JamTrack
|
||||||
|
# we would verify their rights (can_download?), and generates a URL in response to the click so that they can download
|
||||||
|
# but the url is short lived enough so that it wouldn't be easily shared
|
||||||
|
def sign_url(expiration_time = 120)
|
||||||
|
s3_manager.sign_url(self[url], {:expires => expiration_time, :response_content_type => 'audio/wav', :secure => true})
|
||||||
|
end
|
||||||
|
|
||||||
|
def can_download?(user)
|
||||||
|
# I think we have to make a special case for 'previews', but maybe that's just up to the controller to not check can_download?
|
||||||
|
jam_track.owners.include?(user)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
def delete_s3_files
|
||||||
|
s3_manager.delete(self[:url]) if self[:url] && s3_manager.exists?(self[:url])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -131,22 +131,36 @@ module JamRuby
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def generate_preview
|
def generate_preview
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Dir.mktmpdir do |tmp_dir|
|
Dir.mktmpdir do |tmp_dir|
|
||||||
|
|
||||||
input = File.join(tmp_dir, 'in.ogg')
|
input = File.join(tmp_dir, 'in.ogg')
|
||||||
output = File.join(tmp_dir, 'out.ogg')
|
|
||||||
output_mp3 = File.join(tmp_dir, 'out.mp3')
|
|
||||||
|
|
||||||
start = self.preview_start_time.to_f / 1000
|
|
||||||
stop = start + 20
|
|
||||||
|
|
||||||
raise 'no track' unless self["url_44"]
|
raise 'no track' unless self["url_44"]
|
||||||
|
|
||||||
s3_manager.download(self.url_by_sample_rate(44), input)
|
s3_manager.download(self.url_by_sample_rate(44), input)
|
||||||
|
|
||||||
|
process_preview(input, tmp_dir)
|
||||||
|
end
|
||||||
|
rescue Exception => e
|
||||||
|
@@log.error("error in sox command #{e.to_s}")
|
||||||
|
@preview_generate_error = e.to_s
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
# input is the original ogg file for the track. tmp_dir is where this code can safely generate output stuff and have it cleaned up later
|
||||||
|
def process_preview(input, tmp_dir)
|
||||||
|
uuid = SecureRandom.uuid
|
||||||
|
output = File.join(tmp_dir, "#{uuid}.ogg")
|
||||||
|
output_mp3 = File.join(tmp_dir, "#{uuid}.mp3")
|
||||||
|
|
||||||
|
start = self.preview_start_time.to_f / 1000
|
||||||
|
stop = start + 20
|
||||||
|
|
||||||
command = "sox \"#{input}\" \"#{output}\" trim #{sprintf("%.3f", start)} =#{sprintf("%.3f", stop)}"
|
command = "sox \"#{input}\" \"#{output}\" trim #{sprintf("%.3f", start)} =#{sprintf("%.3f", stop)}"
|
||||||
|
|
||||||
@@log.debug("trimming using: " + command)
|
@@log.debug("trimming using: " + command)
|
||||||
|
|
@ -207,12 +221,6 @@ module JamRuby
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
rescue Exception => e
|
|
||||||
@@log.error("error in sox command #{e.to_s}")
|
|
||||||
@preview_generate_error = e.to_s
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
||||||
|
|
@ -740,7 +740,7 @@ FactoryGirl.define do
|
||||||
licensor_royalty_amount 0.999
|
licensor_royalty_amount 0.999
|
||||||
sequence(:plan_code) { |n| "jamtrack-#{n}" }
|
sequence(:plan_code) { |n| "jamtrack-#{n}" }
|
||||||
|
|
||||||
genre JamRuby::Genre.first
|
genres [JamRuby::Genre.first]
|
||||||
association :licensor, factory: :jam_track_licensor
|
association :licensor, factory: :jam_track_licensor
|
||||||
|
|
||||||
factory :jam_track_with_tracks do
|
factory :jam_track_with_tracks do
|
||||||
|
|
|
||||||
|
|
@ -22,11 +22,13 @@ describe JamTrackImporter do
|
||||||
in_directory_with_file(metafile)
|
in_directory_with_file(metafile)
|
||||||
|
|
||||||
before(:each) do
|
before(:each) do
|
||||||
|
JamTrackImporter.storage_format = 'default'
|
||||||
content_for_file(YAML.dump(sample_yml))
|
content_for_file(YAML.dump(sample_yml))
|
||||||
end
|
end
|
||||||
|
|
||||||
it "no meta" do
|
it "no meta" do
|
||||||
s3_metalocation = 'audio/Artist 1/Bogus Place/meta.yml'
|
s3_metalocation = 'audio/Artist 1/Bogus Place/meta.yml'
|
||||||
|
JamTrackImporter.storage_format = 'default'
|
||||||
JamTrackImporter.load_metalocation(s3_metalocation).should be_nil
|
JamTrackImporter.load_metalocation(s3_metalocation).should be_nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -38,9 +40,105 @@ describe JamTrackImporter do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "sort_tracks" do
|
||||||
|
let(:jam_track) { FactoryGirl.create(:jam_track) }
|
||||||
|
let(:importer) { JamTrackImporter.new() }
|
||||||
|
let(:vocal) {Instrument.find('voice')}
|
||||||
|
let(:drums) {Instrument.find('drums')}
|
||||||
|
let(:bass_guitar) {Instrument.find('bass guitar')}
|
||||||
|
let(:piano) {Instrument.find('piano')}
|
||||||
|
let(:keyboard) {Instrument.find('keyboard')}
|
||||||
|
let(:acoustic_guitar) {Instrument.find('acoustic guitar')}
|
||||||
|
let(:electric_guitar) {Instrument.find('electric guitar')}
|
||||||
|
let(:other) {Instrument.find('other')}
|
||||||
|
|
||||||
|
it "the big sort" do
|
||||||
|
# specified in https://jamkazam.atlassian.net/browse/VRFS-3296
|
||||||
|
vocal_lead = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: vocal, part: 'Lead')
|
||||||
|
vocal_lead_female = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: vocal, part: 'Lead Female')
|
||||||
|
vocal_lead_male = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: vocal, part: 'Lead Male')
|
||||||
|
vocal_backing = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: vocal, part: 'Backing')
|
||||||
|
vocal_random = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: vocal, part: 'Random')
|
||||||
|
drums_drums = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: drums, part: 'Drums')
|
||||||
|
drums_percussion = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: drums, part: 'Percussion')
|
||||||
|
drums_random_1 = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: drums, part: 'A')
|
||||||
|
drums_random_2 = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: drums, part: 'C')
|
||||||
|
bass_guitar_bass = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: bass_guitar, part: 'Bass')
|
||||||
|
bass_guitar_random_1 = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: bass_guitar, part: 'some bass')
|
||||||
|
bass_guitar_random_2 = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: bass_guitar, part: 'zome bass')
|
||||||
|
piano_piano = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: piano, part: 'Piano')
|
||||||
|
keyboard_synth_1 = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: keyboard, part: 'Synth 1')
|
||||||
|
keyboard_synth_2 = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: keyboard, part: 'Synth 2')
|
||||||
|
keyboard_pads = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: keyboard, part: 'Pads')
|
||||||
|
keyboard_random_1 = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: keyboard, part: 'A')
|
||||||
|
keyboard_random_2 = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: keyboard, part: 'Z')
|
||||||
|
acoust_guitar_lead = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: acoustic_guitar, part: 'Lead')
|
||||||
|
acoust_guitar_lead_x = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: acoustic_guitar, part: 'Lead X')
|
||||||
|
acoust_guitar_solo_1 = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: acoustic_guitar, part: 'Solo 1')
|
||||||
|
acoust_guitar_solo_2 = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: acoustic_guitar, part: 'Solo 2')
|
||||||
|
acoust_guitar_rhythm = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: acoustic_guitar, part: 'Rhythm')
|
||||||
|
acoust_guitar_random_1 = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: acoustic_guitar, part: 'A')
|
||||||
|
acoust_guitar_random_2 = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: acoustic_guitar, part: 'Z')
|
||||||
|
elect_guitar_lead = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: electric_guitar, part: 'Lead')
|
||||||
|
elect_guitar_lead_x = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: electric_guitar, part: 'Lead X')
|
||||||
|
elect_guitar_solo_1 = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: electric_guitar, part: 'Solo 1')
|
||||||
|
elect_guitar_solo_2 = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: electric_guitar, part: 'Solo 2')
|
||||||
|
elect_guitar_rhythm = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: electric_guitar, part: 'Rhythm')
|
||||||
|
elect_guitar_random_1 = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: electric_guitar, part: 'A')
|
||||||
|
elect_guitar_random_2 = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: electric_guitar, part: 'Z')
|
||||||
|
other_1 = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: other, part: 'Other 1')
|
||||||
|
other_2 = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: other, part: 'Other 2')
|
||||||
|
|
||||||
|
expected = [
|
||||||
|
vocal_lead,
|
||||||
|
vocal_lead_female,
|
||||||
|
vocal_lead_male,
|
||||||
|
vocal_backing,
|
||||||
|
vocal_random,
|
||||||
|
drums_drums,
|
||||||
|
drums_percussion,
|
||||||
|
drums_random_1,
|
||||||
|
drums_random_2,
|
||||||
|
bass_guitar_bass,
|
||||||
|
piano_piano,
|
||||||
|
keyboard_synth_1,
|
||||||
|
keyboard_synth_2,
|
||||||
|
keyboard_pads,
|
||||||
|
keyboard_random_1,
|
||||||
|
keyboard_random_2,
|
||||||
|
acoust_guitar_lead,
|
||||||
|
acoust_guitar_lead_x,
|
||||||
|
acoust_guitar_rhythm,
|
||||||
|
acoust_guitar_random_1,
|
||||||
|
acoust_guitar_solo_1,
|
||||||
|
acoust_guitar_solo_2,
|
||||||
|
acoust_guitar_random_2,
|
||||||
|
elect_guitar_lead,
|
||||||
|
elect_guitar_lead_x,
|
||||||
|
elect_guitar_solo_1,
|
||||||
|
elect_guitar_solo_2,
|
||||||
|
elect_guitar_rhythm,
|
||||||
|
elect_guitar_random_1,
|
||||||
|
elect_guitar_random_2,
|
||||||
|
bass_guitar_random_1,
|
||||||
|
bass_guitar_random_2,
|
||||||
|
other_1,
|
||||||
|
other_2
|
||||||
|
]
|
||||||
|
shuffled = expected.shuffle
|
||||||
|
sorted_tracks = importer.sort_tracks(shuffled)
|
||||||
|
|
||||||
|
importer.set_custom_weight(vocal_lead).should eq(100)
|
||||||
|
|
||||||
|
expected.each_with_index do |expected_track, i|
|
||||||
|
sorted_tracks[i].should eq(expected_track)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe "synchronize" do
|
describe "synchronize" do
|
||||||
let(:jam_track) { JamTrack.new }
|
let(:jam_track) { JamTrack.new }
|
||||||
let(:importer) { JamTrackImporter.new }
|
let(:importer) { JamTrackImporter.new() }
|
||||||
let(:minimum_meta) { nil }
|
let(:minimum_meta) { nil }
|
||||||
let(:metalocation) { 'audio/Artist 1/Song 1/meta.yml' }
|
let(:metalocation) { 'audio/Artist 1/Song 1/meta.yml' }
|
||||||
let(:options) {{ skip_audio_upload:true }}
|
let(:options) {{ skip_audio_upload:true }}
|
||||||
|
|
@ -64,7 +162,7 @@ describe JamTrackImporter do
|
||||||
|
|
||||||
describe "parse_wav" do
|
describe "parse_wav" do
|
||||||
it "Guitar" do
|
it "Guitar" do
|
||||||
result = JamTrackImporter.new.parse_wav('blah/Ready for Love Stem - Guitar - Main.wav')
|
result = JamTrackImporter.new.parse_file('blah/Ready for Love Stem - Guitar - Main.wav')
|
||||||
result[:instrument].should eq('electric guitar')
|
result[:instrument].should eq('electric guitar')
|
||||||
result[:part].should eq('Main')
|
result[:part].should eq('Main')
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,90 @@ describe JamTrack do
|
||||||
jam_track = FactoryGirl.create(:jam_track)
|
jam_track = FactoryGirl.create(:jam_track)
|
||||||
jam_track.licensor.should_not be_nil
|
jam_track.licensor.should_not be_nil
|
||||||
jam_track.licensor.jam_tracks.should == [jam_track]
|
jam_track.licensor.jam_tracks.should == [jam_track]
|
||||||
|
jam_track.genres.length.should eq(1)
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'sync_reproduction_royalty' do
|
||||||
|
it "all possible conditions" do
|
||||||
|
jam_track = FactoryGirl.create(:jam_track)
|
||||||
|
jam_track.reproduction_royalty_amount.should be_nil
|
||||||
|
|
||||||
|
jam_track.duration = 0
|
||||||
|
jam_track.save!
|
||||||
|
jam_track.reproduction_royalty_amount.to_f.should eq(0.091)
|
||||||
|
|
||||||
|
jam_track.duration = 1
|
||||||
|
jam_track.save!
|
||||||
|
jam_track.reproduction_royalty_amount.to_f.should eq(0.091)
|
||||||
|
|
||||||
|
jam_track.duration = 5 * 60 - 1 # just under 5 minutes
|
||||||
|
jam_track.save!
|
||||||
|
jam_track.reproduction_royalty_amount.to_f.should eq(0.091)
|
||||||
|
|
||||||
|
jam_track.duration = 5 * 60
|
||||||
|
jam_track.save!
|
||||||
|
jam_track.reproduction_royalty_amount.to_f.should eq(0.091)
|
||||||
|
|
||||||
|
jam_track.duration = 6 * 60 - 1 # just under 6 minutes
|
||||||
|
jam_track.save!
|
||||||
|
jam_track.reproduction_royalty_amount.should eq(0.091 + 0.0175)
|
||||||
|
|
||||||
|
jam_track.duration = 6 * 60
|
||||||
|
jam_track.save!
|
||||||
|
jam_track.reproduction_royalty_amount.should eq(0.091 + 0.0175)
|
||||||
|
|
||||||
|
jam_track.duration = 7 * 60 - 1
|
||||||
|
jam_track.save!
|
||||||
|
jam_track.reproduction_royalty_amount.should eq(0.091 + 0.0175 * 2)
|
||||||
|
|
||||||
|
jam_track.duration = 7 * 60
|
||||||
|
jam_track.save!
|
||||||
|
jam_track.reproduction_royalty_amount.should eq(0.091 + 0.0175 * 2)
|
||||||
|
|
||||||
|
jam_track.duration = 8 * 60 - 1
|
||||||
|
jam_track.save!
|
||||||
|
jam_track.reproduction_royalty_amount.should eq(0.091 + 0.0175 * 3)
|
||||||
|
|
||||||
|
jam_track.duration = 8 * 60
|
||||||
|
jam_track.save!
|
||||||
|
jam_track.reproduction_royalty_amount.should eq(0.091 + 0.0175 * 3)
|
||||||
|
|
||||||
|
jam_track.duration = 9 * 60 - 1
|
||||||
|
jam_track.save!
|
||||||
|
jam_track.reproduction_royalty_amount.should eq(0.091 + 0.0175 * 4)
|
||||||
|
|
||||||
|
jam_track.duration = 9 * 60
|
||||||
|
jam_track.save!
|
||||||
|
jam_track.reproduction_royalty_amount.should eq(0.091 + 0.0175 * 4)
|
||||||
|
|
||||||
|
jam_track.duration = 10 * 60 - 1
|
||||||
|
jam_track.save!
|
||||||
|
jam_track.reproduction_royalty_amount.should eq(0.091 + 0.0175 * 5)
|
||||||
|
|
||||||
|
jam_track.duration = 10 * 60
|
||||||
|
jam_track.save!
|
||||||
|
jam_track.reproduction_royalty_amount.should eq(0.091 + 0.0175 * 5)
|
||||||
|
|
||||||
|
jam_track.duration = 11 * 60 - 1
|
||||||
|
jam_track.save!
|
||||||
|
jam_track.reproduction_royalty_amount.should eq(0.091 + 0.0175 * 6)
|
||||||
|
|
||||||
|
jam_track.duration = 11 * 60
|
||||||
|
jam_track.save!
|
||||||
|
jam_track.reproduction_royalty_amount.should eq(0.091 + 0.0175 * 6)
|
||||||
|
|
||||||
|
jam_track.duration = 12 * 60 - 1
|
||||||
|
jam_track.save!
|
||||||
|
jam_track.reproduction_royalty_amount.should eq(0.091 + 0.0175 * 7)
|
||||||
|
|
||||||
|
jam_track.duration = 12 * 60
|
||||||
|
jam_track.save!
|
||||||
|
jam_track.reproduction_royalty_amount.should eq(0.091 + 0.0175 * 7)
|
||||||
|
|
||||||
|
jam_track.duration = 13 * 60
|
||||||
|
jam_track.save!
|
||||||
|
jam_track.reproduction_royalty_amount.should eq(0.091 + 0.0175 * 8)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'plays' do
|
describe 'plays' do
|
||||||
|
|
@ -98,6 +182,26 @@ describe JamTrack do
|
||||||
query[1].should eq(jam_track1)
|
query[1].should eq(jam_track1)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "queries on genre" do
|
||||||
|
jam_track1 = FactoryGirl.create(:jam_track_with_tracks, original_artist: 'artist', name: 'a')
|
||||||
|
jam_track2 = FactoryGirl.create(:jam_track_with_tracks, original_artist: 'artist', name: 'b')
|
||||||
|
jam_track1.genres = [Genre.find('rock')]
|
||||||
|
jam_track2.genres = [Genre.find('asian')]
|
||||||
|
jam_track1.save!
|
||||||
|
jam_track2.save!
|
||||||
|
|
||||||
|
query, pager = JamTrack.index({genre: 'rock'}, user)
|
||||||
|
query.size.should == 1
|
||||||
|
query[0].should eq(jam_track1)
|
||||||
|
|
||||||
|
query, pager = JamTrack.index({genre: 'asian'}, user)
|
||||||
|
query.size.should == 1
|
||||||
|
query[0].should eq(jam_track2)
|
||||||
|
|
||||||
|
query, pager = JamTrack.index({genre: 'african'}, user)
|
||||||
|
query.size.should == 0
|
||||||
|
end
|
||||||
|
|
||||||
it "supports showing purchased only" do
|
it "supports showing purchased only" do
|
||||||
jam_track1 = FactoryGirl.create(:jam_track_with_tracks, name: 'a')
|
jam_track1 = FactoryGirl.create(:jam_track_with_tracks, name: 'a')
|
||||||
|
|
||||||
|
|
@ -170,7 +274,7 @@ describe JamTrack do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "100.1234" do
|
it "100.1234" do
|
||||||
jam_track = FactoryGirl.build(:jam_track, reproduction_royalty_amount: 100.1234)
|
jam_track = FactoryGirl.build(:jam_track, reproduction_royalty_amount: 100.12345)
|
||||||
jam_track.valid?.should be_false
|
jam_track.valid?.should be_false
|
||||||
jam_track.errors[:reproduction_royalty_amount].should == ['is invalid']
|
jam_track.errors[:reproduction_royalty_amount].should == ['is invalid']
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ describe JamTrackTrack do
|
||||||
it "created" do
|
it "created" do
|
||||||
jam_track_track = FactoryGirl.create(:jam_track_track)
|
jam_track_track = FactoryGirl.create(:jam_track_track)
|
||||||
jam_track_track.jam_track.should_not be_nil
|
jam_track_track.jam_track.should_not be_nil
|
||||||
|
jam_track_track.jam_track.reload
|
||||||
jam_track_track.jam_track.jam_track_tracks.should == [jam_track_track]
|
jam_track_track.jam_track.jam_track_tracks.should == [jam_track_track]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -264,9 +264,10 @@ ChannelGroupIds = context.JK.ChannelGroupIds
|
||||||
mediaTracks.push(`<SessionJamTrackCategory key="JamTrackCategory" jamTrackName={this.state.jamTrackName} mixers={this.state.mediaCategoryMixer} mode={MIX_MODES.PERSONAL} />`)
|
mediaTracks.push(`<SessionJamTrackCategory key="JamTrackCategory" jamTrackName={this.state.jamTrackName} mixers={this.state.mediaCategoryMixer} mode={MIX_MODES.PERSONAL} />`)
|
||||||
|
|
||||||
# this is not ready yet until VRFS-3363 is done
|
# this is not ready yet until VRFS-3363 is done
|
||||||
#if @state.metronome?
|
if @state.metronome?
|
||||||
# @state.metronome.mode = MIX_MODES.PERSONAL
|
@state.metronome.mode = MIX_MODES.PERSONAL
|
||||||
# mediaTracks.push(`<SessionMetronome key="JamTrackMetronome" {...this.state.metronome} />`)
|
|
||||||
|
mediaTracks.push(`<SessionMetronome key="JamTrackMetronome" location="jam-track" {...this.state.metronome} />`)
|
||||||
|
|
||||||
for jamTrack in @state.jamTracks
|
for jamTrack in @state.jamTracks
|
||||||
jamTrack.mode = MIX_MODES.PERSONAL
|
jamTrack.mode = MIX_MODES.PERSONAL
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@ MIX_MODES = context.JK.MIX_MODES
|
||||||
componentClasses = classNames({
|
componentClasses = classNames({
|
||||||
"session-track" : true
|
"session-track" : true
|
||||||
"metronome" : true
|
"metronome" : true
|
||||||
|
"in-jam-track" : @props.location == 'jam-track'
|
||||||
"no-mixer" : @props.mode == MIX_MODES.MASTER # show it as disabled if in master mode
|
"no-mixer" : @props.mode == MIX_MODES.MASTER # show it as disabled if in master mode
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -175,6 +175,16 @@
|
||||||
.track-controls {
|
.track-controls {
|
||||||
margin-left:0;
|
margin-left:0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.in-jam-track {
|
||||||
|
min-height:56px;
|
||||||
|
.track-buttons {
|
||||||
|
margin-top:2px;
|
||||||
|
}
|
||||||
|
table.vu {
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.recorded-track, &.jam-track, &.recorded-category, &.jam-track-category {
|
&.recorded-track, &.jam-track, &.recorded-category, &.jam-track-category {
|
||||||
|
|
|
||||||
|
|
@ -482,7 +482,7 @@ class ApiMusicSessionsController < ApiController
|
||||||
comment.save
|
comment.save
|
||||||
|
|
||||||
if comment.errors.any?
|
if comment.errors.any?
|
||||||
render :json => { :message => "Unexpected error occurred" }, :status => 500
|
render :json => { :errors => comment.errors }, :status => 422
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
render :json => {}, :status => 201
|
render :json => {}, :status => 201
|
||||||
|
|
@ -508,7 +508,7 @@ class ApiMusicSessionsController < ApiController
|
||||||
comment.save
|
comment.save
|
||||||
|
|
||||||
if comment.errors.any?
|
if comment.errors.any?
|
||||||
render :json => { :message => "Unexpected error occurred" }, :status => 500
|
render :json => { :errors => comment.errors }, :status => 422
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
music_session = MusicSession.find(params[:id])
|
music_session = MusicSession.find(params[:id])
|
||||||
|
|
|
||||||
|
|
@ -155,7 +155,7 @@ class ApiRecordingsController < ApiController
|
||||||
comment.save
|
comment.save
|
||||||
|
|
||||||
if comment.errors.any?
|
if comment.errors.any?
|
||||||
render :json => { :message => "Unexpected error occurred" }, :status => 500
|
render :json => { :errors => comment.errors }, :status => 422
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
render :json => {}, :status => 201
|
render :json => {}, :status => 201
|
||||||
|
|
@ -178,7 +178,7 @@ class ApiRecordingsController < ApiController
|
||||||
liker.save
|
liker.save
|
||||||
|
|
||||||
if liker.errors.any?
|
if liker.errors.any?
|
||||||
render :json => { :message => "Unexpected error occurred" }, :status => 500
|
render :json => { :errors => liker.errors }, :status => 422
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
render :json => {}, :status => 201
|
render :json => {}, :status => 201
|
||||||
|
|
|
||||||
|
|
@ -796,7 +796,7 @@ class ApiUsersController < ApiController
|
||||||
play.save
|
play.save
|
||||||
|
|
||||||
if play.errors.any?
|
if play.errors.any?
|
||||||
render :json => { :message => "Unexpected error occurred" }, :status => 500
|
render :json => { :errors => play.errors }, :status => 422
|
||||||
else
|
else
|
||||||
render :json => {}, :status => 201
|
render :json => {}, :status => 201
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ object @jam_track
|
||||||
attributes :id, :name, :description, :recording_type, :original_artist, :songwriter, :publisher, :sales_region, :price, :version, :duration
|
attributes :id, :name, :description, :recording_type, :original_artist, :songwriter, :publisher, :sales_region, :price, :version, :duration
|
||||||
|
|
||||||
node :genres do |item|
|
node :genres do |item|
|
||||||
[item.genre.description] # XXX: need to return single genre; not array
|
item.genres.select(:description).map(&:description)
|
||||||
end
|
end
|
||||||
|
|
||||||
node :added_cart do |item|
|
node :added_cart do |item|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
object @jam_track
|
object @jam_track
|
||||||
|
|
||||||
attributes :id, :name, :description, :initial_play_silence, :original_artist, :version, :genre
|
attributes :id, :name, :description, :initial_play_silence, :original_artist, :version
|
||||||
|
|
||||||
node :genre do |jam_track|
|
node :genres do |item|
|
||||||
jam_track.genre.present? ? jam_track.genre.id : nil
|
item.genres.select(:description).map(&:description)
|
||||||
end
|
end
|
||||||
|
|
||||||
node :jmep do |jam_track|
|
node :jmep do |jam_track|
|
||||||
|
|
|
||||||
|
|
@ -4,15 +4,49 @@ namespace :jam_tracks do
|
||||||
JamTrackImporter.dry_run
|
JamTrackImporter.dry_run
|
||||||
end
|
end
|
||||||
|
|
||||||
|
task tency_dry_run: :environment do |task, args|
|
||||||
|
JamTrackImporter.storage_format = 'Tency'
|
||||||
|
JamTrackImporter.dry_run
|
||||||
|
end
|
||||||
|
|
||||||
|
task tency_create_masters: :environment do |task, args|
|
||||||
|
JamTrackImporter.storage_format = 'Tency'
|
||||||
|
JamTrackImporter.create_masters
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
task tency_create_master: :environment do |task, args|
|
||||||
|
JamTrackImporter.storage_format = 'Tency'
|
||||||
|
|
||||||
|
path = ENV['TRACK_PATH']
|
||||||
|
|
||||||
|
if !path
|
||||||
|
puts "TRACK_PATH must be set to something like audio/AC DC/Back in Black or mapped/50 Cent - In Da Club - 12401"
|
||||||
|
exit(1)
|
||||||
|
end
|
||||||
|
|
||||||
|
JamTrackImporter.create_master(path)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
task tency_delta: :environment do |task, args|
|
||||||
|
JamTrackImporter.storage_format = 'Tency'
|
||||||
|
JamTrackImporter.tency_delta
|
||||||
|
end
|
||||||
|
|
||||||
task sync: :environment do |task, args|
|
task sync: :environment do |task, args|
|
||||||
path = ENV['TRACK_PATH']
|
path = ENV['TRACK_PATH']
|
||||||
|
|
||||||
if !path
|
if !path
|
||||||
puts "TRACK_PATH must be set to something like AD DC/Back in Black"
|
puts "TRACK_PATH must be set to something like audio/AC DC/Back in Black or mapped/50 Cent - In Da Club - 12401"
|
||||||
exit(1)
|
exit(1)
|
||||||
end
|
end
|
||||||
|
|
||||||
JamTrackImporter.synchronize_from_meta("audio/#{path}/meta.yml", skip_audio_upload:false)
|
if path.start_with?('mapped')
|
||||||
|
JamTrackImporter.storage_format = 'Tency'
|
||||||
|
end
|
||||||
|
|
||||||
|
JamTrackImporter.synchronize_from_meta("#{path}/meta.yml", skip_audio_upload:false)
|
||||||
end
|
end
|
||||||
|
|
||||||
task resync_audio: :environment do |task, args|
|
task resync_audio: :environment do |task, args|
|
||||||
|
|
@ -26,6 +60,20 @@ namespace :jam_tracks do
|
||||||
JamTrackImporter.synchronize_from_meta("audio/#{path}/meta.yml", resync_audio:true, skip_audio_upload:false)
|
JamTrackImporter.synchronize_from_meta("audio/#{path}/meta.yml", resync_audio:true, skip_audio_upload:false)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
task tency_genre_dump: :environment do |task, args|
|
||||||
|
JamTrackImporter.storage_format = 'Tency'
|
||||||
|
JamTrackImporter.genre_dump
|
||||||
|
end
|
||||||
|
|
||||||
|
task sync_tency: :environment do |task, args|
|
||||||
|
JamTrackImporter.storage_format = 'Tency'
|
||||||
|
JamTrackImporter.synchronize_all(skip_audio_upload:false)
|
||||||
|
end
|
||||||
|
|
||||||
|
task onboarding_exceptions: :environment do |task, args|
|
||||||
|
JamTrackImporter.onboarding_exceptions
|
||||||
|
end
|
||||||
|
|
||||||
task sync_all: :environment do |task, args|
|
task sync_all: :environment do |task, args|
|
||||||
JamTrackImporter.synchronize_all(skip_audio_upload:false)
|
JamTrackImporter.synchronize_all(skip_audio_upload:false)
|
||||||
end
|
end
|
||||||
|
|
@ -91,4 +139,10 @@ namespace :jam_tracks do
|
||||||
task download_masters: :environment do |task, arg|
|
task download_masters: :environment do |task, arg|
|
||||||
JamTrackImporter.download_masters
|
JamTrackImporter.download_masters
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
task tency: :environment do |task, arg|
|
||||||
|
mapper = TencyStemMapping.new
|
||||||
|
mapper.correlate
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -731,7 +731,7 @@ FactoryGirl.define do
|
||||||
make_track true
|
make_track true
|
||||||
end
|
end
|
||||||
|
|
||||||
genre JamRuby::Genre.first
|
genres [JamRuby::Genre.first]
|
||||||
association :licensor, factory: :jam_track_licensor
|
association :licensor, factory: :jam_track_licensor
|
||||||
|
|
||||||
after(:create) do |jam_track, evaluator|
|
after(:create) do |jam_track, evaluator|
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,8 @@ describe "JamTrack Shopping", :js => true, :type => :feature, :capybara_feature
|
||||||
let(:user) { FactoryGirl.create(:user, has_redeemable_jamtrack: false) }
|
let(:user) { FactoryGirl.create(:user, has_redeemable_jamtrack: false) }
|
||||||
let(:jt_us) { FactoryGirl.create(:jam_track, :name=>'jt_us', sales_region: 'Worldwide', make_track: true, original_artist: "foobar") }
|
let(:jt_us) { FactoryGirl.create(:jam_track, :name=>'jt_us', sales_region: 'Worldwide', make_track: true, original_artist: "foobar") }
|
||||||
let(:jt_ww) { FactoryGirl.create(:jam_track, :name=>'jt_ww', sales_region: 'Worldwide', make_track: true, original_artist: "barfoo") }
|
let(:jt_ww) { FactoryGirl.create(:jam_track, :name=>'jt_ww', sales_region: 'Worldwide', make_track: true, original_artist: "barfoo") }
|
||||||
let(:jt_rock) { FactoryGirl.create(:jam_track, :name=>'jt_rock', genre: JamRuby::Genre.find('rock'), make_track: true, original_artist: "badfood") }
|
let(:jt_rock) { FactoryGirl.create(:jam_track, :name=>'jt_rock', genres: [JamRuby::Genre.find('rock')], make_track: true, original_artist: "badfood") }
|
||||||
let(:jt_blues) { FactoryGirl.create(:jam_track, :name=>'jt_blues', genre: JamRuby::Genre.find('blues'), make_track: true, original_artist: "foodbart") }
|
let(:jt_blues) { FactoryGirl.create(:jam_track, :name=>'jt_blues', genres: [JamRuby::Genre.find('blues')], make_track: true, original_artist: "foodbart") }
|
||||||
|
|
||||||
before(:all) do
|
before(:all) do
|
||||||
Capybara.javascript_driver = :poltergeist
|
Capybara.javascript_driver = :poltergeist
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue