lib/movie-renamer.rb in movie-renamer-0.0.8 vs lib/movie-renamer.rb in movie-renamer-0.0.9

- old
+ new

@@ -80,11 +80,14 @@ return Movie.new(filename,:title => title) end # attempt to remove the divx part from a filename def MovieRenamer::titleExtract(filename) - r = %r{\s*\[?\(?\s*(d|D)(i|I)(v|V)(x|X)\s?(-|_)?\s?\w+\s*\)?\]?\s*} - filename.gsub(r,'').gsub(/\s?(-|_)\s?/,'') + r1 = %r{\s*\[?\(?\s*(d|D)(i|I)(v|V)(x|X)\s?(-|_)?\s?\w+\s*\)?\]?\s*} + r2 = %r{\s*\[?\(?\s*(x|X)(v|V)(i|I)(d|D)\s?(-|_)?\s?\w+\s*\)?\]?\s*} + r3 = %r{\s*\[?\(?\s*(d|D)(v|V)(d|D)(r|R)(i|I)(p|P)\s?(-|_)?\s*\)?\]?\s*} + r = /(#{r1}|#{r2}|#{r3})/ + filename.gsub(r,'').gsub(/\s?(-|_)\s?/,' ').gsub(/^\s/,'') end # rename a movie according to movie data # and moves it to the new path in filesystem def MovieRenamer::renameMovie(movie,newpath = NEWPATH)