peerflixrb 2.1.0 → 3.0.0

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: 3de9207f0a9c52b0a0c5ad70a71a5336173de281
4
- data.tar.gz: 81599e0310d5eb451f4f60ec0707f2b9f3de2786
3
+ metadata.gz: 16170568747511393f4fbf2bb7e3b37b3fbbab41
4
+ data.tar.gz: 11f884e301797a200f4b7f7dae34c9e1cb85d61f
5
5
  SHA512:
6
- metadata.gz: 46be8a0cb0777a972182804922b8a2d5822006115b2515801938229c527e65d7ef7e05e62fe1049b6e7c3e30d6697b36b6069b31a55ca216011023d9179309f8
7
- data.tar.gz: 84d3a0a6f98e571f33a28193af06b9640792303544e7aa32a03f9c380d77f499ab4d22ce71877be3ef96cad3c283ad120f13657e0dae64918357d5ae79e9d17e
6
+ metadata.gz: 9093448f7c60160aa47a0ffb5146a48590a00298187038b48efaf760ef00f185b3d80334878f1a07bdc73edf23e90960065c29bef7701e862b58e5f7378c6187
7
+ data.tar.gz: 276dcde0d6f4d9521bf36d0a10539b8526e5b4f416fb4604b5448723e358a2c66c1b48256f6610836e7ec16a5dd052ababade1a7473fb75fba54e884fa2a60c3
data/README.md CHANGED
@@ -48,6 +48,8 @@ You can autoplay in VLC or mpv with the corresponding option (Default: VLC).
48
48
 
49
49
  $ peerflixrb --mpv The Big Bang Theory s09e16 HDTV
50
50
 
51
+ It works with DLNA too with the ```-u``` option (subtitles too!).
52
+
51
53
  Or you can just let it download without autoplaying with ```-n``` or ```--no-player```.
52
54
 
53
55
 
data/exe/peerflixrb CHANGED
@@ -4,6 +4,7 @@ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), *%w( .. lib ))
4
4
  require 'optparse'
5
5
  require 'peerflixrb'
6
6
  require 'peerflixrb/commands'
7
+ require 'kat_search'
7
8
 
8
9
  options = {
9
10
  language: 'en',
@@ -82,10 +83,10 @@ begin
82
83
 
83
84
  # KAT Search
84
85
  cli.say "Searching KAT for #{options[:search].blue}".yellow
85
- kat_search = Peerflixrb::KAT.new(options[:search])
86
+ kat_search = KatSearch::Search.new(options[:search])
86
87
 
87
88
  # Did it find results?
88
- if not kat_search.results_found
89
+ unless kat_search.results_found?
89
90
  cli.say "No results found for #{options[:search].blue}".red
90
91
  exit
91
92
  end
@@ -1,3 +1,3 @@
1
1
  module Peerflixrb
2
- VERSION = '2.1.0'.freeze
2
+ VERSION = '3.0.0'.freeze
3
3
  end
data/peerflixrb.gemspec CHANGED
@@ -20,6 +20,7 @@ Gem::Specification.new do |spec|
20
20
  spec.require_paths = ['lib']
21
21
 
22
22
  spec.add_runtime_dependency 'addic7ed_downloader', '~> 1.0'
23
+ spec.add_runtime_dependency 'kat_search', '~> 1.0'
23
24
  spec.add_runtime_dependency 'nokogiri', '~> 1.6'
24
25
  spec.add_runtime_dependency 'highline', '~> 1.7'
25
26
  spec.add_runtime_dependency 'httparty', '~> 0.13'
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: 2.1.0
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Marchante
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-06-07 00:00:00.000000000 Z
11
+ date: 2016-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addic7ed_downloader
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: kat_search
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: nokogiri
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -216,8 +230,6 @@ files:
216
230
  - lib/peerflixrb.rb
217
231
  - lib/peerflixrb/commands.rb
218
232
  - lib/peerflixrb/imdb.rb
219
- - lib/peerflixrb/kat.rb
220
- - lib/peerflixrb/link.rb
221
233
  - lib/peerflixrb/version.rb
222
234
  - lib/peerflixrb/yify.rb
223
235
  - peerflixrb.gemspec
@@ -247,4 +259,3 @@ specification_version: 4
247
259
  summary: Wrapper for peerflix with automatic search through KickAss Torrents, Yifysubtitles
248
260
  and Addic7ed.
249
261
  test_files: []
250
- has_rdoc:
@@ -1,50 +0,0 @@
1
- require 'erb'
2
- require 'nokogiri'
3
- require 'yaml'
4
-
5
- module Peerflixrb
6
- ##
7
- # Extract a list of results from your search
8
- # KAT.new("Suits s05e16 1080p")
9
- class KAT
10
- NUMBER_OF_LINKS = 5
11
-
12
- attr_accessor :url
13
-
14
- def initialize(search)
15
- @url = "https://kat.cr/usearch/#{ERB::Util.url_encode(search)}/"
16
- end
17
-
18
- def page
19
- @page ||= Nokogiri::HTML(open(@url))
20
- end
21
-
22
- def results_found
23
- @results_found ||= page.at('p:contains("did not match any documents")').nil?
24
- rescue OpenURI::HTTPError
25
- @results_found = false
26
- end
27
-
28
- def links
29
- @links ||= generate_links
30
- end
31
-
32
- private
33
-
34
- def generate_links
35
- links = []
36
- crawled_links = page.css('.iaconbox > div')
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)
45
- end
46
-
47
- return links
48
- end
49
- end
50
- end
@@ -1,49 +0,0 @@
1
- require 'cgi'
2
- require 'open-uri'
3
-
4
- module Peerflixrb
5
- ##
6
- # Object that contains the info for a torrent file
7
- class Link
8
- @@max_length_name ||= 0
9
-
10
- attr_reader :seeders, :leechers
11
-
12
- def initialize(params)
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)
19
- end
20
-
21
- def to_s
22
- "#{filename.ljust(@@max_length_name + 2)} (#{@seeders.green}/#{@leechers.red})"
23
- end
24
-
25
- def filename
26
- @filename ||= "#{CGI.unescape(@params['name'])}.#{@params['extension']}"
27
- end
28
-
29
- def magnet
30
- @magnet ||= @params['magnet']
31
- end
32
-
33
- def info_hash
34
- @info_hash ||= extract_hash
35
- end
36
-
37
- private
38
-
39
- def extract_hash
40
- # Extract magnet properties to a Hash and then parse the sha1 info hash
41
- magnet_params = CGI.parse(URI.parse(magnet).query)
42
- magnet_params['xt'].first.match(/[0-9A-Fa-f]{20,}/).to_s.downcase
43
- end
44
-
45
- def set_max_length_name(length)
46
- @@max_length_name = length if @@max_length_name < length
47
- end
48
- end
49
- end