fyt 1.1.1.pre3 → 1.1.1.pre4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 99ddb6f0c28e0097332cb98626c6e61d00bceba8
4
- data.tar.gz: 8e9c2f6adaad7f08292822110b29d76496827a05
3
+ metadata.gz: a81606a3c21fc3b1d1fe00165742857047de5a8b
4
+ data.tar.gz: 756d3602dc030c0790c8b608906900a6b74e838c
5
5
  SHA512:
6
- metadata.gz: af08b83bedaee9a4d401e286054df76ab17da29fca377e9614564df7e8ee01f70801a18c8273ed6c6589effe832bf392ca7dd39631e9a1808ec5cbb9863941a6
7
- data.tar.gz: b5e871f6448e936f9fec127206034f054d60d4b09d555b953f20403af7e87717b236663fd4c334ca7ef71f9c927cb80766ea9647b4ef24c97817c73b1cfd1305
6
+ metadata.gz: 8de400085990440bd70262258b1c997dd247984ded9fb48a0a71520eca13ff701a722d0418fd0668beb98e07e68c4f91fadb1e07433617ab4d1a50204bc821f5
7
+ data.tar.gz: fe29868293ad3b373c664cd0993020812737d6524f6a884503a975ea589e6834627ff71b60a27adc5dfb359d1e22d9e4db947f632f44c6c16157c84d1ec1894d
data/lib/fyt/builder.rb CHANGED
@@ -56,6 +56,8 @@ module FYT
56
56
  @add_image_counter ||= 0
57
57
  @add_image_counter += 1
58
58
 
59
+ @proxy_manager.remove(proxy)
60
+
59
61
  add_image(youtube_url, title) if @add_image_counter < 3
60
62
  end
61
63
 
data/lib/fyt/parser.rb CHANGED
@@ -20,6 +20,8 @@ module FYT
20
20
  @read_counter ||= 0
21
21
  @read_counter += 1
22
22
 
23
+ @proxy_manager.remove(proxy)
24
+
23
25
  read if @read_counter < 3
24
26
  end
25
27
  end
data/lib/fyt/storage.rb CHANGED
@@ -52,15 +52,14 @@ module FYT
52
52
  def download_file!(url, output_path)
53
53
  proxy = @proxy_manager.get!
54
54
 
55
- options = [
55
+ options_string = [
56
56
  "-f '#{@format_options}'",
57
57
  "--merge-output-format '#{@output_format}'",
58
- "-o '#{output_path}'"
59
- ]
60
- options << "--proxy 'http://#{proxy.url}'"
61
- options << "'#{url}'"
62
-
63
- options_string = options.join(' ')
58
+ "-o '#{output_path}'",
59
+ "--proxy 'http://#{proxy.url}'",
60
+ "--socket-timeout '300'",
61
+ "'#{url}'"
62
+ ].join(' ')
64
63
 
65
64
  logger.debug "Executing: youtube-dl #{options_string}"
66
65
 
@@ -69,16 +68,20 @@ module FYT
69
68
  @download_counter ||= 0
70
69
  @download_counter += 1
71
70
 
71
+ @proxy_manager.remove(proxy)
72
+
72
73
  download_file!(url, output_path) if @download_counter < 3
73
74
  end
74
75
 
75
76
  def execute(command_string)
76
- IO.pipe do |read_io, write_io|
77
- break if system(command_string, out: write_io, err: write_io)
78
-
79
- write_io.close
80
- logger.error read_io.read
81
- raise
77
+ Timeout::timeout(5) do
78
+ IO.pipe do |read_io, write_io|
79
+ break if system(command_string, out: write_io, err: write_io)
80
+
81
+ write_io.close
82
+ logger.debug read_io.read
83
+ raise
84
+ end
82
85
  end
83
86
  end
84
87
 
data/lib/fyt.rb CHANGED
@@ -9,6 +9,14 @@ require 'fileutils'
9
9
 
10
10
  require 'proxy_fetcher'
11
11
 
12
+ module ProxyFetcher
13
+ class Manager
14
+ def remove(proxy)
15
+ proxies = proxies - [proxy]
16
+ end
17
+ end
18
+ end
19
+
12
20
  # handles the general behaviour of FYT
13
21
  module FYT
14
22
  def self.lock
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fyt
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1.pre3
4
+ version: 1.1.1.pre4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steffen Schröder