Class: Hypembot::Bot
- Inherits:
-
Object
- Object
- Hypembot::Bot
- Defined in:
- lib/hypembot.rb
Instance Method Summary collapse
-
#initialize(opts) ⇒ Bot
constructor
A new instance of Bot.
- #start ⇒ Object
Constructor Details
#initialize(opts) ⇒ Bot
Returns a new instance of Bot.
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/hypembot.rb', line 10 def initialize(opts) @source = opts[:source] || "#{ENV['HOME']}/Library/Caches/Google/Chrome/Default/Cache/" @dir = opts[:directory] || "#{ENV["HOME"]}/Music" @min_bitrate = opts[:bitrate] || 125 @min_length = opts[:length] || 60 @dw = DirectoryWatcher.new(@source, :scanner => :em, :pre_load => true, :glob => 'f_*', :stable => 18, :interval => 10) end |
Instance Method Details
#start ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/hypembot.rb', line 24 def start setup # make sure to set ulimit -n 4096 or something similarily high EM.kqueue @dw.start loop { sleep 1000 } end |