phtools 0.7.7 → 0.8.0

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: fdb79b3f95706f20dc3105e159bba0228c5b7542
4
- data.tar.gz: 976d6852897171998919dcbb3d771f46d729ae10
3
+ metadata.gz: 35103e10dc96a7315a527248a7e295f5b336b52e
4
+ data.tar.gz: c0a2fcd464db08183e823fc1759d423f885d5843
5
5
  SHA512:
6
- metadata.gz: 5e996378046496d338500dfb1d8c4762b8f640684469db603c84a89a29f68d1219e96341c610254de6146785e2295b13caccae6ec64a97915c03bc10587c539b
7
- data.tar.gz: 5214e3b953ef6dfd445df54f05115adb887cb4f595fed8f57b03cbafe875afa870d0aff7fee5176895d1fcf6015fae38830891d98e7dd5250e9ebf8a44fb6fe6
6
+ metadata.gz: 6012cc53aeda379d7cb75f6df82378998044bdac8d3a5276036953490a5fb54c3e1844575c0a4b6d4cc86de0f3cdd583799955aaeb47f30abeca6f33fafe8756
7
+ data.tar.gz: 639149c172010838bd0972e7356f30fce64350035bf42c63b45fdda471e4be4fa2ff67901cac424a607dfe6e662c515cf918c8e75a0413f94d9fd6dd2e217de6
data/History.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # RELEASED
2
2
 
3
+ ## [v0.8.0](https://github.com/andrewbiz/phtools/compare/v0.7.7...v0.8.0)
4
+
5
+ ## [v0.7.7](https://github.com/andrewbiz/phtools/compare/v0.6.0...v0.7.7)
6
+ * phrename: added --shift_time option
7
+ * phrename is idempotent (safe to be re-run several times on one file)
8
+ * phrename: by-default now it scans several EXIF tags to retreive date-time creation info. If no tags are found - File ModifyDate (mtime) is used to rename file. See more details in `phrename -h`
9
+ * phrename becomes more informative: reports which EXIF tag was taken, or if the date-time in name was kept unchanged. This flow goes to STDERR to keep STDOUT clean
10
+ * phbackup now preserves FileModify dates
11
+ * internal improvements: switch to mini_exiftool gem, get rid of nesty gem (using standard Ruby *cause* for Exceptions)
12
+
3
13
  ## [v0.6.0](https://github.com/andrewbiz/phtools/compare/v0.4.0...v0.6.0)
4
14
  * phmove: does not keep unused empty VIDEO and RAW folders
5
15
  * phrename: --clean option renames files back to original state
data/README.md CHANGED
@@ -106,7 +106,7 @@ I get all photos in `~/Desktop/assets_staging` renamed to it's original names.
106
106
 
107
107
  #### USE CASE 2.3 Change author nickname in the filenames
108
108
  #### Given
109
- I have several photo files in my working folder `~/Desktop/assets_staging` renamed to PHTOOLS standard. Some photos were made by ANB, some photos were made by Alex (nick _ALE_)
109
+ I have several photo files in my working folder `~/Desktop/assets_staging` renamed to PHTOOLS standard. Some photos were made by ANB, some photos were made by Alex (nick _ALE_)
110
110
 
111
111
  And I want to change the author NICKNAME _ALE_ to _ALX_.
112
112
 
@@ -122,7 +122,7 @@ I get all _ALE_ photos in `~/Desktop/assets_staging` renamed to _ALX_ nickname.
122
122
 
123
123
  And all _ANB_ photos are kept unchanged.
124
124
 
125
- _Note. `phrename` is smart enough to let the user to run it several times on one file. Every time `phrename -a` invoked it overwrites information added by previuos `phrename` run._
125
+ _Note. `phrename` is smart enough to let the user to re-run it several times on one file. Every time `phrename -a` re-runs it only overwrites author nickname (if it is different) keeping date-time-in-the-name unchanged._
126
126
 
127
127
  ==========
128
128
 
