photein 0.1.1 → 0.1.4

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: 0cc58c5e8f3fad9d829ef5963b0503070ffb4d91e7a766e34acbac7149ad5aeb
4
- data.tar.gz: f2d8a39d9c1c4c0e63354ad273eed73ed4aa2c34b42f2a31699bbf17c90f9282
3
+ metadata.gz: 4c649546f68f5f0547d94bc0dace264051b1b1fd4f37620e7a769939bc6330cd
4
+ data.tar.gz: 0e57a9fff26bf6aab6a49676cea4cf3213626693013ce80e4a9d616051e96091
5
5
  SHA512:
6
- metadata.gz: db242817983284a1dbc2a3f16dc8929197c2e51f4abee657d8bfa179ac555e7a6c8454fb44bb3622ffd97b22c366bee22ed5b688d4c95d2432369b4df7306c2e
7
- data.tar.gz: 0d6a7faef4624037b2f71eee2798d72397cde98f5940727f9ef5878c5a8282b8dc6c836ec70cea59724821d0fe31f9192b3fc590357f9dfe77e942edadea10a5
6
+ metadata.gz: '072889b598976c14a89994fe61ecd24c47f73d34e3f8c090df002ddb92684ca145285bf7b891e98023f0947ed04e602b0335dc0504dcddfe8dba1b7689d1911d'
7
+ data.tar.gz: e355d41fe3ce4c9bf86ac243524abecac43f595df2eb67f43344098a0e3348edad55ab43af6746efd421021c53706aed0f0b76b1cfe63dfcefb8cdc69ad53174
@@ -74,10 +74,10 @@ module Photein
74
74
 
75
75
  def destinations
76
76
  @destinations ||= {
77
- master: Pathname(@params[:'library-master']),
78
- desktop: Pathname(@params[:'library-desktop']),
79
- web: Pathname(@params[:'library-web'])
80
- }.compact
77
+ master: @params[:'library-master'],
78
+ desktop: @params[:'library-desktop'],
79
+ web: @params[:'library-web']
80
+ }.compact.transform_values(&Pathname.method(:new))
81
81
  end
82
82
  end
83
83
  end
data/lib/photein/image.rb CHANGED
@@ -85,8 +85,8 @@ module Photein
85
85
  Time.strptime(filename, 'IMG-%Y%m%d-WA%M%S')
86
86
  when /^IMG_\d{8}_\d{6}_\d{3}$/ # Telegram: datetime in milliseconds (at download)
87
87
  Time.strptime(filename, 'IMG_%Y%m%d_%H%M%S_%L')
88
- when /^signal-\d{4}-\d{2}-\d{2}-\d{6}( \(\d+\))?$/ # Signal: datetime + optional counter (at receipt)
89
- Time.strptime(filename[0, 24], 'signal-%F-%H%M%S')
88
+ when /^signal-\d{4}(-\d{2}){5}[-\d]*$/ # Signal: datetime + optional counter (at receipt)
89
+ Time.strptime(filename[0, 26], 'signal-%F-%H-%M-%S')
90
90
  when /^\d{13}$/ # LINE: UNIX time in milliseconds (at download)
91
91
  Time.strptime(filename[0..-4], '%s')
92
92
  else
@@ -54,7 +54,7 @@ module Photein
54
54
  FileUtils.chmod('-x', dest_path, noop: Photein::Config.dry_run)
55
55
  end
56
56
  end
57
- end.each(&:join)
57
+ end.compact.each(&:join)
58
58
 
59
59
  FileUtils.rm(path, noop: Photein::Config.dry_run || Photein::Config.keep)
60
60
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Photein
4
- VERSION = '0.1.1'
4
+ VERSION = '0.1.4'
5
5
  end
data/lib/photein.rb CHANGED
@@ -11,10 +11,13 @@ module Photein
11
11
  class << self
12
12
  def run
13
13
  [Photein::Image, Photein::Video].each do |media_type|
14
+ # Why not use Dir.glob? It refuses to do case-insensitive matching on Linux
15
+ ftype_regex = /(#{media_type::SUPPORTED_FORMATS.join('|').gsub('.', '\.')})$/i
16
+
14
17
  Pathname(Photein::Config.source)
15
- .join(Photein::Config.recursive ? '**' : '')
16
- .join("*{#{media_type::SUPPORTED_FORMATS.join(',')}}")
17
- .then { |glob| Dir.glob(glob, File::FNM_CASEFOLD).sort }
18
+ .join(Photein::Config.recursive ? '**' : '', '*')
19
+ .then(&Dir.method(:glob)).sort
20
+ .select { |file| file.match?(ftype_regex) }
18
21
  .map(&media_type.method(:new))
19
22
  .each(&:import)
20
23
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: photein
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Lue
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-10 00:00:00.000000000 Z
11
+ date: 2022-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mediainfo
@@ -144,7 +144,7 @@ licenses:
144
144
  - MIT
145
145
  metadata:
146
146
  source_code_uri: https://github.com/rlue/photein
147
- post_install_message:
147
+ post_install_message:
148
148
  rdoc_options: []
149
149
  require_paths:
150
150
  - lib
@@ -159,8 +159,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
159
159
  - !ruby/object:Gem::Version
160
160
  version: '0'
161
161
  requirements: []
162
- rubygems_version: 3.2.3
163
- signing_key:
162
+ rubygems_version: 3.3.7
163
+ signing_key:
164
164
  specification_version: 4
165
165
  summary: Import/rename photos & videos from one directory to another.
166
166
  test_files: []