peerflixrb 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/Guardfile +5 -0
- data/LICENSE.txt +21 -0
- data/README.md +37 -0
- data/Rakefile +6 -0
- data/bin/peerflixrb +65 -0
- data/lib/peerflixrb.rb +36 -0
- data/lib/peerflixrb/version.rb +3 -0
- data/peerflixrb.gemspec +32 -0
- metadata +183 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 487e60561f6e6cfb804e2476e6c0b93dd8a307d8
|
4
|
+
data.tar.gz: 35799e21b12fc73504baaa77a31a1b4f2d733a27
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 71efc8468ad2b5b16e17b672bd612d24f2a423720bc6ec591b630c29e6c9e03872cc1bf9870702d941663edb30c05323d069da5e8719b6c595b08d7b249073dd
|
7
|
+
data.tar.gz: 822468e04d2bac5902d0c1b037987ab39d7f6ce8f10185ee4449d6981550c22ed08a4f12a9fc830a640dc949147e5cf7b80e1e3f28476272e76d4aad82835b4b
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Guardfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 David Marchante
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# Peerflixrb
|
2
|
+
|
3
|
+
Wrapper for [peerflix](https://github.com/mafintosh/peerflix) with automatic search through [Kickass Torrents](kat.cr) and [Addic7ed](http://www.addic7ed.com/) (with [gem addic7ed](https://github.com/michaelbaudino/addic7ed-ruby)).
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Make sure you have **peerflix** installed:
|
8
|
+
|
9
|
+
$ npm install -g peerflix
|
10
|
+
|
11
|
+
And then install the gem:
|
12
|
+
|
13
|
+
$ gem install peerflixrb
|
14
|
+
|
15
|
+
## Usage
|
16
|
+
|
17
|
+
Just pass what you want to watch and it will try to fetch the file and play it through peerflix:
|
18
|
+
|
19
|
+
$ peerflixrb suits s05e12
|
20
|
+
|
21
|
+
You can play with subtitles with ```-s``` option (Default: English).
|
22
|
+
|
23
|
+
$ peerflixrb -s Game Of Thrones S05E01
|
24
|
+
|
25
|
+
Choose the language with ```-l LANGUAGE``` ([Available Languages](https://github.com/michaelbaudino/addic7ed-ruby/blob/master/lib/addic7ed/common.rb))
|
26
|
+
|
27
|
+
$ peerflixrb -sl es-es Breaking Bad s05e03
|
28
|
+
|
29
|
+
|
30
|
+
## Contributing
|
31
|
+
|
32
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/iovis9/peerflixrb.
|
33
|
+
|
34
|
+
|
35
|
+
## License
|
36
|
+
|
37
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/peerflixrb
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), *%w( .. lib ))
|
3
|
+
|
4
|
+
require 'addic7ed'
|
5
|
+
require 'optparse'
|
6
|
+
require 'peerflixrb'
|
7
|
+
|
8
|
+
options = {}
|
9
|
+
OptionParser.new do |opts|
|
10
|
+
opts.banner = 'Usage: peerflixrb [options] <search>'
|
11
|
+
|
12
|
+
# TODO: maybe create option for letting load a specific local file too
|
13
|
+
opts.on('-s', '--with-subtitles', 'Play with subtitles') do |s|
|
14
|
+
options[:subtitles] = s
|
15
|
+
end
|
16
|
+
|
17
|
+
opts.on('-l LANGUAGE', '--language LANGUAGE', 'Language code to look subtitles for (default: English)') do |l|
|
18
|
+
options[:language] = l
|
19
|
+
end
|
20
|
+
|
21
|
+
opts.on_tail('-h', '--help', 'Show this message') do
|
22
|
+
puts opts
|
23
|
+
exit
|
24
|
+
end
|
25
|
+
end.parse!
|
26
|
+
|
27
|
+
# Default language: English
|
28
|
+
options[:language] ||= 'en'
|
29
|
+
|
30
|
+
# Join arguments to create the search term
|
31
|
+
options[:search] = ARGV.join ' '
|
32
|
+
exit if options[:search].empty?
|
33
|
+
|
34
|
+
# main
|
35
|
+
# TODO: handle failing and invalid searches
|
36
|
+
kat = Peerflixrb::KAT.new(options[:search])
|
37
|
+
|
38
|
+
# Subtitle search
|
39
|
+
if options[:subtitles]
|
40
|
+
begin
|
41
|
+
ep = Addic7ed::Episode.new(kat.filename)
|
42
|
+
sub_file = File.basename(ep.download_best_subtitle!(options[:language]))
|
43
|
+
rescue Addic7ed::EpisodeNotFound
|
44
|
+
puts "Episode not found on Addic7ed : #{ep.video_file.filename}."
|
45
|
+
rescue Addic7ed::ShowNotFound
|
46
|
+
puts "Show not found on Addic7ed : #{ep.video_file.filename}."
|
47
|
+
rescue Addic7ed::NoSubtitleFound
|
48
|
+
puts "No (acceptable) subtitle has been found on Addic7ed for #{ep.video_file.filename}."
|
49
|
+
rescue Addic7ed::InvalidFilename
|
50
|
+
puts "Addic7ed gem doesn't like the format passed. Skipping subtitles."
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
# Peerflix command build
|
55
|
+
command = "peerflix '#{kat.magnet}'"
|
56
|
+
command << " --subtitles '#{sub_file}'" unless sub_file.nil?
|
57
|
+
# TODO: choose video player (default: VLC)
|
58
|
+
command << ' --vlc'
|
59
|
+
# TODO: pipe options and leave these as default
|
60
|
+
command << ' -- --fullscreen'
|
61
|
+
|
62
|
+
system command
|
63
|
+
|
64
|
+
# Cleaning up
|
65
|
+
FileUtils.rm sub_file unless sub_file.nil?
|
data/lib/peerflixrb.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'peerflixrb/version'
|
2
|
+
require 'nokogiri'
|
3
|
+
require 'open-uri'
|
4
|
+
require 'erb'
|
5
|
+
require 'yaml'
|
6
|
+
|
7
|
+
module Peerflixrb
|
8
|
+
##
|
9
|
+
# Extract file info and magnet link from the first match of your search
|
10
|
+
# KAT.new("Suits s05e16 1080p")
|
11
|
+
class KAT
|
12
|
+
attr_accessor :url, :page, :filename, :magnet
|
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 filename
|
23
|
+
@filename ||= CGI.unescape(params['name']) + '.' + params['extension']
|
24
|
+
end
|
25
|
+
|
26
|
+
def magnet
|
27
|
+
@magnet ||= params['magnet']
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def params
|
33
|
+
@params ||= YAML.load page.at_css('.iaconbox > div')['data-sc-params']
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
data/peerflixrb.gemspec
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'peerflixrb/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'peerflixrb'
|
8
|
+
spec.version = Peerflixrb::VERSION
|
9
|
+
spec.authors = ['David Marchante']
|
10
|
+
spec.email = ['davidmarchan@gmail.com']
|
11
|
+
|
12
|
+
spec.summary = 'Wrapper for peerflix with automatic search through KAT and Addic7ed.'
|
13
|
+
# spec.description = %q{TODO: Write a longer description or delete this line.}
|
14
|
+
spec.homepage = 'https://github.com/iovis9/peerflixrb'
|
15
|
+
spec.license = 'MIT'
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = 'bin'
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ['lib']
|
21
|
+
|
22
|
+
spec.add_runtime_dependency 'nokogiri', '~> 1.6'
|
23
|
+
spec.add_runtime_dependency 'addic7ed', '~> 2.0'
|
24
|
+
|
25
|
+
spec.add_development_dependency 'bundler', '~> 1.11'
|
26
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
27
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
28
|
+
spec.add_development_dependency 'guard-rspec', '~> 4.6'
|
29
|
+
spec.add_development_dependency 'factory_girl', '~> 4.5'
|
30
|
+
spec.add_development_dependency 'webmock', '~> 1.24'
|
31
|
+
spec.add_development_dependency 'pry', '~> 0.10'
|
32
|
+
end
|
metadata
ADDED
@@ -0,0 +1,183 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: peerflixrb
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- David Marchante
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-03-07 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: nokogiri
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.6'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.6'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: addic7ed
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.11'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.11'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: guard-rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '4.6'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '4.6'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: factory_girl
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '4.5'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '4.5'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: webmock
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '1.24'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '1.24'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: pry
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0.10'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0.10'
|
139
|
+
description:
|
140
|
+
email:
|
141
|
+
- davidmarchan@gmail.com
|
142
|
+
executables: []
|
143
|
+
extensions: []
|
144
|
+
extra_rdoc_files: []
|
145
|
+
files:
|
146
|
+
- ".gitignore"
|
147
|
+
- ".rspec"
|
148
|
+
- ".travis.yml"
|
149
|
+
- Gemfile
|
150
|
+
- Guardfile
|
151
|
+
- LICENSE.txt
|
152
|
+
- README.md
|
153
|
+
- Rakefile
|
154
|
+
- bin/peerflixrb
|
155
|
+
- lib/peerflixrb.rb
|
156
|
+
- lib/peerflixrb/version.rb
|
157
|
+
- peerflixrb.gemspec
|
158
|
+
homepage: https://github.com/iovis9/peerflixrb
|
159
|
+
licenses:
|
160
|
+
- MIT
|
161
|
+
metadata: {}
|
162
|
+
post_install_message:
|
163
|
+
rdoc_options: []
|
164
|
+
require_paths:
|
165
|
+
- lib
|
166
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
167
|
+
requirements:
|
168
|
+
- - ">="
|
169
|
+
- !ruby/object:Gem::Version
|
170
|
+
version: '0'
|
171
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
172
|
+
requirements:
|
173
|
+
- - ">="
|
174
|
+
- !ruby/object:Gem::Version
|
175
|
+
version: '0'
|
176
|
+
requirements: []
|
177
|
+
rubyforge_project:
|
178
|
+
rubygems_version: 2.6.1
|
179
|
+
signing_key:
|
180
|
+
specification_version: 4
|
181
|
+
summary: Wrapper for peerflix with automatic search through KAT and Addic7ed.
|
182
|
+
test_files: []
|
183
|
+
has_rdoc:
|