Class: Xspf2m3u::App

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/xspf2m3u/app.rb

Overview

Top-level app

Instance Method Summary collapse

Instance Method Details

#convertObject



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/xspf2m3u/app.rb', line 28

def convert
  from = options[:infile]
  to = options[:outfile]

  begin
    xspf = XSPF.new(File.read from)
    create_file to do
      xspf.to_xm3u
    end
  rescue Errno::ENOENT => message
    raise Thor::Error, message
  rescue NoMethodError
    raise Thor::Error, "Error parsing #{from}"
  end

end

#help(task = nil, subcommand = false) ⇒ Object



47
48
49
50
# File 'lib/xspf2m3u/app.rb', line 47

def help task = nil, subcommand = false
  say Help.general_message if task.nil?
  super
end

#versionObject



10
11
12
# File 'lib/xspf2m3u/app.rb', line 10

def version
  say "xspf2m3u version #{VERSION}"
end