Class: Pics
- Inherits:
-
Thor
- Object
- Thor
- Pics
- Defined in:
- lib/pics.rb
Instance Method Summary collapse
Instance Method Details
#downcase ⇒ Object
4 5 6 7 8 9 |
# File 'lib/pics.rb', line 4 def downcase pictures.each do |file| new_name = file.gsub(/\.[a-zA-Z0-9]*$/, '.jpg') File.rename(file, new_name) end end |
#sequentize ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/pics.rb', line 12 def sequentize pictures.each do |file| File.rename(file, "_#{file}") end index = 1 pictures.each do |filename| new_name = "#{'%.10d' % index}.jpg" File.rename(filename, new_name) puts "#{new_name}" index += 1 end end |
#set_exif_dates ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/pics.rb', line 27 def set_exif_dates date = /([0-9]{4})-([0-9]{2})-([0-9]{2})/.match(Dir.pwd).captures y = date[0] m = date[1] d = date[2] if yes?("Are you sure to set exif tags of all JPEG files of this directory to #{y}-#{m}-#{d} ? (y/n)") pictures.each do |filename| puts filename # `jhead -mkexif -ds#{y}:#{m}:#{d} -ft "#{filename}"` end end end |