Class: Musicality::Tasks::Auditions

Inherits:
Rake::TaskLib
  • Object
show all
Defined in:
lib/musicality/project/auditions_task.rb

Constant Summary collapse

TEMPO_SAMPLE_RATE =
200
AUDITIONS_DIR =
"auditions"
AUDITIONS_EXT =
".auditions"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(yaml_filelist, audio_format = nil) ⇒ Auditions

Returns a new instance of Auditions.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/musicality/project/auditions_task.rb', line 11

def initialize yaml_filelist, audio_format = nil
  @auditions_dirs = yaml_filelist.pathmap("%d/#{AUDITIONS_DIR}")
  @auditions_dirs.each { |auditions_dir| directory auditions_dir }

  format_flag = audio_format.nil? ? "" : "--format=#{audio_format}"
  subtask = audio_format.nil? ? "" : ":#{audio_format}"

  task "auditions#{subtask}" => yaml_filelist + @auditions_dirs do
    yaml_filelist.each_with_index do |yaml_fname,i|
      auditions_dir = @auditions_dirs[i]
      `auditions #{yaml_fname} --outdir="#{auditions_dir}" #{format_flag}`
    end
  end
end

Instance Attribute Details

#auditions_dirsObject (readonly)

Returns the value of attribute auditions_dirs.



5
6
7
# File 'lib/musicality/project/auditions_task.rb', line 5

def auditions_dirs
  @auditions_dirs
end