@@ -130,7 +130,7 @@ _Note. `phrename` is smart enough to let the user to run it several times on one
130
130
  #### Given
131
131
  I have several video files taken by iPhone in my working folder `~/Desktop/assets_staging` renamed to PHTOOLS standard.
132
132
 
133
- And I've found out that iPhone gives the wrong value to CreateDate tag (in my case the error is minus 2 hours to real time of creation). Because of that 'phrename' gives the wrong _YYYYmmdd-HHMMSS_ timestamp in the filename. I want to get the correct date-time info in the names of video files.
133
+ And I've found out that iPhone gives the wrong value to CreateDate tag (in my case the error is minus 2 hours to real time of creation). Because of that 'phrename' gives the wrong _YYYYmmdd-HHMMSS_ timestamp in the filename. I want to get the correct date-time info in the names of video files.
134
134
 
135
135
  #### When
136
136
  I run:
@@ -148,7 +148,7 @@ I get all _mov_ files in `~/Desktop/assets_staging` renamed with correct _YYYYmm
148
148
  ### PHTOOLS Standard file name
149
149
  PHTOOLS standard file name looks like this: **`YYYYmmdd-HHMMSS_AAA ORIGINAL.EXT`**, where
150
150
 
151
- **YYYYmmdd-HHMMSS** - photo creation datestamp (year-month-day-hours-minutes-seconds). By default PHTOOLS use the value of EXIF tag `DateTimeOriginal` or `CreateDate` for this purpose.
151
+ **YYYYmmdd-HHMMSS** - photo creation datestamp (year-month-day-hours-minutes-seconds). By default PHTOOLS use the value of EXIF tag groups `DateTimeOriginal` or `CreateDate` for this purpose _(for more details see phrename help: `phrename -h`)_.
152
152
 
153
153
  **AAA** - author nikname. 3 character long, only latin alphabet supported.
154
154
 
data/TODO.md CHANGED
@@ -1,16 +1,42 @@
1
+ ### PHTOOLS Core
1
2
  - [x] core - runner.rb: print class instance variables in debug mode
3
+ - [x] get rid of nesty
4
+ - [x] switch to fresh MiniExiftool gem
5
+
6
+ ### phls
2
7
  - [x] phls: use init method to initialize variables
3
8
  - [x] phls: change -r to -R
4
9
  - [ ] phls: make it work with .folders (like ftls did)
10
+
11
+ ### phmove
5
12
  - [x] phmove: create phmove tool based on ftarrange code (see ftools repo)
6
13
  - [x] phmove: make target_folder as parameter not an option
7
14
  - [x] phmove: -a (--arrange) parameter means to put photo, video, raw files into separate folders inside target. If -a is not set all files are moved to root of target directory (plain collection of files)
8
15
  - [x] phmove: delete unused empty RAW and VIDEO folders
9
16
  - [ ] phmove: make options to set video, raw folder names
17
+
18
+ ### phrename
10
19
  - [x] phrename: add -c --clean option (based on ftclname functionality)
11
20
  - [x] phrename: add -s --shift_time option (based on ftfixdate functionality)
12
21
  - [x] phrename: by-default read tags for DateTime in this order: DateTimeOriginal, DateCreated, CreateDate, DigitalCreationDate, FileModifyDate (eqv to File::mtime). 1st non-zero value will be taken as a master photo creation timestamp. It means no longer names like '00000101-000000_ANB IMG_0183.PNG' will appear.
13
22
  - [x] phrename: make it safe and smart. Once the file was renamed to PHTOOL standard, re-run of phrename should not change the date-time info unless options -t or -s are used. If user wants to reset file name using exif tag - 1st clean it `phrename --clean`, then rename `phrename -a anb`
14
23
  - [ ] phrename: make new usage mode: `phrename -t TAG`. Useful if user wants to re-set date-time using TAG keeping author-nickname unchanged
