photein 0.2.10 → 0.2.12

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
  SHA256:
3
- metadata.gz: 0e527fda3c81663cec8265d021d3a08d4c0f47f7370cf92e0dca7c1d299bb12f
4
- data.tar.gz: 3524e71c76cc37e3a06202826d81c88f9bdd51ad2e3cfb7f25e00d5960d6b22e
3
+ metadata.gz: 9809a53258cb2fdb69a93f6b702593e3198e78d12278b8c55a370767c9620a01
4
+ data.tar.gz: 20ee565726b9fd2a9b073dc0684d0e9ba315d2673e0d58106696a794cefa5b34
5
5
  SHA512:
6
- metadata.gz: 78abbf645848b2e04d04e3b02fceb5e3f309fbaeff0dba794d83353a22783a81f3876497cb2017a688a90cecf60f0c51c781a66b3f87f5f03a9c110b6c8d899f
7
- data.tar.gz: b45a4db66e0495346039c9d7cba7df2696853e3a6cf896d05a53e2983f1a01d1b88856ecaef35570b1b010e44c2e3a5d61d948e922467c85ed43090da6b49ddf
6
+ metadata.gz: 6d6511d772b0bc39368831aa1e6bea6681d5fe60273fa67ed3f8dcedea42bc9c92bd8d9884752d48ca53676c5d029ad115dbca43b14fb410b4cce1a77073542f
7
+ data.tar.gz: 9a8b9817a7027fdd03d9681baa22e48ec5f0ccb4f5984ac2c45bd2394e35b0071bbf441d785aeb8fabdf68365bf227598c9f2f11f49f5fb0bf0987d5fff74174
data/README.md CHANGED
@@ -106,15 +106,12 @@ $ gem install photein
106
106
  * Ruby 2.6+
107
107
  * [ExifTool][]
108
108
  * [MediaInfo][]
109
- files)
110
109
  * ImageMagick (for `--optimize-for=web` option)
111
110
  * OptiPNG (for `--optimize-for=web` option)
112
111
  * ffmpeg (for `--optimize-for={web,desktop}` options)
113
- * [mkvtoolnix][] (for `--shift-timestamp` / `--local-tz` options on .webm
114
112
 
115
113
  [ExifTool]: https://exiftool.org/
116
114
  [MediaInfo]: https://mediaarea.net/MediaInfo
117
- [mkvtoolnix]: https://mkvtoolnix.download/
118
115
 
119
116
  Usage
120
117
  -----
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Photein
4
- VERSION = '0.2.10'
4
+ VERSION = '0.2.12'
5
5
  end
data/lib/photein/video.rb CHANGED
@@ -21,7 +21,6 @@ module Photein
21
21
  SUPPORTED_FORMATS = %w(
22
22
  .mov
23
23
  .mp4
24
- .mkv
25
24
  .webm
26
25
  ).freeze
27
26
 
@@ -75,7 +74,8 @@ module Photein
75
74
  # Video timestamps are typically UTC, and must be adjusted to local TZ.
76
75
  # Look for GPS tags first, then default to system local TZ.
77
76
  def timestamp_from_metadata
78
- MediaInfo.from(path.to_s).general.encoded_date
77
+ MediaInfo.from(path.to_s).general.recorded_date ||
78
+ MediaInfo.from(path.to_s).general.encoded_date
79
79
  rescue MediaInfo::EnvironmentError
80
80
  Photein.logger.error('mediainfo is required to read timestamp metadata')
81
81
  raise
@@ -161,28 +161,14 @@ module Photein
161
161
  return if config.timestamp_delta.zero? && config.local_tz.nil?
162
162
 
163
163
  args = []
164
+ args.push("-AllDates=#{new_timestamp.strftime('%Y:%m:%d\\ %H:%M:%S')}") if config.timestamp_delta != 0
164
165
 
165
- case path.extname
166
- when '.mp4', '.mov'
167
- args.push("-AllDates=#{new_timestamp.strftime('%Y:%m:%d\\ %H:%M:%S')}") if config.timestamp_delta != 0
168
-
169
- if (lat, lon = config.tz_coordinates)
170
- args.push("-xmp:GPSLatitude=#{lat}")
171
- args.push("-xmp:GPSLongitude=#{lon}")
172
- end
173
-
174
- system("exiftool -overwrite_original #{args.join(' ')} #{path}", out: File::NULL, err: File::NULL)
175
- when '.webm', '.mkv'
176
- args.concat(['--set', "date=#{new_timestamp.strftime('%FT%H:%M:%SZ')}"]) if config.timestamp_delta != 0
177
-
178
- # FIXME
179
- if (lat, lon = config.tz_coordinates)
180
- args.push("-xmp:GPSLatitude=#{lat}")
181
- args.push("-xmp:GPSLongitude=#{lon}")
182
- end
183
-
184
- system("mkvpropedit #{path} #{args.join(' ')}", out: File::NULL, err: File::NULL)
166
+ if (lat, lon = config.tz_coordinates)
167
+ args.push("-xmp:GPSLatitude=#{lat}")
168
+ args.push("-xmp:GPSLongitude=#{lon}")
185
169
  end
170
+
171
+ system("exiftool -overwrite_original #{args.join(' ')} #{path}", out: File::NULL, err: File::NULL)
186
172
  end
187
173
  end
188
174
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: photein
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.10
4
+ version: 0.2.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Lue
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-07-11 00:00:00.000000000 Z
10
+ date: 2025-07-28 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: activesupport