video-torrent-info 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/ext/torrent_client/torrent_client.cpp +8 -2
- data/lib/video_torrent_info.rb +3 -2
- data/spec/lib/torrent_client_spec.rb +2 -2
- data/video-torrent-info.gemspec +3 -3
- 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: b71e5aefa32be1fbc835ed07180bf827f76e6269
|
4
|
+
data.tar.gz: e2cc0d4ee9d5557de8760e3d2f89b80eef7ed710
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7efcf563f6f6f580f3c2df4085aaa3604e6d77c27c354d0e7c24db2ef0087d507c253b28e5139431c69d5c47e6cb7e20d1b562a8a2607749fc166d577855b624
|
7
|
+
data.tar.gz: d93bc5b62f8e8fe9d55af9f5fced1e4bc73c56b292a9a46fe3d6fe5218d49907dbf6d8cfd29f18de57941d181bb94704aeffd88993dfae0ca9566f53323c9390
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.9
|
@@ -18,7 +18,7 @@ struct MyException : public std::exception
|
|
18
18
|
const char* what() const throw() { return s.c_str(); }
|
19
19
|
};
|
20
20
|
|
21
|
-
void load(String torrent_path, int idx, int size, String save_path, int port1, int port2)
|
21
|
+
void load(String torrent_path, int idx, int size, String save_path, int port1, int port2, int timeout)
|
22
22
|
{
|
23
23
|
using namespace libtorrent;
|
24
24
|
|
@@ -57,6 +57,7 @@ void load(String torrent_path, int idx, int size, String save_path, int port1, i
|
|
57
57
|
}
|
58
58
|
|
59
59
|
size_type temp = 0;
|
60
|
+
int t = 0;
|
60
61
|
|
61
62
|
while (true)
|
62
63
|
{
|
@@ -69,7 +70,12 @@ void load(String torrent_path, int idx, int size, String save_path, int port1, i
|
|
69
70
|
{
|
70
71
|
return;
|
71
72
|
}
|
72
|
-
|
73
|
+
if (t >= timeout * 1000)
|
74
|
+
{
|
75
|
+
return;
|
76
|
+
}
|
77
|
+
t++;
|
78
|
+
usleep(1000);
|
73
79
|
}
|
74
80
|
}
|
75
81
|
void handle_my_exception(std::exception const & ex)
|
data/lib/video_torrent_info.rb
CHANGED
@@ -7,7 +7,8 @@ class VideoTorrentInfo
|
|
7
7
|
port2: 8662,
|
8
8
|
temp_path: '/tmp',
|
9
9
|
supported_extensions: %w{ .avi .mkv .mpg .mpeg .3gp .wmv .mov .flv .mts },
|
10
|
-
download_limit: 1000000
|
10
|
+
download_limit: 1000000,
|
11
|
+
timeout: 60
|
11
12
|
}
|
12
13
|
def initialize(params = {})
|
13
14
|
@params = DEFAULTS.merge(params)
|
@@ -17,7 +18,7 @@ class VideoTorrentInfo
|
|
17
18
|
string = File.open(torrent_path){ |file| file.read }
|
18
19
|
torrent = string.bdecode
|
19
20
|
files = get_video_files(torrent)
|
20
|
-
@torrent_client.load(torrent_path, files.keys.first, @params[:download_limit], @params[:temp_path], @params[:port1], @params[:port2])
|
21
|
+
@torrent_client.load(torrent_path, files.keys.first, @params[:download_limit], @params[:temp_path], @params[:port1], @params[:port2], @params[:timeout])
|
21
22
|
dest = @params[:temp_path] + '/' + files.values.first
|
22
23
|
res = FFmpegVideoInfo.get(dest)
|
23
24
|
File.unlink(dest)
|
@@ -6,12 +6,12 @@ describe VideoTorrentInfo::TorrentClient do
|
|
6
6
|
context 'when #load' do
|
7
7
|
context 'with wrong file' do
|
8
8
|
specify do
|
9
|
-
expect { subject.load('abra', 0, 1000000, 'cadabra', 8661, 8662) }.to raise_error('failed to load torrent info: No such file or directory')
|
9
|
+
expect { subject.load('abra', 0, 1000000, 'cadabra', 8661, 8662, 60) }.to raise_error('failed to load torrent info: No such file or directory')
|
10
10
|
end
|
11
11
|
end
|
12
12
|
context 'with good file' do
|
13
13
|
before do
|
14
|
-
subject.load('spec/fixtures/test.torrent', 0, 1000000, '/tmp', 8661, 8662)
|
14
|
+
subject.load('spec/fixtures/test.torrent', 0, 1000000, '/tmp', 8661, 8662, 60)
|
15
15
|
end
|
16
16
|
after do
|
17
17
|
File.unlink(target)
|
data/video-torrent-info.gemspec
CHANGED
@@ -2,15 +2,15 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: video-torrent-info 0.1.
|
5
|
+
# stub: video-torrent-info 0.1.9 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "video-torrent-info"
|
9
|
-
s.version = "0.1.
|
9
|
+
s.version = "0.1.9"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.authors = ["Pavel Tatarsky"]
|
13
|
-
s.date = "2013-12-
|
13
|
+
s.date = "2013-12-14"
|
14
14
|
s.description = "It simply loads small part of torrent that contains metadata and processes it with ffmpeg"
|
15
15
|
s.email = "fazzzenda@mail.ru"
|
16
16
|
s.extensions = ["ext/torrent_client/extconf.rb"]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: video-torrent-info
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pavel Tatarsky
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-12-
|
11
|
+
date: 2013-12-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rdoc
|