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 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
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: movie-renamer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - ghedamat