Module: Subtitle2utf8

Defined in:
lib/subtitle2utf8.rb,
lib/subtitle2utf8/version.rb

Constant Summary collapse

VERSION =
'0.1.2'

Class Method Summary collapse

Class Method Details

.convert(subtitle, type, recursion = false) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/subtitle2utf8.rb', line 5

def self.convert(subtitle, type, recursion = false)
  path = File.expand_path(subtitle)

  case type
  when :file
    if !File.exist?(path)
      abort "#{path} does not exist!"
    end

    convert_file(path)
  when :dir
    if !Dir.exist?(path)
      abort "#{path} does not exist!"
    end

    if recursion
      convert_dirs(path)
    else
      convert_dir(path)
    end
  end
end