movie-renamer 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/movie-renamer.rb +5 -2
- data/test/test_movie-renamer.rb +2 -0
- metadata +2 -2
data/lib/movie-renamer.rb
CHANGED
@@ -82,8 +82,11 @@ module MovieRenamer
|
|
82
82
|
|
83
83
|
# attempt to remove the divx part from a filename
|
84
84
|
def MovieRenamer::titleExtract(filename)
|
85
|
-
|
86
|
-
|
85
|
+
r1 = %r{\s*\[?\(?\s*(d|D)(i|I)(v|V)(x|X)\s?(-|_)?\s?\w+\s*\)?\]?\s*}
|
86
|
+
r2 = %r{\s*\[?\(?\s*(x|X)(v|V)(i|I)(d|D)\s?(-|_)?\s?\w+\s*\)?\]?\s*}
|
87
|
+
r3 = %r{\s*\[?\(?\s*(d|D)(v|V)(d|D)(r|R)(i|I)(p|P)\s?(-|_)?\s*\)?\]?\s*}
|
88
|
+
r = /(#{r1}|#{r2}|#{r3})/
|
89
|
+
filename.gsub(r,'').gsub(/\s?(-|_)\s?/,' ').gsub(/^\s/,'')
|
87
90
|
end
|
88
91
|
|
89
92
|
# rename a movie according to movie data
|
data/test/test_movie-renamer.rb
CHANGED
@@ -30,6 +30,8 @@ class TestMovieRenamer < Test::Unit::TestCase
|
|
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
32
|
'Divx- ita Kill Bill Vol. 2','(Divx - ita) - Kill Bill Vol. 2',
|
33
|
+
'xvid- ita Kill Bill Vol. 2','(xvid-ita) - Kill Bill Vol. 2',
|
34
|
+
'xvidita Kill Bill Vol. 2','(dvdrip) Kill Bill Vol. 2',
|
33
35
|
'[Divx-Ita ]Kill Bill Vol. 2','Kill Bill Vol. 2 [divx - Ita ]'].each do |name|
|
34
36
|
assert_equal "Kill Bill Vol. 2", MovieRenamer::titleExtract(name)
|
35
37
|
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.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ghedamat
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-
|
12
|
+
date: 2010-07-04 00:00:00 +02:00
|
13
13
|
default_executable: movie-renamer
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|