videoinfo 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/videoinfo/cli.rb +13 -8
- data/lib/videoinfo/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a711fc7dead1f2ce7f276adf40cdafaabdc330f
|
4
|
+
data.tar.gz: 44dbe1068c42866e9aec65f845a5badb8b3a818c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34c86fd64c085cca95dbcd04a3a0544c04ee6ea63de48ae24d74faa38e29079454d59bbd34b3cad9907421e54efe8e389a781c09249893d5b5f1cce46586bc88
|
7
|
+
data.tar.gz: 2529d50d3acd66ecdd76056fd085a54ccedc159fe2aabbe1b3f08fb10bdadda0487b3389b5174f3750edd587f8b69ec0cffe6a4aa4d63982bebe16af3d048fea
|
data/CHANGELOG.md
CHANGED
data/lib/videoinfo/cli.rb
CHANGED
@@ -3,20 +3,17 @@ require 'optparse'
|
|
3
3
|
module Videoinfo
|
4
4
|
class CLI
|
5
5
|
|
6
|
+
ENV_IMAGE_HOST = 'VIDEOINFO_IMAGE_HOST'
|
7
|
+
|
6
8
|
# Analyze a video from command line arguments and print the result to STDOUT.
|
7
9
|
def self.run(args)
|
8
10
|
Videoinfo.interactive = true
|
11
|
+
image_host = ENV[ENV_IMAGE_HOST] || Videoinfo.image_host.class.to_s.split('::').last
|
9
12
|
screenshots = 2
|
10
13
|
option_parser = OptionParser.new do |opts|
|
11
14
|
opts.banner = 'Usage: videoinfo [options] "MOVIENAME" file'
|
12
|
-
opts.on('-i', '--image-host=IMAGEHOST', "The ImageHost to use for uploading screenshots. Default: #{
|
13
|
-
|
14
|
-
Videoinfo.image_host = Videoinfo::ImageHosts.const_get(host).new
|
15
|
-
rescue
|
16
|
-
hosts = Videoinfo::ImageHosts.constants.map(&:to_s).join(', ')
|
17
|
-
STDERR.puts "ERROR: '#{host}' is an unknown image host. Available hosts: #{hosts}"
|
18
|
-
exit 1
|
19
|
-
end
|
15
|
+
opts.on('-i', '--image-host=IMAGEHOST', "The ImageHost to use for uploading screenshots. Default: #{image_host}") do |host|
|
16
|
+
image_host = host
|
20
17
|
end
|
21
18
|
opts.on('-s', '--screenshots=SCREENSHOTS', "The number of screenshots to create, max 7. Default: #{screenshots}") do |ss|
|
22
19
|
screenshots = ss.to_i
|
@@ -34,6 +31,14 @@ module Videoinfo
|
|
34
31
|
end
|
35
32
|
end
|
36
33
|
|
34
|
+
begin
|
35
|
+
Videoinfo.image_host = Videoinfo::ImageHosts.const_get(image_host).new
|
36
|
+
rescue
|
37
|
+
hosts = Videoinfo::ImageHosts.constants.map(&:to_s).join(', ')
|
38
|
+
STDERR.puts "ERROR: '#{image_host}' is an unknown image host. Available hosts: #{hosts}"
|
39
|
+
exit 1
|
40
|
+
end
|
41
|
+
|
37
42
|
name, file = option_parser.parse!(args)
|
38
43
|
if name.to_s == '' || file.to_s == ''
|
39
44
|
STDERR.puts option_parser
|
data/lib/videoinfo/version.rb
CHANGED