Module: AppleTvConverter

Included in:
MediaConverterAdapter
Defined in:
lib/apple_tv_converter.rb,
lib/apple_tv_converter/media.rb,
lib/apple_tv_converter/version.rb,
lib/apple_tv_converter/command_line.rb,
lib/apple_tv_converter/movie_hasher.rb,
lib/apple_tv_converter/tv_db_fetcher.rb,
lib/apple_tv_converter/media_converter.rb,
lib/apple_tv_converter/media_converter_adapter.rb,
lib/apple_tv_converter/media_converter_mac_adapter.rb,
lib/apple_tv_converter/media_converter_windows_adapter.rb,
lib/apple_tv_converter/subtitles_fetcher/opensubtitles.rb

Defined Under Namespace

Modules: MovieHasher, SubtitlesFetcher Classes: CommandLine, Media, MediaConverter, MediaConverterAdapter, MediaConverterMacAdapter, MediaConverterWindowsAdapter, TvDbFetcher

Constant Summary collapse

VERSION =
"0.5.3"
Timer =
Timeout

Class Method Summary collapse

Class Method Details

.atomic_parsley_binaryString

Get the path to the atomic_parsley binary, defaulting to ‘AtomicParsley’

Returns:

  • (String)

    the path to the atomic_parsley binary



77
78
79
# File 'lib/apple_tv_converter.rb', line 77

def self.atomic_parsley_binary
  @atomic_parsley_binary.nil? ? 'AtomicParsley' : @atomic_parsley_binary
end

.atomic_parsley_binary=(bin) ⇒ String

Set the path of the atomic parsley binary. Can be useful if you need to specify a path such as /usr/local/bin/atomic_parsley

Parameters:

  • path (String)

    to the atomic parsley binary

Returns:

  • (String)

    the path you set



70
71
72
# File 'lib/apple_tv_converter.rb', line 70

def self.atomic_parsley_binary=(bin)
  @atomic_parsley_binary = bin
end

.copy(from, to) ⇒ Object



81
82
83
84
85
86
87
# File 'lib/apple_tv_converter.rb', line 81

def self.copy(from, to)
  open(from) do |f|
    File.open(to, "wb") do |file|
      file.puts f.read
    end
  end
end

.data_pathObject



89
90
91
92
# File 'lib/apple_tv_converter.rb', line 89

def self.data_path()
  @data_path ||= File.expand_path(File.join('~', 'Library', 'Application Support', 'apple-tv-converter')) if is_macosx?
  @data_path
end

.get_language_name(language_code) ⇒ Object



94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# File 'lib/apple_tv_converter.rb', line 94

def self.get_language_name(language_code)
  return language_code if language_code.length > 3

  # ??? - English
  # ara - Arabic
  # bul - Bulgarian
  # chi - Chilean? -> ignore?
  # cze - Czech -> ces
  # dan - Danish
  # dut - Dutch -> nld
  # eng - English
  # est - Estonian
  # fin - Finnish
  # fre - French -> fra
  # ger - German -> deu
  # gre - Greek -> ell
  # heb - Hebrew
  # hrv - Croatian
  # hun - Hungarian
  # ice - Icelandic -> isl
  # ita - Italian
  # jpn - Japanese
  # kor - Korean
  # lav - Latvian
  # lit - Lithuanian
  # may - Malay? -> ignore?
  # nor - Norwegian
  # pol - Polish
  # por - Portuguese
  # rum - Romanian -> ron
  # rus - Russian
  # slv - Slovenian
  # spa - Spanish
  # srp - Serbian
  # swe - Swedish
  # tha - Thai
  # tur - Turkish
  # ukr - Ukrainian
  language_code_mappings = {
    '' => 'eng',
    'chi' => nil,
    'cze' => 'ces',
    'dut' => 'nld',
    'fre' => 'fra',
    'ger' => 'deu',
    'gre' => 'ell',
    'ice' => 'isl',
    'rum' => 'ron',
    'may' => nil
  }

  language_code = language_code_mappings.has_key?(language_code) ? language_code_mappings[language_code] : language_code

  return nil if language_code.nil?

  language = ::LanguageList::LanguageInfo.find_by_iso_639_3(language_code)

  return language.name unless language.nil?
  return nil
end

.is_macosx?boolean

Determine whether running on Mac OS X

Returns:

  • (boolean)

    true if running on Mac OS X



28
# File 'lib/apple_tv_converter.rb', line 28

def self.is_macosx? ; RUBY_PLATFORM =~/.*?darwin.*?/i ; end

.is_windows?boolean

Determine whether running on Windows

Returns:

  • (boolean)

    true if running on Windows



24
# File 'lib/apple_tv_converter.rb', line 24

def self.is_windows? ; RUBY_PLATFORM =~/.*?mingw.*?/i ; end

.loggerLogger

Get AppleTvConverter logger.

Returns:

  • (Logger)


42
43
44
45
46
47
# File 'lib/apple_tv_converter.rb', line 42

def self.logger
  return @logger if @logger
  logger = Logger.new(STDOUT)
  logger.level = Logger::INFO
  @logger = logger
end

.logger=(log) ⇒ Logger

AppleTvConverter logs information about its progress when it’s transcoding. Jack in your own logger through this method if you wish to.

Parameters:

  • log (Logger)

    your own logger

Returns:

  • (Logger)

    the logger you set



35
36
37
# File 'lib/apple_tv_converter.rb', line 35

def self.logger=(log)
  @logger = log
end

.mp4box_binaryString

Get the path to the mp4box binary, defaulting to ‘MP4Box’

Returns:

  • (String)

    the path to the mp4box binary



61
62
63
# File 'lib/apple_tv_converter.rb', line 61

def self.mp4box_binary
  @mp4box_binary.nil? ? 'MP4Box' : @mp4box_binary
end

.mp4box_binary=(bin) ⇒ String

Set the path of the mp4box binary. Can be useful if you need to specify a path such as /usr/local/bin/mp4box

Parameters:

  • path (String)

    to the mp4box binary

Returns:

  • (String)

    the path you set



54
55
56
# File 'lib/apple_tv_converter.rb', line 54

def self.mp4box_binary=(bin)
  @mp4box_binary = bin
end