Class: Inspector
- Inherits:
-
Object
- Object
- Inspector
- Defined in:
- lib/inspector.rb
Instance Attribute Summary collapse
-
#episodes ⇒ Object
Returns the value of attribute episodes.
-
#langs ⇒ Object
Returns the value of attribute langs.
-
#log ⇒ Object
Returns the value of attribute log.
-
#tv_shows ⇒ Object
Returns the value of attribute tv_shows.
Class Method Summary collapse
Instance Method Summary collapse
- #growl_episode(episode, lang) ⇒ Object
-
#initialize(path, options = {}) ⇒ Inspector
constructor
A new instance of Inspector.
Constructor Details
#initialize(path, options = {}) ⇒ Inspector
Returns a new instance of Inspector.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/inspector.rb', line 11 def initialize(path , = {}) @path = Pathname.new(path).realpath.to_s @langs = [:lang] ? [:lang].split(',') : ['fr','en'] # Initialize Logger @log = Logger.new([:log_path] || "#{@path}/_autosub_.log" ) @log.datetime_format = "%Y-%m-%d %H:%M:%S " log.info "Begin searching for '#{langs.join(',')}' subtitles..." $stdout.print "--- Searching for '#{langs.join(',')}' subtitles ---\n" @tv_shows = [] # {:name => ..., :path => ...} initialize_tv_shows $stdout.print "Found #{@tv_shows.size} TV Show(s) in #{@path}\n" @episodes = [] initialize_episodes # keep only episodes who needs srt $stdout.print "Found #{@episodes.select { |e| e.need_srt?(@langs) }.size} episode(s) who need(s) srt\n" # Find new srt begin Podnapisi.new(self) rescue => e log.fatal "Problem with Podnapisi: #{e}" end begin TVSubtitle.new(self) rescue => e log.fatal "Problem with TVSubtitle: #{e}" end begin SeriesSub.new(self) rescue => e log.fatal "Problem with SeriesSub: #{e}" end end |
Instance Attribute Details
#episodes ⇒ Object
Returns the value of attribute episodes.
9 10 11 |
# File 'lib/inspector.rb', line 9 def episodes @episodes end |
#langs ⇒ Object
Returns the value of attribute langs.
9 10 11 |
# File 'lib/inspector.rb', line 9 def langs @langs end |
#log ⇒ Object
Returns the value of attribute log.
9 10 11 |
# File 'lib/inspector.rb', line 9 def log @log end |
#tv_shows ⇒ Object
Returns the value of attribute tv_shows.
9 10 11 |
# File 'lib/inspector.rb', line 9 def tv_shows @tv_shows end |
Class Method Details
.growl(title, msg, icon, pri = 0) ⇒ Object
52 53 54 |
# File 'lib/inspector.rb', line 52 def self.growl(title, msg, icon, pri = 0) system("/usr/local/bin/growlnotify -w -n autosub --image #{File.dirname(__FILE__) + "/../asset/#{icon}"} -p #{pri} -m #{msg.inspect} #{title} &") end |