movies 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/movies.rb +6 -6
- data/lib/movies/exclude.yml +2 -1
- data/movies.gemspec +1 -1
- data/spec/exclude_spec.rb +6 -2
- metadata +1 -1
data/lib/movies.rb
CHANGED
@@ -109,14 +109,14 @@ class Movies
|
|
109
109
|
end
|
110
110
|
|
111
111
|
def self.cleaner(string)
|
112
|
-
|
113
|
-
string = string.gsub(/#{clean}/i, ' ')
|
114
|
-
end
|
115
|
-
|
116
|
-
[/((19|20)\d{2})/, /\./, /\s*-\s*/, /\s{2,}/].each do |regex|
|
112
|
+
[/((19|20)\d{2}).*$/, /\./, /\s*-\s*/, /\s{2,}/].each do |regex|
|
117
113
|
string = string.gsub(regex, ' ')
|
118
114
|
end
|
119
|
-
|
115
|
+
|
116
|
+
excluded.each do |clean|
|
117
|
+
string = string.gsub(/#{clean}.*$/i, ' ')
|
118
|
+
end
|
119
|
+
|
120
120
|
string.strip
|
121
121
|
end
|
122
122
|
|
data/lib/movies/exclude.yml
CHANGED
data/movies.gemspec
CHANGED
data/spec/exclude_spec.rb
CHANGED
@@ -114,11 +114,11 @@ describe "exclude.yaml" do
|
|
114
114
|
end
|
115
115
|
|
116
116
|
it "should not contain 'PAL'" do
|
117
|
-
Movies.cleaner("
|
117
|
+
Movies.cleaner("Sex And The City 2 2010 SUB PAL DVDRip XviD AC3-Rx").should_not match(/pal/i)
|
118
118
|
end
|
119
119
|
|
120
120
|
it "should not contain a year" do
|
121
|
-
Movies.cleaner("
|
121
|
+
Movies.cleaner("VC Arcade 1942 Wii-LaKiTu").should_not match(/1942/)
|
122
122
|
end
|
123
123
|
|
124
124
|
it "should not contain dots" do
|
@@ -136,4 +136,8 @@ describe "exclude.yaml" do
|
|
136
136
|
it "should strip ingoing params" do
|
137
137
|
Movies.cleaner(" A B ").should eq("A B")
|
138
138
|
end
|
139
|
+
|
140
|
+
it "should remove TV related data" do
|
141
|
+
Movies.cleaner("Bones S06E19 HDTV XviD-LOL").should_not match(/s06e19/i)
|
142
|
+
end
|
139
143
|
end
|