peerflixrb 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/peerflixrb/commands.rb +2 -1
- data/lib/peerflixrb/kat.rb +8 -2
- data/lib/peerflixrb/link.rb +14 -1
- data/lib/peerflixrb/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2a46bcd58ffb923ac652451cbdd9181d957400d7
|
4
|
+
data.tar.gz: 9dddfae0d38c1e8ee2b10987d485fc900c0be23c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef2424c24d06c4c0f5b432b7ba0c1307d78ef810769dcd6a23ae5e91351ddd343c8efc3b08e559b00921ab48b795f532819297db27c41c1a198816fb95c0aaa0
|
7
|
+
data.tar.gz: b41f6184a40dc268c29eb58636bd0b3215363b6a81a54f39b218cfea05c46bf384e44f7688e5cb91dc137265fd701a69d733547252245f454b637df4b3d9a41d
|
data/lib/peerflixrb/commands.rb
CHANGED
@@ -11,8 +11,9 @@ module Peerflixrb
|
|
11
11
|
HighLine.colorize_strings
|
12
12
|
|
13
13
|
def self.select_link(kat_search)
|
14
|
+
cli.say "Choose file (#{'seeders'.green}/#{'leechers'.red}):"
|
15
|
+
|
14
16
|
cli.choose(*kat_search.links) do |menu|
|
15
|
-
menu.header = 'Choose file'
|
16
17
|
menu.default = '1'
|
17
18
|
menu.select_by = :index
|
18
19
|
end
|
data/lib/peerflixrb/kat.rb
CHANGED
@@ -34,8 +34,14 @@ module Peerflixrb
|
|
34
34
|
def generate_links
|
35
35
|
links = []
|
36
36
|
crawled_links = page.css('.iaconbox > div')
|
37
|
-
|
38
|
-
|
37
|
+
seeders = page.css('td.green')
|
38
|
+
leechers = page.css('td.red')
|
39
|
+
|
40
|
+
crawled_links[0..NUMBER_OF_LINKS - 1].each_with_index do |link, i|
|
41
|
+
params = YAML.load(link['data-sc-params'])
|
42
|
+
params['seeders'] = seeders[i].text
|
43
|
+
params['leechers'] = leechers[i].text
|
44
|
+
links << Link.new(params)
|
39
45
|
end
|
40
46
|
|
41
47
|
return links
|
data/lib/peerflixrb/link.rb
CHANGED
@@ -5,12 +5,21 @@ module Peerflixrb
|
|
5
5
|
##
|
6
6
|
# Object that contains the info for a torrent file
|
7
7
|
class Link
|
8
|
+
@@max_length_name ||= 0
|
9
|
+
|
10
|
+
attr_reader :seeders, :leechers
|
11
|
+
|
8
12
|
def initialize(params)
|
9
13
|
@params = params
|
14
|
+
@seeders = params['seeders']
|
15
|
+
@leechers = params['leechers']
|
16
|
+
|
17
|
+
# Get the longest filename for pretty print
|
18
|
+
set_max_length_name(filename.length)
|
10
19
|
end
|
11
20
|
|
12
21
|
def to_s
|
13
|
-
filename
|
22
|
+
"#{filename.ljust(@@max_length_name + 2)} (#{@seeders.green}/#{@leechers.red})"
|
14
23
|
end
|
15
24
|
|
16
25
|
def filename
|
@@ -32,5 +41,9 @@ module Peerflixrb
|
|
32
41
|
magnet_params = CGI.parse(URI.parse(magnet).query)
|
33
42
|
magnet_params['xt'].first.match(/[0-9A-Fa-f]{20,}/).to_s.downcase
|
34
43
|
end
|
44
|
+
|
45
|
+
def set_max_length_name(length)
|
46
|
+
@@max_length_name = length if @@max_length_name < length
|
47
|
+
end
|
35
48
|
end
|
36
49
|
end
|
data/lib/peerflixrb/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: peerflixrb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Marchante
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-05-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -237,7 +237,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
237
237
|
version: '0'
|
238
238
|
requirements: []
|
239
239
|
rubyforge_project:
|
240
|
-
rubygems_version: 2.6.
|
240
|
+
rubygems_version: 2.6.4
|
241
241
|
signing_key:
|
242
242
|
specification_version: 4
|
243
243
|
summary: Wrapper for peerflix with automatic search through KAT and Addic7ed.
|