Class: MovieCleaner::Cleaner
- Inherits:
-
Object
- Object
- MovieCleaner::Cleaner
- Defined in:
- lib/movie_cleaner/cleaner.rb
Overview
Cleaner prints commands to remove all unwanted movie files in a directory
Instance Method Summary collapse
-
#initialize(base_path, verbose = false, possible_resolutions = nil) ⇒ Cleaner
constructor
A new instance of Cleaner.
- #print_rm_commands ⇒ Object
- #sub_par_files ⇒ Object
Constructor Details
#initialize(base_path, verbose = false, possible_resolutions = nil) ⇒ Cleaner
Returns a new instance of Cleaner.
6 7 8 9 10 |
# File 'lib/movie_cleaner/cleaner.rb', line 6 def initialize(base_path, verbose = false, possible_resolutions = nil) @base_path = base_path @verbose = verbose @possible_resolutions = possible_resolutions || %w[1080p 720p] end |
Instance Method Details
#print_rm_commands ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/movie_cleaner/cleaner.rb', line 20 def print_rm_commands sub_par_files_per_movie.each do |movie, files| vputs "Found sub-par files for movie '#{movie}':" print_rm_commands_for_files(movie, files) vputs '' end end |
#sub_par_files ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/movie_cleaner/cleaner.rb', line 12 def sub_par_files sub_par_files_per_movie.flat_map do |movie, files| next if files.empty? files.map { |file| full_path(movie, file) } end.compact end |