module Musical

Constants

VERSION

Public Class Methods

configuration() click to toggle source
# File lib/musical.rb, line 19
def configuration
  Configuration.config || Musical.setup
end
setup() { |configuration| ... } click to toggle source
# File lib/musical.rb, line 24
def setup
  return unless check_env

  # init working directory
  working_dir = File.join(File.expand_path('~'), '.musical')
  FileUtils.mkdir_p(working_dir) unless File.exist?(working_dir)

  # parse options
  options = Trollop::options do
    version "musical #{Musical::VERSION}"
    opt :info, "Show your DVD data", type: :boolean
    opt :ignore_convert_sound, "Rip data only, NOT convert them to wav file", type: :boolean
    opt :ignore_use_itunes, "NOT add ripped files to iTunes and encode them", type: :boolean
    opt :path, "Set device path of DVD", type: :string
    opt :title, "Set DVD title", type: :string, default: 'LIVE'
    opt :artist, "Set DVD artist", type: :string, default: 'Artist'
    opt :year, "Set year DVD was recorded", type: :int, default: Time.now.year
    opt :output, "Set location of ripped data", type: :string, default: 'ripped'
  end

  configuration = Configuration.build(options.merge(working_dir: working_dir))
  yield(configuration) if block_given?

  configuration
end

Private Instance Methods

configuration() click to toggle source
# File lib/musical.rb, line 19
def configuration
  Configuration.config || Musical.setup
end
setup() { |configuration| ... } click to toggle source
# File lib/musical.rb, line 24
def setup
  return unless check_env

  # init working directory
  working_dir = File.join(File.expand_path('~'), '.musical')
  FileUtils.mkdir_p(working_dir) unless File.exist?(working_dir)

  # parse options
  options = Trollop::options do
    version "musical #{Musical::VERSION}"
    opt :info, "Show your DVD data", type: :boolean
    opt :ignore_convert_sound, "Rip data only, NOT convert them to wav file", type: :boolean
    opt :ignore_use_itunes, "NOT add ripped files to iTunes and encode them", type: :boolean
    opt :path, "Set device path of DVD", type: :string
    opt :title, "Set DVD title", type: :string, default: 'LIVE'
    opt :artist, "Set DVD artist", type: :string, default: 'Artist'
    opt :year, "Set year DVD was recorded", type: :int, default: Time.now.year
    opt :output, "Set location of ripped data", type: :string, default: 'ripped'
  end

  configuration = Configuration.build(options.merge(working_dir: working_dir))
  yield(configuration) if block_given?

  configuration
end