phtools 0.14.0 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 50c505c8d68963e5316f8d25a73ebff6c36522af
4
- data.tar.gz: 1537c9723b68f2f413bb15f0bdee7df181a1f379
3
+ metadata.gz: 78670fe468c1b5d9bbf25c5a5d8460a408354f36
4
+ data.tar.gz: 2566973828624a1aa604b02c0916d46cdec09b55
5
5
  SHA512:
6
- metadata.gz: 589135775c85fb42c059b097207ad2f8d4f7e2c89d63c2e29cb2e96f9301ad18e0084ad68fb26a98f16cb2e30fdd11996d073229f4b3e03338dda2d95d04c087
7
- data.tar.gz: ca264e71b619e5c63ce81e28ac1b0a6d36740bcc9e0cadeec8d3b3628dfe9aea7c4288e191a3e21bfdd3968e4146e96c6daf719aeb9226b3401bd227fdad0732
6
+ metadata.gz: 9fac26d39ead526578a63fac032a39884dec6520b7220da590e476a86bc75013c4cd1490d90af61d22e0e36d49bd1b077bb4d5a40c7cca0db13b4c6cc6a66612
7
+ data.tar.gz: 59fe892d791534da62fbc2e94d675eb38b4fc230ab40ce801601d21d887c9fe47ebad22a99ad5b20237e52d47dc2f9496189888328f698852bff6efec75cfab2
data/History.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # RELEASED
2
2
 
3
+ ## [v0.15.0](https://github.com/andrewbiz/phtools/compare/v0.14.0...v0.15.0)
4
+ * phls now supports --range parameter allowing the user to filter files which name endings are not in the given range
5
+
6
+ ## [v0.14.0](https://github.com/andrewbiz/phtools/compare/v0.10.0...v0.14.0)
7
+ * ruby version required >= 2.4.0
8
+ * phmove: now default TARGET_FOLDER is '.'
9
+ * added 3gp video files support
10
+ * phls: sort files in alphabet order
11
+ * phrename: added new mode - manual rename. User sets date-time-in-the-name, increment and header to generate filename
12
+ * code refactor (code optimizations, ruby 2.4.2 adaptation, new rubocop rules)
13
+
3
14
  ## [v0.10.0](https://github.com/andrewbiz/phtools/compare/v0.8.0...v0.10.0)
4
15
  * phgettags added to the bundle
5
16
  * phfixdto added to the bundle
data/TODO.md CHANGED
@@ -6,8 +6,9 @@
6
6
  ### phls
7
7
  - [x] phls: use init method to initialize variables
8
8
  - [x] phls: change -r to -R
9
- - [ ] phls: make it work with .folders (like ftls did)
10
9
  - [x] phls: sort files in alphabet order
10
+ - [x] phls: support --range parameter to filter files which belong to the range
11
+ - [ ] phls: make it work with .folders (like ftls did)
11
12
 
12
13
  ### phmove
13
14
  - [x] phmove: create phmove tool based on ftarrange code (see ftools repo)
@@ -22,9 +23,9 @@
22
23
  - [x] phrename: add -s --shift_time option (based on ftfixdate functionality)
23
24
  - [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.
24
25
  - [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`
26
+ - [x] phrename: new mode 'manual rename' renames files using given date-time template, author name and prefix. Good for mass renaming of the scanned films and photos (when date-time is not set in the tags and only human knows the real date-time)
25
27
  - [ ] phrename: make new usage mode: `phrename -t TAG`. Useful if user wants to re-set date-time using TAG keeping author-nickname unchanged
26
28
  - [ ] phrename: add QuickTime.CreationDate into analysis when calculate date-time-in-the-name (useful for iOS mov files). In iOS QuickTime.CreateDate is wrong (always in Grinvich zone), while QuickTime.CreationDate is Ok
27
- - [ ] phrename: new mode 'manual rename' renames files using given date-time template, author name and prefix. Good for mass renaming of the scanned films and photos (when date-time is not set in the tags and only human knows the real date-time)
28
29
 
29
30
  ### phgettags
30
31
  - [x] create phgettags (based on ftmtags)
data/exe/phls CHANGED
@@ -30,14 +30,18 @@ module PhTools
30
30
  sends all found phtools friendly files filtered with *aaa* to phrename command.
31
31
 
32
32
  Usage:
33
- #{tool_name} [-D] [-R] [DIR_OR_FILEMASK...]
33
+ #{tool_name} [-D] [-R] [DIR_OR_FILEMASK...] [-r RANGE]
34
34
  #{tool_name} -h | --help
35
35
  #{tool_name} -v | --version
36
36
 
37
37
  Options:
38
38
  -D --debug Turn on debugging (verbose) mode
39
39
  -R --recursive Recursively scan directories
40
- -h --help Show this screen.
40
+ -r RANGE --range=RANGE Sets the range of filename endings to be included
41
+ into the output. Example: -r '05..07' will take only files
42
+ with the filename endings 05, 06, 07 and will not take
43
+ any other files
44
+ -h --help Show this screen
41
45
  -v --version Show version.
42
46
  DOCOPT
43
47
 
data/lib/phls.rb CHANGED
@@ -14,7 +14,7 @@ module PhTools
14
14
 
15
15
  def run!
16
16
  @dirs_to_scan.each do |dir|
17
- fmask = File.join(dir, @options_cli['--recursive'] ? '**' : '', "{#{@filemasks * ','}}")
17
+ fmask = File.join(dir, @recursive ? '**' : '', "{#{@filemasks * ','}}")
18
18
  files = Dir.glob(fmask, File::FNM_CASEFOLD)
19
19
  files_sorted = files.sort_by(&:downcase)
20
20
  files_sorted.each { |f| output_file(PhFile.new(f)) if File.file?(f) }
@@ -37,10 +37,21 @@ module PhTools
37
37
  end
38
38
  @dirs_to_scan = ['.'] if @dirs_to_scan.empty?
39
39
  @filemasks = ['*.*'] if @filemasks.empty?
40
+ @recursive = @options_cli['--recursive']
41
+ @range = @options_cli['--range']
42
+ return unless @range
43
+ /^(?<_range1>[[:alnum:]]+)\.\.(?<_range2>[[:alnum:]]+)/ =~ @range
44
+ @range_start = Regexp.last_match(:_range1)
45
+ @range_end = Regexp.last_match(:_range2)
46
+ @ending_size = [@range_start.size, @range_end.size].max
40
47
  end
41
48
 
42
49
  def output_file(phfile)
43
- @os.output(phfile) if @file_type.include?(phfile.type)
50
+ return unless @file_type.include?(phfile.type)
51
+ if @range
52
+ return unless (@range_start..@range_end).cover?(phfile.basename_clean.slice(-@ending_size, @ending_size))
53
+ end
54
+ @os.output(phfile)
44
55
  end
45
56
  end
46
57
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PhTools
4
- VERSION = '0.14.0'
4
+ VERSION = '0.15.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phtools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.0
4
+ version: 0.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Bizyaev
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-10-31 00:00:00.000000000 Z
11
+ date: 2017-11-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler