lib/movie-renamer.rb in movie-renamer-0.0.18 vs lib/movie-renamer.rb in movie-renamer-0.0.19

- old
+ new

@@ -65,10 +65,15 @@ if $config['filename'] @renamepattern = $config['filename'] end + if $config['savepath'] + @newpath = File.expand_path($config['savepath']) + puts @newpath + end + class Movie def initialize(filename,opts={}) opts = { :year => '', :director => '', :title => '', :part => '', :imdb =>''}.merge(opts) @year = opts[:year] @@ -139,9 +144,10 @@ def MovieRenamer::titleExtract(filename) r1 = %r{\s*\[?\(?\s*[dD](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!(/-.*/,'') 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