viddl-rb 1.1.0 → 1.1.1
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 +4 -4
- data/bin/helper/driver.rb +18 -8
- data/bin/helper/parameter-parser.rb +5 -13
- data/bin/viddl-rb +0 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e6d7c34a048f529044ad34e45e5a0cbd7c8bb40
|
4
|
+
data.tar.gz: d8b4e60fd73ca136332b77f2c7b7b51035f4f584
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf74b3c11632db917939a39bb1b4658beb964f846bca0919e097a6ddaece1e75d97f36e3bf27deaaee803213c537a70b74c1ee97bee3e3493f2bffbdeac32387
|
7
|
+
data.tar.gz: 41f831d26aa16948e1b9dd6a529b5f56b247f664a08aef4022591f3a53f2def1e6ccbf7e5000c2358315ceaf946a255968f38df712ddb6fc7332f40352ee1589
|
data/bin/helper/driver.rb
CHANGED
@@ -5,21 +5,31 @@
|
|
5
5
|
class Driver
|
6
6
|
|
7
7
|
def initialize(param_hash)
|
8
|
+
@urls = param_hash[:urls]
|
9
|
+
param_hash.delete :urls
|
8
10
|
@params = param_hash
|
9
11
|
@downloader = Downloader.new
|
10
12
|
end
|
11
13
|
|
12
14
|
#starts the downloading process or print just the urls or names.
|
13
15
|
def start
|
14
|
-
|
16
|
+
@urls.each do |url|
|
17
|
+
@params[:url] = url
|
18
|
+
puts "\nAnalyzing URL: #{url}"
|
19
|
+
begin
|
20
|
+
queue = get_download_queue
|
15
21
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
22
|
+
if @params[:url_only]
|
23
|
+
queue.each { |url_name| puts url_name[:url] }
|
24
|
+
elsif @params[:title_only]
|
25
|
+
queue.each { |url_name| puts url_name[:name] }
|
26
|
+
else
|
27
|
+
@downloader.download(queue, @params)
|
28
|
+
end
|
29
|
+
rescue => e
|
30
|
+
puts e.message
|
31
|
+
end
|
32
|
+
end
|
23
33
|
end
|
24
34
|
|
25
35
|
private
|
@@ -8,7 +8,7 @@ class ParameterParser
|
|
8
8
|
DEFAULT_SAVE_DIR = "."
|
9
9
|
|
10
10
|
#returns a hash with the parameters in it:
|
11
|
-
# :
|
11
|
+
# :urls => array of the video urls
|
12
12
|
# :extract_audio => should attempt to extract audio? (true/false)
|
13
13
|
# :skip_failed => should skip failed downloads? (true/false)
|
14
14
|
# :url_only => do not download, only print the urls to stdout
|
@@ -98,13 +98,8 @@ class ParameterParser
|
|
98
98
|
optparse.parse!(args)
|
99
99
|
# exit if no video url
|
100
100
|
print_help_and_exit(optparse) if args.empty?
|
101
|
-
#
|
102
|
-
|
103
|
-
# Seems like some users like to pass non protocol prefixed URIs
|
104
|
-
url = "http://#{url}" unless url.start_with?('http')
|
105
|
-
# raise exception if invalid url
|
106
|
-
validate_url!(url)
|
107
|
-
options[:url] = url
|
101
|
+
# remaining elements in args will be urls
|
102
|
+
options[:urls] = validate_urls args
|
108
103
|
options
|
109
104
|
end
|
110
105
|
|
@@ -113,11 +108,8 @@ class ParameterParser
|
|
113
108
|
exit(0)
|
114
109
|
end
|
115
110
|
|
116
|
-
def self.
|
117
|
-
|
118
|
-
raise OptionParser::InvalidArgument.new(
|
119
|
-
"please include 'http' with your URL e.g. http://www.youtube.com/watch?v=QH2-TGUlwu4")
|
120
|
-
end
|
111
|
+
def self.validate_urls(urls)
|
112
|
+
urls.map {|url| url.start_with?("http") ? url : "http://#{url}"}
|
121
113
|
end
|
122
114
|
|
123
115
|
def self.validate_quality_options!(width, height, extension, quality)
|
data/bin/viddl-rb
CHANGED
@@ -26,7 +26,6 @@ begin
|
|
26
26
|
puts "Plugins loaded: #{ViddlRb::PluginBase.registered_plugins.inspect}"
|
27
27
|
|
28
28
|
puts "Will try to extract audio: #{params[:extract_audio] == true}."
|
29
|
-
puts "Analyzing URL: #{params[:url]}"
|
30
29
|
|
31
30
|
driver = Driver.new(params)
|
32
31
|
driver.start # starts the download process
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: viddl-rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marc Seeger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|