mvtk 0.1.2 → 0.1.3
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/README.md +4 -3
- data/lib/mvtk/config.rb +1 -1
- data/lib/mvtk/search.rb +27 -1
- data/lib/mvtk/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 545e6cf7da11089f10c033fb7c9ea68dc41209fd
|
4
|
+
data.tar.gz: 2780068f07fc5cfac9dc7b5d57f45e79982d64b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1fba49b067ccff2760d0ee1ec95fb8441526e14e3325af4a4a79a226d9c707265e44dc14e12fd0d08778f4703847092c77476508e32726d1ce675720cacf363c
|
7
|
+
data.tar.gz: 66a409aa484478249b5fc3bc06e2f1e1ac29ea7b0034e500a24ffbb3fa36acaa10ef8e01772959b65e5637b2e284d071c91fe66b77e1373f47ec79584467eec4
|
data/README.md
CHANGED
@@ -4,10 +4,11 @@ This gem install a command `mvtk`, it's not a gem you can use in your software.
|
|
4
4
|
|
5
5
|
The goal is simple: take crappy movie filename from a directory and name them the good way for kodi mediacenter using well known scraper.
|
6
6
|
|
7
|
-
|
7
|
+
3 scraper supported at this Time
|
8
8
|
|
9
|
-
* [
|
9
|
+
* [mpdb.tv](http://mpdb.tv/)
|
10
10
|
* [themoviedb.org](https://www.themoviedb.org/)
|
11
|
+
* [media-passion](http://scraper.media-passion.fr/index2.php?Page=Home)
|
11
12
|
|
12
13
|
## Installation
|
13
14
|
|
@@ -19,7 +20,7 @@ Then first launch will create the configuration file in ~/.config/mvtk.conf
|
|
19
20
|
|
20
21
|
Edit **~/.config/mvtk.conf**
|
21
22
|
|
22
|
-
* *scraper* = "themoviedb" or "mediapassion", which scraper you Usage
|
23
|
+
* *scraper* = "themoviedb", "mpdb" or "mediapassion", which scraper you Usage
|
23
24
|
* *saga_enable* = enable or not saga subdir
|
24
25
|
* *saga_prefix* = a string to prefix saga subdir name (.../terminator/... => .../prefix saganame/...)
|
25
26
|
* *source* = source directory to recursively find movie file
|
data/lib/mvtk/config.rb
CHANGED
@@ -6,7 +6,7 @@ module Mvtk
|
|
6
6
|
def self.confcreate (conffilepath)
|
7
7
|
doc = IniParse.gen do |doc|
|
8
8
|
doc.section("mvtk") do |mvtk|
|
9
|
-
mvtk.option("scraper","
|
9
|
+
mvtk.option("scraper","mpdb")
|
10
10
|
mvtk.option("saga_enable","true")
|
11
11
|
mvtk.option("saga_prefix","1-Saga")
|
12
12
|
mvtk.option("source","/home/torrent/finish.seedbox")
|
data/lib/mvtk/search.rb
CHANGED
@@ -24,7 +24,7 @@ module Mvtk
|
|
24
24
|
result = []
|
25
25
|
searchresult = Nokogiri::HTML(open("https://www.themoviedb.org/search?query=#{URI.escape(moviename.tr(' ', '+'))}"), nil , 'UTF-8')
|
26
26
|
searchresult.css("div.info").take(10).each do |link|
|
27
|
-
|
27
|
+
msaga = nil
|
28
28
|
myear = link.css('span.release_date').text.split("-")[0].strip
|
29
29
|
mtitle = "#{link.css('a').first.content} (#{myear})"
|
30
30
|
detailpage = Nokogiri::HTML(open("https://www.themoviedb.org#{link.css('a').first['href']}"))
|
@@ -38,11 +38,37 @@ module Mvtk
|
|
38
38
|
return result
|
39
39
|
end
|
40
40
|
|
41
|
+
def self.mpdb(moviename)
|
42
|
+
result = []
|
43
|
+
searchresult = Nokogiri::HTML(open("http://mpdb.tv/site/search?q=#{URI.escape(moviename.tr(' ', '+'))}"), nil , 'UTF-8')
|
44
|
+
searchresult.css('div.item a').take(10).each do |link|
|
45
|
+
msaga = nil
|
46
|
+
mtitle = link.css('h4.list-group-item-heading').text.strip
|
47
|
+
detailpage = Nokogiri::HTML(open("http://mpdb.tv#{link['href']}"))
|
48
|
+
begin
|
49
|
+
havehref = detailpage.css('p a').first['href']
|
50
|
+
havesaga = true
|
51
|
+
havesaga = nil unless havehref.start_with?('/saga/')
|
52
|
+
rescue
|
53
|
+
havesaga = nil
|
54
|
+
end
|
55
|
+
msaga = detailpage.css('p').first.text.strip if havesaga
|
56
|
+
unless msaga.nil? then
|
57
|
+
result.push("#{mtitle}/#{msaga}")
|
58
|
+
else
|
59
|
+
result.push("#{mtitle}/")
|
60
|
+
end
|
61
|
+
end
|
62
|
+
return result
|
63
|
+
end
|
64
|
+
|
41
65
|
def self.search (moviename)
|
42
66
|
if $conf['scraper'] == "mediapassion" then
|
43
67
|
result = self.mediapassion(moviename)
|
44
68
|
elsif $conf['scraper'] == "themoviedb" then
|
45
69
|
result = self.themoviedb(moviename)
|
70
|
+
elsif $conf['scraper'] == "mpdb" then
|
71
|
+
result = self.mpdb(moviename)
|
46
72
|
else
|
47
73
|
puts "Sorry #{$conf['scraper']} is not a valid scraper"
|
48
74
|
exit 1
|
data/lib/mvtk/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mvtk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Celedhrim
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-07-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: iniparse
|