peerflixrb 1.2.2 → 2.0.0
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 +4 -4
- data/.travis.yml +1 -1
- data/README.md +6 -4
- data/bin/console +11 -0
- data/bin/setup +8 -0
- data/{bin → exe}/peerflixrb +10 -3
- data/lib/peerflixrb/commands.rb +39 -41
- data/lib/peerflixrb/version.rb +1 -1
- data/lib/peerflixrb/yify.rb +1 -0
- data/lib/peerflixrb.rb +2 -2
- data/peerflixrb.gemspec +3 -3
- metadata +14 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f0cb0f583c7db883a7ef20d98d274ccb5a6ee2e1
|
4
|
+
data.tar.gz: fa20922a85386110a328491309384981b382c684
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 421edc242e606f3fbc959470b672fc46775773676199b7a4545d73f898b84581a9c1545cb3c9e86115459020d997cca2343c2091376df820cd9e629899d87e8e
|
7
|
+
data.tar.gz: a4540f142630c2df0fb95703627224ee4c3ec4d735a4fe097fcbfac1e975d731d580bb25574471cf6e26f8349619149b1686614093f1be877d8d1720a8b81c71
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
# Peerflixrb
|
4
4
|
|
5
|
-
Wrapper for [peerflix](https://github.com/mafintosh/peerflix) with automatic search through [Kickass Torrents](kat.cr), [YifySubtitles](http://www.yifysubtitles.com/) and [Addic7ed](http://www.addic7ed.com/) (with [gem
|
5
|
+
Wrapper for [peerflix](https://github.com/mafintosh/peerflix) with automatic search through [Kickass Torrents](kat.cr), [YifySubtitles](http://www.yifysubtitles.com/) and [Addic7ed](http://www.addic7ed.com/) (with [gem addic7ed_downloader](https://github.com/iovis9/addic7ed_downloader)).
|
6
6
|
|
7
7
|
|
8
8
|
## Requirements
|
@@ -20,7 +20,7 @@ Install the gem:
|
|
20
20
|
|
21
21
|
## Usage
|
22
22
|
|
23
|
-
Pass a string with what you want to watch and it will search KAT with your query and present you with the first 5 results for you to choose. The file selected will then be sent to **peerflix**.
|
23
|
+
Pass a string with what you want to watch and it will search KAT with your query and present you with the first 5 results for you to choose. The file selected will then be sent to **peerflix**. For **TV Shows** use the format S01E01.
|
24
24
|
|
25
25
|
$ peerflixrb Suits s05e12
|
26
26
|
$ peerflixrb The Godfather II
|
@@ -34,6 +34,8 @@ You can play the video with subtitles with the ```-s``` option (Default: English
|
|
34
34
|
$ peerflixrb -s Birdman
|
35
35
|
$ peerflixrb -s The Wire s04e05
|
36
36
|
|
37
|
+
You can choose from a list which subtitle file to use with TV Shows with the option ```-S```.
|
38
|
+
|
37
39
|
Choose the language with ```-l LANGUAGE``` ([Available Languages](https://github.com/michaelbaudino/addic7ed-ruby/blob/master/lib/addic7ed/common.rb)). Currently only for TV Shows (Choosing movie subtitles language will come soon!)
|
38
40
|
|
39
41
|
$ peerflixrb -sl es-es Breaking Bad s05e03
|
@@ -42,9 +44,9 @@ If you prefer to use your own subtitles file, you can do that with the ```-t SUB
|
|
42
44
|
|
43
45
|
$ peerflixrb Better Call Saul s02e04 -t subtitle_file.srt
|
44
46
|
|
45
|
-
You can autoplay in VLC or
|
47
|
+
You can autoplay in VLC or mpv with the corresponding option (Default: VLC).
|
46
48
|
|
47
|
-
$ peerflixrb --
|
49
|
+
$ peerflixrb --mpv The Big Bang Theory s09e16 HDTV
|
48
50
|
|
49
51
|
Or you can just let it download without autoplaying with ```-n``` or ```--no-player```.
|
50
52
|
|
data/bin/console
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'peerflixrb'
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
require 'pry'
|
11
|
+
Pry.start
|
data/bin/setup
ADDED
data/{bin → exe}/peerflixrb
RENAMED
@@ -13,10 +13,15 @@ options = {
|
|
13
13
|
optparse = OptionParser.new do |opts|
|
14
14
|
opts.banner = 'Usage: peerflixrb [options] <search>'
|
15
15
|
|
16
|
-
opts.on('-s', '--find-subtitles', 'Find subtitles
|
16
|
+
opts.on('-s', '--find-subtitles', 'Find subtitles') do
|
17
17
|
options[:find_subtitles] = true
|
18
18
|
end
|
19
19
|
|
20
|
+
opts.on('-S', '--choose-subtitles', 'Choose subtitles from Addic7ed') do
|
21
|
+
options[:find_subtitles] = true
|
22
|
+
options[:choose_subtitles] = true
|
23
|
+
end
|
24
|
+
|
20
25
|
opts.on('-n', '--no-player', "Don't autoplay") do
|
21
26
|
options[:video_player] = nil
|
22
27
|
end
|
@@ -38,6 +43,7 @@ optparse = OptionParser.new do |opts|
|
|
38
43
|
end
|
39
44
|
|
40
45
|
opts.on('-l LANGUAGE', '--language LANGUAGE', 'Language code to look subtitles for (default: English)') do |l|
|
46
|
+
options[:find_subtitles] = true
|
41
47
|
options[:language] = l
|
42
48
|
end
|
43
49
|
|
@@ -67,7 +73,8 @@ end
|
|
67
73
|
|
68
74
|
# main program
|
69
75
|
begin
|
70
|
-
|
76
|
+
commands = Peerflixrb::Commands.new
|
77
|
+
cli = commands.cli
|
71
78
|
|
72
79
|
# KAT Search
|
73
80
|
cli.say "Searching KAT for #{options[:search].blue}".yellow
|
@@ -80,7 +87,7 @@ begin
|
|
80
87
|
end
|
81
88
|
|
82
89
|
# Choose link and subtitles
|
83
|
-
link, sub_file =
|
90
|
+
link, sub_file = commands.choose_video_and_subtitles(kat_search, options)
|
84
91
|
|
85
92
|
# Peerflix command build
|
86
93
|
command = "peerflix '#{link.magnet}'"
|
data/lib/peerflixrb/commands.rb
CHANGED
@@ -1,25 +1,16 @@
|
|
1
|
-
require '
|
1
|
+
require 'addic7ed_downloader'
|
2
2
|
require 'highline'
|
3
3
|
|
4
4
|
module Peerflixrb
|
5
|
-
|
6
|
-
|
7
|
-
attr_accessor :cli
|
8
|
-
end
|
9
|
-
|
10
|
-
self.cli = HighLine.new
|
11
|
-
HighLine.colorize_strings
|
12
|
-
|
13
|
-
def self.select_link(kat_search)
|
14
|
-
cli.say "Choose file (#{'seeders'.green}/#{'leechers'.red}):"
|
5
|
+
class Commands
|
6
|
+
attr_accessor :cli
|
15
7
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
end
|
8
|
+
def initialize
|
9
|
+
@cli = HighLine.new
|
10
|
+
HighLine.colorize_strings
|
20
11
|
end
|
21
12
|
|
22
|
-
def
|
13
|
+
def choose_video_and_subtitles(kat_search, options)
|
23
14
|
# Proactively declare them because they would be lost in the block scope
|
24
15
|
link = nil
|
25
16
|
sub_file = nil
|
@@ -38,7 +29,7 @@ module Peerflixrb
|
|
38
29
|
|
39
30
|
# Was there a problem with the subtitle?
|
40
31
|
if options[:find_subtitles] && sub_file.nil?
|
41
|
-
continue = cli.agree "Do you want to continue? #{'[y/n]'.yellow}".blue
|
32
|
+
continue = cli.agree "Could not find subtitles. Do you want to continue? #{'[y/n]'.yellow}".blue
|
42
33
|
|
43
34
|
unless continue
|
44
35
|
# If :auto_select, exit program
|
@@ -59,37 +50,44 @@ module Peerflixrb
|
|
59
50
|
[link, sub_file]
|
60
51
|
end
|
61
52
|
|
62
|
-
|
63
|
-
def self.find_subtitles(video_file, options)
|
64
|
-
# Imdb search based on initial command input
|
65
|
-
movie = Imdb.find(options[:search])
|
53
|
+
private
|
66
54
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
55
|
+
def select_link(kat_search)
|
56
|
+
cli.say "Choose file (#{'seeders'.green}/#{'leechers'.red}):"
|
57
|
+
|
58
|
+
cli.choose(*kat_search.links) do |menu|
|
59
|
+
menu.default = '1'
|
60
|
+
menu.select_by = :index
|
72
61
|
end
|
73
62
|
end
|
74
63
|
|
75
|
-
def
|
76
|
-
|
77
|
-
|
78
|
-
|
64
|
+
def find_subtitles(video_file, options)
|
65
|
+
# Matches format 's06e02'? => TV Show
|
66
|
+
if options[:search][/s\d{1,2}e\d{1,2}/i]
|
67
|
+
find_tv_subtitles(video_file, options)
|
68
|
+
else
|
69
|
+
movie = Imdb.find(options[:search])
|
70
|
+
find_movie_subtitles(movie, 'english')
|
71
|
+
end
|
79
72
|
end
|
80
73
|
|
81
|
-
def
|
74
|
+
def find_tv_subtitles(video_file, options)
|
82
75
|
# TV Show search based on video filename
|
83
|
-
|
84
|
-
return
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
76
|
+
search = Addic7edDownloader::Search.by_string(options[:search], lang: options[:language], filename: video_file)
|
77
|
+
return search.download_best unless options[:choose_subtitles]
|
78
|
+
|
79
|
+
# Choose subtitle
|
80
|
+
subtitle = cli.choose(*search.results) do |menu|
|
81
|
+
menu.default = '1'
|
82
|
+
menu.select_by = :index
|
83
|
+
end
|
84
|
+
|
85
|
+
search.download_subtitle(subtitle)
|
86
|
+
end
|
87
|
+
|
88
|
+
def find_movie_subtitles(movie, language)
|
89
|
+
sub_file = YifySubtitles.download(movie.imdb_id, language)
|
90
|
+
return sub_file unless sub_file.nil?
|
93
91
|
end
|
94
92
|
end
|
95
93
|
end
|
data/lib/peerflixrb/version.rb
CHANGED
data/lib/peerflixrb/yify.rb
CHANGED
data/lib/peerflixrb.rb
CHANGED
data/peerflixrb.gemspec
CHANGED
@@ -15,17 +15,17 @@ Gem::Specification.new do |spec|
|
|
15
15
|
spec.license = 'MIT'
|
16
16
|
|
17
17
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
-
spec.bindir = '
|
18
|
+
spec.bindir = 'exe'
|
19
19
|
spec.executables = 'peerflixrb'
|
20
20
|
spec.require_paths = ['lib']
|
21
21
|
|
22
|
+
spec.add_runtime_dependency 'addic7ed_downloader', '~> 0.1'
|
22
23
|
spec.add_runtime_dependency 'nokogiri', '~> 1.6'
|
23
|
-
spec.add_runtime_dependency 'addic7ed', '~> 2.0'
|
24
24
|
spec.add_runtime_dependency 'highline', '~> 1.7'
|
25
25
|
spec.add_runtime_dependency 'httparty', '~> 0.13'
|
26
26
|
spec.add_runtime_dependency 'rubyzip', '~> 1.2'
|
27
27
|
|
28
|
-
spec.add_development_dependency 'bundler', '~> 1.
|
28
|
+
spec.add_development_dependency 'bundler', '~> 1.12'
|
29
29
|
spec.add_development_dependency 'rake', '~> 10.0'
|
30
30
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
31
31
|
spec.add_development_dependency 'guard-rspec', '~> 4.6'
|
metadata
CHANGED
@@ -1,43 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: peerflixrb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Marchante
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: addic7ed_downloader
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1
|
19
|
+
version: '0.1'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1
|
26
|
+
version: '0.1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: nokogiri
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '1.6'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '1.6'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: highline
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,14 +86,14 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '1.
|
89
|
+
version: '1.12'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '1.
|
96
|
+
version: '1.12'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: rake
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -208,7 +208,9 @@ files:
|
|
208
208
|
- LICENSE.txt
|
209
209
|
- README.md
|
210
210
|
- Rakefile
|
211
|
-
- bin/
|
211
|
+
- bin/console
|
212
|
+
- bin/setup
|
213
|
+
- exe/peerflixrb
|
212
214
|
- lib/peerflixrb.rb
|
213
215
|
- lib/peerflixrb/commands.rb
|
214
216
|
- lib/peerflixrb/imdb.rb
|