Class: Ehbrs::Tools::Runner::Videos::Series::Rename

Inherits:
Object
  • Object
show all
Includes:
EacFs::Traversable
Defined in:
lib/ehbrs/tools/runner/videos/series/rename.rb

Instance Method Summary collapse

Instance Method Details



32
33
34
35
# File 'lib/ehbrs/tools/runner/videos/series/rename.rb', line 32

def banner
  infov 'Paths', paths.count
  infov 'Files found', files.count
end

#files_uncachedObject



37
38
39
40
41
# File 'lib/ehbrs/tools/runner/videos/series/rename.rb', line 37

def files_uncached
  @files = []
  paths.each { |path| traverser_check_path(path) }
  @files
end

#pathsObject



43
44
45
# File 'lib/ehbrs/tools/runner/videos/series/rename.rb', line 43

def paths
  parsed.paths.if_present(['.'])
end

#rename_filesObject



64
65
66
67
68
69
# File 'lib/ehbrs/tools/runner/videos/series/rename.rb', line 64

def rename_files
  return unless series_file_options.confirm

  infom 'Renaming files...'
  files.each(&:rename)
end

#runObject



26
27
28
29
30
# File 'lib/ehbrs/tools/runner/videos/series/rename.rb', line 26

def run
  banner
  show_results
  rename_files
end

#series_file_options_uncachedObject



56
57
58
# File 'lib/ehbrs/tools/runner/videos/series/rename.rb', line 56

def series_file_options_uncached
  ::EhbrsRubyUtils::Videos::Series::Rename::File::Options.new(parsed)
end

#show_resultsObject



60
61
62
# File 'lib/ehbrs/tools/runner/videos/series/rename.rb', line 60

def show_results
  ::EhbrsRubyUtils::Videos::Series::Rename::ResultsBuilder.new(files).show(0)
end

#traverser_check_file(path) ⇒ Object



51
52
53
54
# File 'lib/ehbrs/tools/runner/videos/series/rename.rb', line 51

def traverser_check_file(path)
  @files << ::EhbrsRubyUtils::Videos::Series::Rename::File
              .new(path, series_file_options)
end

#traverser_recursiveObject



47
48
49
# File 'lib/ehbrs/tools/runner/videos/series/rename.rb', line 47

def traverser_recursive
  parsed.recursive
end