module MediaFile
Constants
- VERSION
Private Instance Methods
check_transfer(path)
click to toggle source
# File lib/mediafile.rb, line 44 def check_transfer(path) lock { @@transfers.add? path } end
cleanup()
click to toggle source
# File lib/mediafile.rb, line 66 def cleanup @@mutex = nil true end
debug(msg = '')
click to toggle source
# File lib/mediafile.rb, line 81 def debug(msg = '') safe_print("DEBUG: #{caller_locations(1, 2)[0].label} >> #{msg}") if @debug end
error(msg = '')
click to toggle source
# File lib/mediafile.rb, line 89 def error(msg = '') safe_print("ERROR: #{caller_locations(1, 2)[0].label} >> #{msg}") end
info(msg = '')
click to toggle source
# File lib/mediafile.rb, line 85 def info(msg = '') safe_print("INFO: #{caller_locations(1, 2)[0].label} >> #{msg}") if @verbose end
initialize_threads(count = 1)
click to toggle source
# File lib/mediafile.rb, line 50 def initialize_threads(count = 1) return if @@initialized @@thread_count = count if @@thread_count > 1 require 'thread' @@mutex = Mutex.new end @@initialized = true end
lock() { || ... }
click to toggle source
# File lib/mediafile.rb, line 71 def lock if @@mutex && !@@mutex.owned? @@mutex.synchronize do yield end else yield end end
safe_print(message = '') { |: message + "\n"| ... }
click to toggle source
# File lib/mediafile.rb, line 60 def safe_print(message = '') lock { print block_given? ? yield : message + "\n" } end