15
- - [x] get rid of nesty
16
- - [x] switch to fresh MiniExiftool gem
24
+
25
+ ### phgettags
26
+ - [ ] create phgettags (based on ftmtags)
27
+
28
+ ### phfixfmd
29
+ - [x] create phfixfmd - fix FileModifyDate to get equal to date-time-in-the-name
30
+
31
+ ### phfixdto
32
+ - [ ] create phfixdto - fix MWG:DateTimeOriginal = date-time-in-name
33
+ - [ ] phfixdto: make -N --no_run option = no running exiftool script, only preparation
34
+
35
+ ### phevent
36
+ - [ ] create phevent (based on ftevent)
37
+ - [ ] phevent: -T --template - gets empty template for event.yaml
38
+
39
+ ### phsettags
40
+ - [ ] create phsettags (based on fttagset)
41
+ - [ ] phsettags: make -N --no_run option = no running exiftool script, only preparation
42
+ - [ ] phsettags: -T --template - gets empty templates for authors.yaml and places.yaml
data/exe/phfixfmd ADDED
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: UTF-8
3
+ # (c) ANB Andrew Bizyaev
4
+
5
+ module PhTools
6
+ tool_name = File.basename(__FILE__)
7
+ require "#{tool_name}"
8
+
9
+ file_type = FILE_TYPE_IMAGE + FILE_TYPE_VIDEO + FILE_TYPE_AUDIO
10
+ usage = <<DOCOPT
11
+ ***************************************************
12
+ phtools - *Keep Your Photos In Order* (c) ANB
13
+ ***************************************************
14
+ #{tool_name} changes an input file modify-date according to the date encoded
15
+ in the filename (date-time-in-the-name). Therefore the file should be renamed
16
+ to phtools Standard Name before using this command (use phrename for this).
17
+ #{tool_name} acts as a 'filter' program meaning it expects the input files
18
+ to be passed to STDIN and after the job is done it produces STDOUT with the list
19
+ of processed files. In other words this command is intended to be used with
20
+ other programs connected via pipes, e.g.:
21
+ phls | phrename -a anb | #{tool_name} | phmove ~/targed/folder
22
+
23
+ Usage:
24
+ #{tool_name} [-D]
25
+ #{tool_name} -h | --help
26
+ #{tool_name} -v | --version
27
+
28
+ Options:
29
+ -D --debug Turn on debugging (verbose) mode
30
+ -h --help Show this screen.
31
+ -v --version Show version.
32
+ DOCOPT
33
+
34
+ PhTools.const_get(tool_name.capitalize).new(usage, file_type).run!
35
+ end
data/lib/phfixfmd.rb CHANGED
@@ -6,8 +6,22 @@ require 'phtools/runner'
6
6
 
7
7
  module PhTools
8
8
  class Phfixfmd < Runner
9
+
9
10
  def self.about
10
- "!UNDER CONSTRUCTION!"
11
+ "fixes FileModifyDate to be equal to date-time-in-the-name"
12
+ end
13
+
14
+ private
15
+
16
+ def process_file(phfile)
17
+ fail PhTools::Error, 'wrong date-time in the name' unless
18
+ phfile.date_time_ok?
19
+ begin
20
+ File.utime(Time.now, phfile.date_time_to_time, phfile.filename)
21
+ rescue
22
+ raise PhTools::Error.new, 'setting file modify date'
23
+ end
24
+ phfile
11
25
  end
12
26
  end
13
27
  end
@@ -1,4 +1,4 @@
1
1
 
2
2
  module PhTools
3
- VERSION = '0.7.7'
3
+ VERSION = '0.8.0'
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.7.7
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Bizyaev
@@ -240,6 +240,7 @@ email:
240
240
  - andrew.bizyaev@gmail.com
241
241
  executables:
242
242
  - phbackup
243
+ - phfixfmd
243
244
  - phls
244
245
  - phmove
245
246
  - phrename
@@ -261,6 +262,7 @@ files:
261
262
  - bin/setup
262
263
  - bin/stmux
263
264
  - exe/phbackup
265
+ - exe/phfixfmd
264
266
  - exe/phls
265
267
  - exe/phmove
266
268
  - exe/phrename