Class: FileListGetter
- Inherits:
-
Object
- Object
- FileListGetter
- Defined in:
- lib/bvwack/filelistgetter.rb
Instance Method Summary collapse
- #converted_files ⇒ Object
- #get_all_files ⇒ Object
- #get_unconverted_files ⇒ Object
-
#initialize(options) ⇒ FileListGetter
constructor
A new instance of FileListGetter.
- #not_converted_files ⇒ Object
Constructor Details
#initialize(options) ⇒ FileListGetter
Returns a new instance of FileListGetter.
2 3 4 5 6 7 8 |
# File 'lib/bvwack/filelistgetter.rb', line 2 def initialize() @options = @converted_files = { } @not_converted_files = { } @to_convert = [] get_all_files end |
Instance Method Details
#converted_files ⇒ Object
39 40 41 |
# File 'lib/bvwack/filelistgetter.rb', line 39 def converted_files @converted_files end |
#get_all_files ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/bvwack/filelistgetter.rb', line 10 def get_all_files if @options[:base_dir] base_dir = @options[:base_dir] else base_dir = DEFAULT_CONVERT_BASE_DIR end Dir.chdir(base_dir) converted_files = Dir.glob(File.join("**", "*ipad.mp4")) converted_files.each do |i| if i.include?("bvwack-back") next else @converted_files[File.basename(i, ".ipad.mp4")] = i end end not_converted_files = Dir.glob(File.join("**", "*.{mkv,avi}")) not_converted_files.each do |i| if i.include?("bvwack-back") next else if File.basename(i).split(".").last == "mkv" @not_converted_files[File.basename(i, ".mkv")] = i elsif File.basename(i).split(".").last == "avi" @not_converted_files[File.basename(i, ".avi")] = i end end end end |
#get_unconverted_files ⇒ Object
47 48 49 50 51 52 |
# File 'lib/bvwack/filelistgetter.rb', line 47 def get_unconverted_files (@not_converted_files.keys - @converted_files.keys).each do |key| @to_convert << @not_converted_files[key] end @to_convert end |
#not_converted_files ⇒ Object
43 44 45 |
# File 'lib/bvwack/filelistgetter.rb', line 43 def not_converted_files @not_converted_files end |