Method: Tools::API#transcode

Defined in:
lib/tools/api.rb

#transcode(config_path) ⇒ Object

Transcode all FLAC files to the desired formats

Parameters:

  • config_path (String)

    Path to the primary configuration file.



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/tools/api.rb', line 33

def transcode(config_path)
  config = read_config(config_path, :transcode)

  # Format keys and their manifest files
  format_configuration = config['formats']

  # Relativize all paths
  relative_configuration = format_configuration.map do |key, manifest_path|
    [key, relative_config_path(config_path, manifest_path)]
  end.to_h

  # Format objects
  formats = Tools::Formats::Format.create_from_configuration(relative_configuration)

  # Initialize file transcoder
  transcoder = Actions::Transcode.new(
    manifests: formats,
    source: config['source'],
    output: config['source']
  )

  # Transcode all formats
  transcoder.execute
end