phtools 0.6.0 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 750f4b068327ffb6e442bd159b3954bc6a4e05a9
4
- data.tar.gz: 0c3dd2cf633fc173198db39b52bf0158b2b4cb83
3
+ metadata.gz: a14a90150116d6d15d806bfbc9cbdee2c31529fe
4
+ data.tar.gz: 1dfe0672729732f267645b94ea15fc5a46f94ece
5
5
  SHA512:
6
- metadata.gz: 67221245339260073f68931c40fcc7c032733c29a82b66e9c2f2515d68d9c91a42f187c06b634e69175bc6e99ef0f2a9231daa3db670c6ba92c561931789d8be
7
- data.tar.gz: b7783f37b130f55dae57a95f285bdee3bf0e65b7ac077e3d46ef01601d83f74ae1dc8e113917ef9ad05bbff2bb3cecb714af14f602ce00fe330465ed684d069e
6
+ metadata.gz: 0d2718da44ccfc5174cf1721c235905bfadae27b11714ee4e978e9389830052ecc069c1e8d61a989a0f72642146f1e995a57bf70ad6a08236b55317df383abae
7
+ data.tar.gz: 0885ca474c5040e1cb52285b003b5a39375b13df8c7c5f9dc2c2ef79775a7a8aa0ac50e06926706a9ed17c197de13f8c6b832e906bae3f7fbde02dc9a18e7198
data/History.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # RELEASED
2
2
 
3
+ ## [v0.6.0](https://github.com/andrewbiz/phtools/compare/v0.4.0...v0.6.0)
4
+ * phmove: does not keep unused empty VIDEO and RAW folders
5
+ * phrename: --clean option renames files back to original state
6
+ * Added phbackup
7
+
8
+
3
9
  ## [v0.4.0](https://github.com/andrewbiz/phtools/compare/v0.3.0.pre.alpha...v0.4.0)
4
10
  * Added description to README.md
5
11
  * Changed phls - option -R instead of -r (ls compatibility)
data/TODO.md CHANGED
@@ -8,4 +8,4 @@
8
8
  - [x] phmove: delete unused empty RAW and VIDEO folders
9
9
  - [ ] phmove: make options to set video, raw folder names
10
10
  - [x] phrename: add -c --clean option (based on ftclname functionality)
11
- - [ ] phrename: add -s --shift_time option (based on ftfixdate functionality)
11
+ - [x] phrename: add -s --shift_time option (based on ftfixdate functionality)
data/exe/phrename CHANGED
@@ -28,6 +28,7 @@ This program uses external utility ExifTool by Phil Harvey
28
28
  Usage:
29
29
  #{tool_name} -a NICK [-D] [-t TAG]
30
30
  #{tool_name} -c [-D]
31
+ #{tool_name} -s DELTA [-D]
31
32
  #{tool_name} -h | --help
32
33
  #{tool_name} -v | --version
33
34
 
@@ -35,11 +36,20 @@ Options:
35
36
  -a NICK --author=NICK Author nickname size should be #{PhFile::NICKNAME_SIZE} chars,
36
37
  supports only latin ASCII chars (e.g. ANB).
37
38
  No digits, no spaces, no other non-word chars allowed.
39
+
38
40
  -t TAG --tag_date=TAG Set the TAG name containing Date_Time creation
39
41
  info. The TAG value will be used instead of
40
42
  standard DateTimeOriginal tag. All existing tags you
41
43
  can get using command `phls filename|phmtags -f`
42
- -c --clean Rename file(s) back to original name(s)
44
+
45
+ -c --clean Rename file(s) back to original name(s)
46
+
47
+ -s DELTA --shift_time=DELTA DELTA (in seconds) will be added to Date-Time value
48
+ of the filename. If DELTA is positive the photo
49
+ will become yonger: e.g. 20140720-100005, DELTA = 65
50
+ result = 20140720-100110. If DELTA is negative the photo
51
+ will get DELTA seconds older.
52
+
43
53
  -D --debug Turn on debugging (verbose) mode
44
54
  -h --help Show this screen.
45
55
  -v --version Show version.
data/lib/phrename.rb CHANGED
@@ -2,6 +2,7 @@
2
2
  # encoding: UTF-8
3
3
  # (c) ANB Andrew Bizyaev
4
4
 
5
+ require 'date'
5
6
  require 'phtools/runner'
6
7
  require 'phtools/mini_exiftool-2.3.0anb'
7
8
 
@@ -22,6 +23,10 @@ module PhTools
22
23
  @user_tag_date = @options_cli['--tag_date'] || ''
23
24
  elsif @options_cli['--clean']
24
25
  @mode = :clean
26
+ elsif @options_cli['--shift_time']
27
+ @mode = :shift_time
28
+ @shift_seconds = @options_cli['--shift_time'].to_i
29
+ fail PhTools::Error, '--shift_time value is not correct' if @shift_seconds.zero?
25
30
  end
26
31
  end
27
32
 
@@ -45,6 +50,10 @@ module PhTools
45
50
 
46
51
  when :clean
47
52
  phfile_out.cleanse!
53
+
54
+ when :shift_time
55
+ fail PhTools::Error, 'incorrect file name' unless phfile_out.basename_is_standard?
56
+ phfile_out.standardize!(date_time: phfile_out.date_time + @shift_seconds*(1.0/86400))
48
57
  end
49
58
 
50
59
  FileUtils.mv(phfile.filename, phfile_out.filename) unless phfile == phfile_out
@@ -29,17 +29,17 @@ module PhTools
29
29
 
30
30
  validate_options
31
31
 
32
- if PhTools.debug
33
- STDERR.puts "Instance Variables: "
34
- STDERR.puts context
35
- end
36
-
37
32
  rescue Docopt::Exit => e
38
33
  STDERR.puts e.message
39
34
  exit 1
40
35
  rescue => e
41
36
  PhTools.puts_error "FATAL: #{e.message}", e
42
37
  exit 1
38
+ ensure
39
+ if PhTools.debug
40
+ STDERR.puts "Runner Instance Variables: "
41
+ STDERR.puts context
42
+ end
43
43
  end
44
44
 
45
45
  def run!
@@ -1,4 +1,4 @@
1
1
 
2
2
  module PhTools
3
- VERSION = '0.6.0'
3
+ VERSION = '0.7.1'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phtools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Bizyaev