Class: Layback::Watcher

Inherits:
Object
  • Object
show all
Defined in:
lib/watcher.rb

Instance Method Summary collapse

Instance Method Details

#watch_dirsObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/watcher.rb', line 12

def watch_dirs
  FileMonitor.watch Settings.dir do
     dirs {
      disallow /\.git$/
    }

    files {
      disallow /.*/
      allow /\.mkv$|\.mp4$|\.avi$/
    }
  exec do |events|
    events.each do |ev|
      file = File.join(ev.watcher.path(), ev.name())
         if File.exist?(file)
           Sl.info file
        Os.download_subs(file)
         end
    end
  end
  end
end