toname 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +6 -2
- data/lib/to_name.rb +7 -4
- metadata +7 -8
data/README.md
CHANGED
@@ -9,7 +9,11 @@ e.g.
|
|
9
9
|
* Primer.2004.DVDRip.x264.AC3.avi become Name => 'Primer', year => 2004
|
10
10
|
* ManMen.S01E01.720p.HDTV.x264-CTU.mkv becomes Name => 'ManMen', series => 1, episode => 1
|
11
11
|
|
12
|
-
Most media file names sourced from P2P sites are not immediately machine readable, however,
|
12
|
+
Most media file names sourced from P2P sites are not immediately machine readable, however,
|
13
|
+
they generally have a fairly consistent naming scheme. ToName applies some simple parsing rules to
|
14
|
+
extract enough information so that the movie/tv show can be looked up in a metadata database
|
15
|
+
(e.g. [IMDB](http://www.imdb.com)). ToName does not claim a 100% success rate, however,
|
16
|
+
it's generally good enough to find a match on IMDB.
|
13
17
|
|
14
18
|
Features
|
15
19
|
--------
|
@@ -49,4 +53,4 @@ MIT
|
|
49
53
|
|
50
54
|
Contact
|
51
55
|
-------
|
52
|
-
Sam Cavenagh [(cavenaghweb@hotmail.com)](mailto:cavenaghweb@hotmail.com)
|
56
|
+
Sam Cavenagh [(cavenaghweb@hotmail.com)](mailto:cavenaghweb@hotmail.com)
|
data/lib/to_name.rb
CHANGED
@@ -29,11 +29,14 @@ class ToName
|
|
29
29
|
check_extention = false
|
30
30
|
end
|
31
31
|
end
|
32
|
-
|
32
|
+
|
33
|
+
# Remove anything at the start of the name surrounded by [], sometimes there is website name url
|
34
|
+
raw_name = raw_name.gsub(/^\[[^\]]+\]/, '')
|
35
|
+
|
33
36
|
#Remove file extention
|
34
37
|
raw_name = raw_name[0, raw_name.rindex(FILE_EXT_SEP_REGEX)] if check_extention && raw_name =~ FILE_EXT_SEP_REGEX
|
35
38
|
#Remove space sub chars
|
36
|
-
raw_name = raw_name.gsub(SPACE_SUB_REGEX, ' ')
|
39
|
+
raw_name = raw_name.gsub(SPACE_SUB_REGEX, ' ').strip
|
37
40
|
|
38
41
|
name = raw_name.dup
|
39
42
|
#Chop off any info about the movie format or source
|
@@ -46,7 +49,7 @@ class ToName
|
|
46
49
|
year = $&.gsub(/\(|\)|\[|\]/, '').to_i
|
47
50
|
end
|
48
51
|
|
49
|
-
#Strip LIMITED off the end. Note: This is
|
52
|
+
#Strip LIMITED off the end. Note: This is case sensitive
|
50
53
|
name = $` if name =~ /LIMITED|LiMiTED$/
|
51
54
|
|
52
55
|
#Try to extract the session and episode
|
@@ -100,4 +103,4 @@ class ToName
|
|
100
103
|
return parent_folder
|
101
104
|
end
|
102
105
|
|
103
|
-
end
|
106
|
+
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 2
|
9
|
+
version: 0.1.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Sam Cavenagh
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date:
|
17
|
+
date: 2011-03-01 00:00:00 +11:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -23,13 +23,12 @@ dependencies:
|
|
23
23
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
24
|
none: false
|
25
25
|
requirements:
|
26
|
-
- -
|
26
|
+
- - ~>
|
27
27
|
- !ruby/object:Gem::Version
|
28
28
|
segments:
|
29
|
-
-
|
30
|
-
-
|
31
|
-
|
32
|
-
version: 2.5.8
|
29
|
+
- 1
|
30
|
+
- 3
|
31
|
+
version: "1.3"
|
33
32
|
type: :development
|
34
33
|
version_requirements: *id001
|
35
34
|
description: Convert video/torrent filename into movie/tv series name and year
|