movie-renamer 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/movie-renamer.rb +2 -2
- data/test/test_movie-renamer.rb +1 -1
- metadata +1 -1
data/lib/movie-renamer.rb
CHANGED
@@ -83,7 +83,7 @@ module MovieRenamer
|
|
83
83
|
# attempt to remove the divx part from a filename
|
84
84
|
def MovieRenamer::titleExtract(filename)
|
85
85
|
r = %r{\s*\[?\(?\s*(d|D)(i|I)(v|V)(x|X)\s?(-|_)?\s?\w+\s*\)?\]?\s*}
|
86
|
-
filename.gsub(r,'')
|
86
|
+
filename.gsub(r,'').gsub(/\s?(-|_)\s?/,'')
|
87
87
|
end
|
88
88
|
|
89
89
|
# rename a movie according to movie data
|
@@ -238,7 +238,7 @@ module MovieRenamer
|
|
238
238
|
# makes a query to imdb database
|
239
239
|
def MovieRenamer::suggestMovies(name)
|
240
240
|
s = Imdb::Search.new(name)
|
241
|
-
s.movies.each do |m|
|
241
|
+
s.movies[0..5].each do |m|
|
242
242
|
@output.puts "#{m.year} - #{m.director.to_s.gsub(/(\[")|("\])/,'')} - #{m.title.gsub(/ .*/,'')}"
|
243
243
|
end
|
244
244
|
end
|
data/test/test_movie-renamer.rb
CHANGED
@@ -29,7 +29,7 @@ class TestMovieRenamer < Test::Unit::TestCase
|
|
29
29
|
# test title extraction
|
30
30
|
must "extract a title correctly with bad words in filename" do
|
31
31
|
['DIvX-ITa Kill Bill Vol. 2','(Divx-Ita )Kill Bill Vol. 2',
|
32
|
-
'Divx- ita Kill Bill Vol. 2',
|
32
|
+
'Divx- ita Kill Bill Vol. 2','(Divx - ita) - Kill Bill Vol. 2',
|
33
33
|
'[Divx-Ita ]Kill Bill Vol. 2','Kill Bill Vol. 2 [divx - Ita ]'].each do |name|
|
34
34
|
assert_equal "Kill Bill Vol. 2", MovieRenamer::titleExtract(name)
|
35
35
|
end
|