Class: MovieOrganizer::Organizer
- Inherits:
-
Object
- Object
- MovieOrganizer::Organizer
- Defined in:
- lib/movie_organizer/organizer.rb
Instance Attribute Summary collapse
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#options ⇒ Object
Returns the value of attribute options.
Class Method Summary collapse
-
.instance ⇒ Object
Make a singleton but allow the class to be instantiated for easier testing.
Instance Method Summary collapse
-
#initialize ⇒ Organizer
constructor
A new instance of Organizer.
- #start ⇒ Object
Constructor Details
Instance Attribute Details
#logger ⇒ Object
Returns the value of attribute logger.
9 10 11 |
# File 'lib/movie_organizer/organizer.rb', line 9 def logger @logger end |
#options ⇒ Object
Returns the value of attribute options.
9 10 11 |
# File 'lib/movie_organizer/organizer.rb', line 9 def @options end |
Class Method Details
.instance ⇒ Object
Make a singleton but allow the class to be instantiated for easier testing
12 13 14 |
# File 'lib/movie_organizer/organizer.rb', line 12 def self.instance @instance || new end |
Instance Method Details
#start ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/movie_organizer/organizer.rb', line 20 def start start_time = Time.now @options = collect_args logger.info('Starting MovieOrganizer...'.green) count = 0 # Enumerate all of the new source media @media_list = MediaList.new(MovieOrganizer.source_directories) # Process each source file @media_list.file_collection.each do |file| # Get movie or TV show information so we can rename the file if necessary media = Media.subtype(file, ) # Move and/or rename the file logger.info("Processing [#{file}] - #{media.class.to_s.yellow}") media.process! count += 1 end elapsed = Time.now - start_time logger.info("Processed #{count} vidoes in [#{elapsed}] seconds.".yellow) end |