torrent_api 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +2 -1
- data/Rakefile +2 -2
- data/lib/pirate_bay/base.rb +5 -1
- data/lib/pirate_bay/details.rb +19 -7
- data/torrent_api.gemspec +3 -3
- metadata +7 -7
data/CHANGELOG
CHANGED
@@ -5,4 +5,5 @@
|
|
5
5
|
v0.1.0 Fixed Demonoid. Stable performance on :all and :demonoid.
|
6
6
|
v0.1.1 Fixed Demonoid torrent links to be absolute, not relative.
|
7
7
|
v0.1.2 Fixed PirateBay filesizes to be in bytes.
|
8
|
-
v0.2.0 Added some PirateBay analysis methods for comments and their video/audio ratings. Specs begin.
|
8
|
+
v0.2.0 Added some PirateBay analysis methods for comments and their video/audio ratings. Specs begin.
|
9
|
+
v0.2.1 Added more api methods to the video/audio ratings
|
data/Rakefile
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
require 'echoe'
|
2
|
-
Echoe.new('torrent_api', '0.2.
|
2
|
+
Echoe.new('torrent_api', '0.2.1') do |p|
|
3
3
|
p.description = "An API to query popular torrent websites"
|
4
4
|
p.url = "http://www.github.com/hjhart/torrent_api"
|
5
5
|
p.author = "James Hart"
|
6
6
|
p.email = "hjhart@gmail.com"
|
7
7
|
p.ignore_pattern = ["tmp/**/*", "scripts/*", "spec/**/*", "Gemfile*"]
|
8
|
-
p.
|
8
|
+
p.runtime_dependencies = ['nokogiri', 'hpricot']
|
9
9
|
end
|
10
10
|
|
11
11
|
task :default => :console
|
data/lib/pirate_bay/base.rb
CHANGED
@@ -53,7 +53,11 @@ module PirateBay
|
|
53
53
|
:name => result.name,
|
54
54
|
:video => p.video_quality_average,
|
55
55
|
:audio => p.audio_quality_average,
|
56
|
-
:url => url
|
56
|
+
:url => url,
|
57
|
+
:video_votes => p.video_scores.size,
|
58
|
+
:audio_votes => p.audio_scores.size,
|
59
|
+
:video_votes_sum => p.video_quality_score_sum,
|
60
|
+
:audio_votes_sum => p.audio_quality_score_sum
|
57
61
|
}
|
58
62
|
puts "Results: #{result}"
|
59
63
|
result
|
data/lib/pirate_bay/details.rb
CHANGED
@@ -82,17 +82,29 @@ module PirateBay
|
|
82
82
|
# puts "Incoming string of #{string} detected ratings of #{ratings}"
|
83
83
|
ratings
|
84
84
|
end
|
85
|
+
|
86
|
+
def video_scores
|
87
|
+
scores.map { |score| score[:v] }.compact
|
88
|
+
end
|
89
|
+
|
90
|
+
def video_quality_score_sum
|
91
|
+
video_scores.inject(0) { |score, memo| memo += score }
|
92
|
+
end
|
85
93
|
|
86
94
|
def video_quality_average
|
87
|
-
|
88
|
-
sum_of_video_scores = video_scores.inject(0) { |score, memo| memo += score }
|
89
|
-
sum_of_video_scores / video_scores.size.to_f
|
95
|
+
video_quality_score_sum / video_scores.size.to_f
|
90
96
|
end
|
91
|
-
|
97
|
+
|
98
|
+
def audio_scores
|
99
|
+
scores.map { |score| score[:a] }.compact
|
100
|
+
end
|
101
|
+
|
102
|
+
def audio_quality_score_sum
|
103
|
+
audio_scores.inject(0) { |score, memo| memo += score }
|
104
|
+
end
|
105
|
+
|
92
106
|
def audio_quality_average
|
93
|
-
|
94
|
-
sum_of_audio_scores = audio_scores.inject(0) { |score, memo| memo += score }
|
95
|
-
sum_of_audio_scores / audio_scores.size.to_f
|
107
|
+
audio_quality_score_sum / audio_scores.size.to_f
|
96
108
|
end
|
97
109
|
end
|
98
110
|
end
|
data/torrent_api.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "torrent_api"
|
5
|
-
s.version = "0.2.
|
5
|
+
s.version = "0.2.1"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["James Hart"]
|
@@ -22,8 +22,8 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.specification_version = 3
|
23
23
|
|
24
24
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
25
|
-
s.
|
26
|
-
s.
|
25
|
+
s.add_runtime_dependency(%q<nokogiri>, [">= 0"])
|
26
|
+
s.add_runtime_dependency(%q<hpricot>, [">= 0"])
|
27
27
|
else
|
28
28
|
s.add_dependency(%q<nokogiri>, [">= 0"])
|
29
29
|
s.add_dependency(%q<hpricot>, [">= 0"])
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: torrent_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,26 +13,26 @@ date: 2011-11-12 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|
16
|
-
requirement: &
|
16
|
+
requirement: &2153617180 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
21
|
version: '0'
|
22
|
-
type: :
|
22
|
+
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2153617180
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: hpricot
|
27
|
-
requirement: &
|
27
|
+
requirement: &2153616140 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '0'
|
33
|
-
type: :
|
33
|
+
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2153616140
|
36
36
|
description: An API to query popular torrent websites
|
37
37
|
email: hjhart@gmail.com
|
38
38
|
executables: []
|