Method: Play::Library.monitor

Defined in:
lib/play/library.rb

.monitorObject

Monitors the music directory for any new music added to it. Once changed, Play will run through and reindex those directories.

Returns nothing.



8
9
10
11
12
13
14
# File 'lib/play/library.rb', line 8

def self.monitor
  FSSM.monitor(Play.path, '**/**/**', :directories => true) do
    update {|base, relative| Library.import_songs("#{base}/#{relative}") }
    delete {|base, relative| nil }
    create {|base, relative| Library.import_songs("#{base}/#{relative}") }
  end
end