timestamp_maker 1.1.0 → 1.2.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
  SHA256:
3
- metadata.gz: ed37875d238df5bcc9566649a2767aff49522b6baab2f2c5bb07f4a788e38f5b
4
- data.tar.gz: 14647536fd8c17f34a02e9b7d4542e8c154561fcea3c569a18613fa174338ecf
3
+ metadata.gz: 42381622c6bc152ee1ca0d7b69e37de3694e2bc656f2364523eee7e0f61b8027
4
+ data.tar.gz: 38649f363088143afdb178ddacfac05ed617b53af2c1d685ecb24f75e416212d
5
5
  SHA512:
6
- metadata.gz: e8289f87c08d1f3b81f7f8835cf02a68e197cba768425f962a3d16e8b2fcb8567cb6cb675aa1e4e5ed762dfe077509cb74fb18b3394bf32952d2ed7e1c0e5c32
7
- data.tar.gz: 063ccdfd4dbe3a585238b44e20a6728aff9faef849499efeb303b47154488f347644e934bb78eb1b177fd53ea43372c27bc6780ab29de4fe4e34dff0b08aceab
6
+ metadata.gz: 3822ff2a0ef886a63b61d075f88899fcb5636be686323212c6636afc817e4ccc66f4c0436e424fe06d8a73e1da7bcc983ef0a44f76be75cf8ccdcb81b15b69aa
7
+ data.tar.gz: 7b8de123fc936bb49c10fcd4f6cad59ba954d6ad7e6f6272109b71249447284fd9d44f9f58899a0cce7d8d5ee0f03cafead1c89672cc32ecb88b38cff03578f6
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'open3'
4
4
  require 'time'
5
+ require 'English'
5
6
 
6
7
  module TimestampMaker
7
8
  module ImageTimestamper
@@ -28,7 +29,7 @@ module TimestampMaker
28
29
  )
29
30
  time_string = time.strftime(format)
30
31
  command = %W[
31
- magick convert #{input_path}
32
+ convert #{input_path}
32
33
  (
33
34
  -background #{background_color}
34
35
  -fill #{font_color}
@@ -44,18 +45,18 @@ module TimestampMaker
44
45
  -geometry +#{x}+#{y}
45
46
  -composite #{output_path}
46
47
  ]
47
- system(*command, exception: true)
48
+ raise "Command failed with exit #{$CHILD_STATUS.exitstatus}: #{command.first}" unless system(*command)
48
49
  end
49
50
 
50
51
  def self.creation_time(input_path)
51
52
  command = %W[
52
- magick identify -format %[exif:DateTime*]%[exif:OffsetTime*] #{input_path}
53
+ identify -format %[exif:DateTime*]%[exif:OffsetTime*] #{input_path}
53
54
  ]
54
55
 
55
56
  stdout_string, status = Open3.capture2(*command)
56
57
  raise unless status.success?
57
58
 
58
- parsed = Hash[stdout_string.split("\n").map!{ _1[5..].split('=') }]
59
+ parsed = Hash[stdout_string.split("\n").map! { |i| i[5..-1].split('=') }]
59
60
 
60
61
  time_string = parsed['DateTimeOriginal'] || parsed['DateTimeDigitized'] || parsed['DateTime']
61
62
  raise 'Cannot find creation time' if time_string.nil?
@@ -3,6 +3,7 @@
3
3
  require 'json'
4
4
  require 'time'
5
5
  require 'open3'
6
+ require 'English'
6
7
 
7
8
  module TimestampMaker
8
9
  module VideoTimestamper
@@ -23,7 +24,7 @@ module TimestampMaker
23
24
  )
24
25
  creation_timestamp = time.to_i
25
26
  text = "%{pts:localtime:#{creation_timestamp}:#{escape_text_expansion_argument(format)}}"
26
- drawtext = "#{coord_map(coordinate_origin, x, y)}:" << %W[
27
+ drawtext = +"#{coord_map(coordinate_origin, x, y)}:" << %W[
27
28
  font=#{escape_filter_description_value(font_family)}
28
29
  fontsize=#{font_size}
29
30
  fontcolor=#{font_color}
@@ -56,12 +57,12 @@ module TimestampMaker
56
57
  when '-' then '+'
57
58
  else raise "Cannot parse time zone: #{string}"
58
59
  end
59
- "#{sign}#{string[1..]}"
60
+ "#{sign}#{string[1..-1]}"
60
61
  end
61
62
  end
62
63
  else raise TypeError
63
64
  end
64
- system({ 'TZ' => tz }, *command, exception: true)
65
+ raise "Command failed with exit #{$CHILD_STATUS.exitstatus}: #{command.first}" unless system({ 'TZ' => tz }, *command)
65
66
  end
66
67
 
67
68
  def creation_time(input_path)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: timestamp_maker
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Weihang Jian
@@ -92,7 +92,10 @@ required_ruby_version: !ruby/object:Gem::Requirement
92
92
  requirements:
93
93
  - - ">="
94
94
  - !ruby/object:Gem::Version
95
- version: '0'
95
+ version: '2.5'
96
+ - - "<"
97
+ - !ruby/object:Gem::Version
98
+ version: '4'
96
99
  required_rubygems_version: !ruby/object:Gem::Requirement
97
100
  requirements:
98
101
  - - ">="