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.
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 47 48 49 50 51 52 53 |
# File 'lib/inspector.rb', line 13 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 BetaSeries.new(self) rescue => e log.fatal "Problem with BetaSeries: #{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 # begin # Podnapisi.new(self) # rescue => e # log.fatal "Problem with Podnapisi: #{e}" # end end |
Instance Attribute Details
#episodes ⇒ Object
Returns the value of attribute episodes.
11 12 13 |
# File 'lib/inspector.rb', line 11 def episodes @episodes end |
#langs ⇒ Object
Returns the value of attribute langs.
11 12 13 |
# File 'lib/inspector.rb', line 11 def langs @langs end |
#log ⇒ Object
Returns the value of attribute log.
11 12 13 |
# File 'lib/inspector.rb', line 11 def log @log end |
#tv_shows ⇒ Object
Returns the value of attribute tv_shows.
11 12 13 |
# File 'lib/inspector.rb', line 11 def tv_shows @tv_shows end |
Class Method Details
.growl(title, msg, icon, pri = 0) ⇒ Object
59 60 61 |
# File 'lib/inspector.rb', line 59 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 |