Class: Vera::Timestamp
- Inherits:
-
Object
- Object
- Vera::Timestamp
- Defined in:
- lib/vera/timestamp.rb
Class Method Summary collapse
- .execute(options) ⇒ Object
- .fix_timestamp_in(path) ⇒ Object
- .rename_files_with_date(path, ext, date_property) ⇒ Object
Class Method Details
.execute(options) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/vera/timestamp.rb', line 5 def self.execute() unless Exiftool.installed? puts ''" You need to install exiftool to use vera. You can run the following command to do it: bash <(curl -Ls https://git.io/JtbuH) "'' return end path = .path path = Dir.pwd if .path.nil? path = File.(path) path end |
.fix_timestamp_in(path) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/vera/timestamp.rb', line 19 def self.(path) rename_files_with_date path, 'ARW', 'DateTimeOriginal' rename_files_with_date path, 'JPG', 'DateTimeOriginal' rename_files_with_date path, 'HEIC', 'DateTimeOriginal' rename_files_with_date path, 'MOV', 'CreationDate' end |
.rename_files_with_date(path, ext, date_property) ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/vera/timestamp.rb', line 26 def self.rename_files_with_date(path, ext, date_property) files = Lister.all_files(path, ext) puts "#{Icons.check} Correcting timestamp for #{files.length} #{ext} files..." if files.empty? puts 'Nothing to do here' return end files_string = files.map { |f| "\"#{f[:path]}\"" }.join(' ') Exiftool. date_property, files_string end |