videoinfo 0.2.0 → 0.3.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: 2d9f23008adc1a077641356b4fde1287788ab376
4
- data.tar.gz: 511ba79416ab3b21e1a953c03d0f608574a156b5
3
+ metadata.gz: 6a711fc7dead1f2ce7f276adf40cdafaabdc330f
4
+ data.tar.gz: 44dbe1068c42866e9aec65f845a5badb8b3a818c
5
5
  SHA512:
6
- metadata.gz: d2c7f16d606e4518facbd133a9692e0b6bde23011e13014ec04ec987dba5c95d15f0f0309bc954b2d53aa20ec363fe41711c0283af1c4e5eac13d25ea1c212ce
7
- data.tar.gz: bada7f288cacddc5db52c5cdb51bd97b9588944ae83f6fbcbb0baffcd41310da006db0f25fef50e9817cce437c4ccb7bd038fad55d89ca75fd837d86e4b065ee
6
+ metadata.gz: 34c86fd64c085cca95dbcd04a3a0544c04ee6ea63de48ae24d74faa38e29079454d59bbd34b3cad9907421e54efe8e389a781c09249893d5b5f1cce46586bc88
7
+ data.tar.gz: 2529d50d3acd66ecdd76056fd085a54ccedc159fe2aabbe1b3f08fb10bdadda0487b3389b5174f3750edd587f8b69ec0cffe6a4aa4d63982bebe16af3d048fea
data/CHANGELOG.md CHANGED
@@ -1,4 +1,7 @@
1
1
  ## CHANGELOG
2
2
 
3
+ #### Version 0.3.0 (August 8, 2014)
4
+ * More flexible CLI when using custom image hosts
5
+
3
6
  #### Version 0.2.0 (August 8, 2014)
4
7
  * Initial release
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: #{Videoinfo.image_host.class.to_s.split('::').last}") do |host|
13
- begin
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
@@ -1,3 +1,3 @@
1
1
  module Videoinfo
2
- VERSION = '0.2.0'
2
+ VERSION = '0.3.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: videoinfo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Johns