* VRFS-2634 adding version to jamtrack
This commit is contained in:
parent
0472d6bc79
commit
9dbf1a3e56
|
|
@ -26,6 +26,7 @@ ActiveAdmin.register JamRuby::JamTrack, :as => 'JamTracks' do
|
|||
column :id
|
||||
column :name
|
||||
column :description
|
||||
column :version
|
||||
column :initial_play_silence
|
||||
column :time_signature
|
||||
column :status
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@
|
|||
| JamTrack should only be made available (to end users) if all its sub-component are in place:
|
||||
= f.input :available, as: :boolean
|
||||
= f.input :description, :input_html => { :rows=>5, :maxlength=>1000 }
|
||||
= f.input :plan_code, :label=>'Recurly Plan Code', :required=>true, :hint => 'Must match plan code in Recurly'
|
||||
= f.input :version, :label => 'Version', :hint => 'Increment this value whenever you invalidate (update) the definition of this JamTrack'
|
||||
= f.input :initial_play_silence, :label => 'Initial Play Silence (seconds)'
|
||||
= f.input :time_signature, collection: JamRuby::JamTrack::TIME_SIGNATURES, include_blank: false
|
||||
= f.input :status, collection: JamRuby::JamTrack::STATUS, include_blank: false
|
||||
|
|
@ -24,7 +26,6 @@
|
|||
= f.input :reproduction_royalty_amount, :required=>true, :input_html=>{type:'numeric'}
|
||||
= f.input :licensor_royalty_amount, :required=>true, :input_html=>{type:'numeric'}
|
||||
= f.input :pro_royalty_amount, :required=>true, :input_html=>{type:'numeric'}
|
||||
= f.input :plan_code, :label=>'Recurly Plan Code', :required=>true
|
||||
= f.input :url, :as => :file, :label => 'Audio File'
|
||||
|
||||
= f.semantic_fields_for :jam_track_tracks do |track|
|
||||
|
|
|
|||
|
|
@ -252,4 +252,5 @@ metronome.sql
|
|||
recorded_backing_tracks.sql
|
||||
recorded_backing_tracks_add_filename.sql
|
||||
user_syncs_include_backing_tracks.sql
|
||||
remove_bpm_from_jamtracks.sql
|
||||
remove_bpm_from_jamtracks.sql
|
||||
jam_track_version.sql
|
||||
|
|
@ -0,0 +1 @@
|
|||
ALTER TABLE jam_tracks ADD COLUMN version VARCHAR NOT NULL DEFAULT 0;
|
||||
|
|
@ -42,10 +42,11 @@ module JamRuby
|
|||
title=jam_track.name
|
||||
output_jkz=File.join(tmp_dir, "#{title.parameterize}.jkz")
|
||||
py_file = File.join(py_root, "jkcreate.py")
|
||||
version = jam_track.version
|
||||
@@log.info "Executing python source in #{py_file}, outputting to #{tmp_dir} (#{output_jkz})"
|
||||
|
||||
# From http://stackoverflow.com/questions/690151/getting-output-of-system-calls-in-ruby/5970819#5970819:
|
||||
cli = "python #{py_file} -D -k #{sku} -p #{tmp_dir}/pkey.pem -s #{tmp_dir}/skey.pem #{jam_file_opts} -o #{output_jkz} -t '#{title}'"
|
||||
cli = "python #{py_file} -D -k #{sku} -p #{tmp_dir}/pkey.pem -s #{tmp_dir}/skey.pem #{jam_file_opts} -o #{output_jkz} -t '#{title}' -V '#{version}'"
|
||||
Open3.popen3(cli) do |stdin, stdout, stderr, wait_thr|
|
||||
pid = wait_thr.pid
|
||||
exit_status = wait_thr.value
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ module JamRuby
|
|||
:original_artist, :songwriter, :publisher, :licensor, :licensor_id, :pro, :genre, :genre_id, :sales_region, :price,
|
||||
:reproduction_royalty, :public_performance_royalty, :reproduction_royalty_amount,
|
||||
:licensor_royalty_amount, :pro_royalty_amount, :plan_code, :initial_play_silence, :jam_track_tracks_attributes,
|
||||
:jam_track_tap_ins_attributes, :available, as: :admin
|
||||
:jam_track_tap_ins_attributes, :available, :version, as: :admin
|
||||
|
||||
validates :name, presence: true, uniqueness: true, length: {maximum: 200}
|
||||
validates :description, length: {maximum: 1000}
|
||||
|
|
@ -30,6 +30,7 @@ module JamRuby
|
|||
validates :sales_region, inclusion: {in: [nil] + SALES_REGION}
|
||||
validates_format_of :price, with: /^\d+\.*\d{0,2}$/
|
||||
validates :initial_play_silence, numericality: true, :allow_nil => true
|
||||
validates :version, presence: true
|
||||
|
||||
validates :reproduction_royalty, inclusion: {in: [nil, true, false]}
|
||||
validates :public_performance_royalty, inclusion: {in: [nil, true, false]}
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ context.JK.DownloadJamTrack = class DownloadJamTrack
|
|||
|
||||
throw "no JamTrack specified" unless @jamTrack?
|
||||
throw "invalid size" if @size != 'large' && @size != 'small'
|
||||
throw "no JamTrack version" unless @jamTrack.version?
|
||||
|
||||
@path = []
|
||||
@states = {
|
||||
|
|
@ -342,6 +343,13 @@ context.JK.DownloadJamTrack = class DownloadJamTrack
|
|||
|
||||
@logger.debug("DownloadJamTrack: JamTrackGetTrackDetail.key_state: " + @trackDetail.key_state)
|
||||
|
||||
# first check if the version is not the same; if so, invalidate.
|
||||
|
||||
if @jamTrack.version != @trackDetail.version
|
||||
@logger.info("DownloadJamTrack: JamTrack on disk is different version. Invalidating")
|
||||
context.jamClient.InvalidateJamTrack(@jamTrack.id)
|
||||
@trackDetail = context.jamClient.JamTrackGetTrackDetail (@jamTrack.id)
|
||||
|
||||
switch @trackDetail.key_state
|
||||
when 'pending'
|
||||
this.transition(@states.keying)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
object @jam_track
|
||||
|
||||
attributes :id, :name, :description, :recording_type, :original_artist, :songwriter, :publisher, :sales_region, :price
|
||||
attributes :id, :name, :description, :recording_type, :original_artist, :songwriter, :publisher, :sales_region, :price, :version
|
||||
|
||||
node :genres do |item|
|
||||
[item.genre.description] # XXX: need to return single genre; not array
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
object @jam_track
|
||||
|
||||
attributes :id, :name, :description, :initial_play_silence, :original_artist
|
||||
attributes :id, :name, :description, :initial_play_silence, :original_artist, :version
|
||||
|
||||
node :jam_track_right_id do |jam_track|
|
||||
jam_track.right_for_user(current_user).id
|
||||
|
|
|
|||
Loading…
Reference in New Issue