propre 0.2.2 → 0.3.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/lib/propre/dictionary.rb +28 -0
- data/lib/propre/version.rb +1 -1
- data/lib/propre.rb +24 -7
- metadata +3 -3
- data/lib/propre/blacklist.rb +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 57f2f551266db211c5e57019bd806e5e6f9476c5
|
4
|
+
data.tar.gz: d7f0dd097a80b595625a42426358d3c1826bdeb9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a39b614ff43b084bd7c6016a9c83d2012fb69f29c9d2e9f65c1d0eb9de62001fc1de5380120d1572d8fe7a57193d1616191fd4d9af4ea0423a67e58faf254d0
|
7
|
+
data.tar.gz: 4beef58118355a7289ee5c2705b45667761f62d1b199577b7945a36ff03ff2d1f6a718c86d5598af9bf99c76f3ea6b3182ee9c7545749787c36c8348934d455b
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Dictionary
|
2
|
+
BANNED = %w(
|
3
|
+
dvd
|
4
|
+
rip
|
5
|
+
xvid
|
6
|
+
hdtv
|
7
|
+
bluray
|
8
|
+
fastsub
|
9
|
+
fansub
|
10
|
+
vostfr
|
11
|
+
ac3
|
12
|
+
theatrical
|
13
|
+
unrated
|
14
|
+
subforced
|
15
|
+
)
|
16
|
+
|
17
|
+
LANGUAGES = %w(
|
18
|
+
truefrench
|
19
|
+
french
|
20
|
+
italian
|
21
|
+
)
|
22
|
+
|
23
|
+
QUALITY = %w(
|
24
|
+
x264
|
25
|
+
720p
|
26
|
+
1080p
|
27
|
+
)
|
28
|
+
end
|
data/lib/propre/version.rb
CHANGED
data/lib/propre.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'json'
|
2
2
|
require 'colorize'
|
3
3
|
|
4
|
-
require 'propre/
|
4
|
+
require 'propre/dictionary'
|
5
5
|
|
6
6
|
module Propre
|
7
7
|
def self.propify(arg)
|
@@ -23,15 +23,27 @@ module Propre
|
|
23
23
|
arg.to_s
|
24
24
|
end
|
25
25
|
|
26
|
+
def self.find_language(arg)
|
27
|
+
Dictionary::LANGUAGES.find { |e| arg.include?(e) } || ''
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.find_quality(arg)
|
31
|
+
Dictionary::QUALITY.find { |e| arg.include?(e) } || ''
|
32
|
+
end
|
33
|
+
|
26
34
|
def self.remove_patterns(arg)
|
27
|
-
|
28
|
-
|
29
|
-
|
35
|
+
%w(find_urls find_years find_episode find_language find_quality).each do |m|
|
36
|
+
arg.slice! method(m).call(arg)
|
37
|
+
end
|
30
38
|
arg
|
31
39
|
end
|
32
40
|
|
33
41
|
def self.sanitize(arg)
|
34
|
-
arg.
|
42
|
+
if arg.count('.') > arg.count('-')
|
43
|
+
arg.gsub('.', ' ').strip
|
44
|
+
else
|
45
|
+
arg.gsub('-', ' ').strip
|
46
|
+
end
|
35
47
|
end
|
36
48
|
|
37
49
|
def self.ban_chars(arg)
|
@@ -39,8 +51,11 @@ module Propre
|
|
39
51
|
end
|
40
52
|
|
41
53
|
def self.ban_words(arg)
|
54
|
+
banned_words = Dictionary.constants.reduce([]) do |sum, e|
|
55
|
+
sum.concat Dictionary.const_get(e)
|
56
|
+
end
|
42
57
|
arg.split.each do |word|
|
43
|
-
|
58
|
+
banned_words.select do |e|
|
44
59
|
arg.slice! word if word.include? e
|
45
60
|
end
|
46
61
|
end
|
@@ -52,7 +67,9 @@ module Propre
|
|
52
67
|
{
|
53
68
|
year: find_years(arg),
|
54
69
|
episode: find_episode(arg).upcase,
|
55
|
-
website: find_urls(arg)
|
70
|
+
website: find_urls(arg),
|
71
|
+
language: find_language(arg),
|
72
|
+
quality: find_quality(arg)
|
56
73
|
}
|
57
74
|
end
|
58
75
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: propre
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Felix Yadomi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -94,7 +94,7 @@ files:
|
|
94
94
|
- Rakefile
|
95
95
|
- bin/propre
|
96
96
|
- lib/propre.rb
|
97
|
-
- lib/propre/
|
97
|
+
- lib/propre/dictionary.rb
|
98
98
|
- lib/propre/version.rb
|
99
99
|
- propre.gemspec
|
100
100
|
homepage:
|