video_sprites 0.1.0 → 0.2.0

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
  SHA1:
3
- metadata.gz: ff00cddcb56e85f7007f4bb2e72a170ad45558ed
4
- data.tar.gz: 2b16074efb0f73297c96ed11ac123a9633e87834
3
+ metadata.gz: 7fd798b6e90c856b1e6f8cf1ab7807823e639726
4
+ data.tar.gz: 1580221398ed8fa6b3449d2548b682983b2a9c42
5
5
  SHA512:
6
- metadata.gz: d3f5c637742386b98cfdd6602f0f620fe59ab0491ff149952c737f12bc7140fa0245b56ef95ab64d6ab7400781a09a7a77062cdc0b903c98a3fd7ab20dc6fee4
7
- data.tar.gz: ea99033ea838ef2abe6941aa934f329e81ce2445b777f5a780a04f35da2bb41eee8b3c185725ff4135b944973c13449df851b3a10200ded61d3ef85a6fa1092d
6
+ metadata.gz: 2ccac2aeaeb83ed3c826ed662173b02be66517ff79735b3d083754664c7a004bbf1a21b53a48fa899d733a04d4dd31e111fb4660ed972871db9ef60e0809219b
7
+ data.tar.gz: a608846ad6850db96ec0b5845438784ef17b78ba8b535af0a1ba0685b7fd75063fd5735be1521fd712bef755aed9ed57ff86d15029310e90b57cac5cd65321c6
data/README.md CHANGED
@@ -47,7 +47,8 @@ options = {
47
47
  width: 160,
48
48
  columns: 4,
49
49
  group: 20,
50
- gif: false
50
+ gif: false,
51
+ keep_images: false
51
52
  }
52
53
  processor = VideoSprites::Processor.new(input_file, output_directory, options)
53
54
  processor.process
@@ -3,11 +3,12 @@ module VideoSprites
3
3
  class CLI < Thor
4
4
 
5
5
  desc "process <input_file> <output_directory>", "Create video thumbnail sprites"
6
- option :seconds, default: 10, type: :numeric
7
- option :width, default: 200, type: :numeric
8
- option :columns, default: 5, type: :numeric
9
- option :group, default: 20, type: :numeric
10
- option :gif, default: false, type: :boolean
6
+ option :seconds, default: 10, type: :numeric
7
+ option :width, default: 200, type: :numeric
8
+ option :columns, default: 5, type: :numeric
9
+ option :group, default: 20, type: :numeric
10
+ option :gif, default: false, type: :boolean
11
+ option :keep_images, default: false, type: :boolean
11
12
  def process(input_file, output_directory)
12
13
  processor = VideoSprites::Processor.new(input_file, output_directory, options)
13
14
  processor.process
@@ -13,6 +13,9 @@ module VideoSprites
13
13
  create_sprites
14
14
  create_webvtt
15
15
  create_gif if @options[:gif]
16
+ if @options[:keep_images]
17
+ move_images
18
+ end
16
19
  clean_temporary_directory
17
20
  end
18
21
 
@@ -135,7 +138,7 @@ module VideoSprites
135
138
 
136
139
  # TODO: make basename configurable
137
140
  def basename
138
- "video"
141
+ "sprites"
139
142
  end
140
143
 
141
144
  def original_height
@@ -159,6 +162,19 @@ module VideoSprites
159
162
  format("%02d:%02d:%02d", hours, minutes, seconds)
160
163
  end
161
164
 
165
+ def move_images
166
+ FileUtils.mkdir keep_images_directory unless File.exist? keep_images_directory
167
+ FileUtils.mv Dir.glob(temporary_directory_glob), keep_images_directory
168
+ end
169
+
170
+ def keep_images_directory
171
+ File.join @output_directory, 'images'
172
+ end
173
+
174
+ def temporary_directory_glob
175
+ File.join @temporary_directory, '*.jpg'
176
+ end
177
+
162
178
  def clean_temporary_directory
163
179
  FileUtils.rm_rf @temporary_directory
164
180
  end
@@ -1,3 +1,3 @@
1
1
  module VideoSprites
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: video_sprites
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Ronallo
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-01-21 00:00:00.000000000 Z
11
+ date: 2017-01-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor