photein 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/photein +1 -22
- data/lib/photein/config.rb +1 -1
- data/lib/photein/version.rb +1 -1
- data/lib/photein.rb +12 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8005c4c7e035db2675a5f6cdcc0a0567b53aec6117b279d1242c4dae8d671758
|
4
|
+
data.tar.gz: 9d3ddc4eaf083903e45eaa55de9c93bd97c2201777bc676ee815436b427c0641
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 683fd6aa36b788f9e985210e7ae2fc97474b3d155afa04db1d8e1a87c1892b68d9a262e93798b0b3449b83285809e6035c3a82bb4955f1dd3f02f01768173a4f
|
7
|
+
data.tar.gz: 74cfbc6831fb2fbdb88a09dd0d3412ceac70ddc62379bf37e3bc800e442433b9b13d112bdff358cf04276b5ed6d59dc8804ef0fef757d223dcb466ebc726a627
|
data/bin/photein
CHANGED
@@ -33,25 +33,4 @@ at_exit do
|
|
33
33
|
end
|
34
34
|
|
35
35
|
# Core Logic -------------------------------------------------------------------
|
36
|
-
|
37
|
-
.zip(Photein::Image::SUPPORTED_FORMATS.map(&:upcase))
|
38
|
-
.flatten
|
39
|
-
|
40
|
-
SRC_DIR
|
41
|
-
.join(Photein::Config.recursive ? '**' : '')
|
42
|
-
.join("*{#{image_formats.join(',')}}")
|
43
|
-
.then { |glob| Dir[glob].sort }
|
44
|
-
.map(&Photein::Image.method(:new))
|
45
|
-
.each(&:import)
|
46
|
-
|
47
|
-
# Video compression is time-consuming, so save it for last
|
48
|
-
video_formats = Photein::Video::SUPPORTED_FORMATS
|
49
|
-
.zip(Photein::Video::SUPPORTED_FORMATS.map(&:upcase))
|
50
|
-
.flatten
|
51
|
-
|
52
|
-
SRC_DIR
|
53
|
-
.join(Photein::Config.recursive ? '**' : '')
|
54
|
-
.join("*{#{video_formats.join(',')}}")
|
55
|
-
.then { |glob| Dir[glob].sort }
|
56
|
-
.map(&Photein::Video.method(:new))
|
57
|
-
.each(&:import)
|
36
|
+
Photein.run
|
data/lib/photein/config.rb
CHANGED
data/lib/photein/version.rb
CHANGED
data/lib/photein.rb
CHANGED
@@ -8,4 +8,16 @@ require 'photein/image'
|
|
8
8
|
require 'photein/video'
|
9
9
|
|
10
10
|
module Photein
|
11
|
+
class << self
|
12
|
+
def run
|
13
|
+
[Photein::Image, Photein::Video].each do |media_type|
|
14
|
+
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
|
+
.map(&media_type.method(:new))
|
19
|
+
.each(&:import)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
11
23
|
end
|