comparison bin/ren @ 36:3bcef95c376c

Revamped ren!
author Edho Prima Arief <me@myconan.net>
date Fri, 15 Apr 2011 21:52:51 +0700
parents b975a587f8f6
children 9a0cbfe1195b
comparison
equal deleted inserted replaced
30:fe9c15fe739a 36:3bcef95c376c
5 use File::Basename; 5 use File::Basename;
6 6
7 my @files = @ARGV or print("Usage: ",basename($0)," file1 ... fileN\n") && exit(1); 7 my @files = @ARGV or print("Usage: ",basename($0)," file1 ... fileN\n") && exit(1);
8 my $skip=0; 8 my $skip=0;
9 foreach (@files) { 9 foreach (@files) {
10 my $newname = $_; 10 print(qq(Could not find file "$_", skipping\n)) and next() unless -e $_;
11 print(qq(Could not find file "$_", skipping\n)) and next() unless -e $_; 11 my $newname = $_;
12 $newname =~ s/ \'[^']+\'//; 12 #START HERE
13 #$newname =~ s/ Kiss x Sis OVA / Kiss x Sis OAD /; 13 $newname =~ s/_/ /g;
14 $newname =~ s/x264//; 14 #TITLE AND NAMES
15 #$newname =~ s/ - 0/ - /; 15 $newname =~ s/^PitaTen.* Ep (\d+) .*\.avi/[Hnk] Pita Ten - $1.avi/;
16 $newname =~ s/\[HorribleSubs\] Lilpri /[HorribleSubs] Hime Chen! Otogi Chikku Idol Lilpri - /i; 16 $newname =~ s/^\[a-S\] Inuyasha - (\d+|\d+-\d+) /Inuyasha - $1 [a-S]/;
17 $newname =~ s/\[HorribleSubs\] Uraboku /[HorribleSubs] Uragiri wa Boku no Namae wo Shitteiru - /i; 17 $newname =~ s/\[DVD\]\[AHQ\]/[AHQ][DVD]/;
18 $newname =~ s/ GIG E/ GIG - /; 18 $newname =~ s/^mars daybreak /[V-A] Mars Daybreak - /;
19 $newname =~ s/^Kidou_Keisatsu_Patlabor_\(1990\)_-_([[:digit:]]+)\[16\]_-_.+_\[640x480\]\[DVD\]\[A-Et\]\[([[:xdigit:]]{8})\]\.(mkv)$/[A-Et] Patlabor (1990) - $1 [DVD][${2}].$3/; 19 $newname =~ s/ Shuffle! Episode / Shuffle! /;
20 $newname =~ s/^Witchblade_-_([[:digit:]]+)\[24\]_-_.+\[(Makoto|AniSubs)\]\[([[:xdigit:]]{8})\]\.(mkv)$/[$2] Witchblade - $1 [DVD][${3}].$4/; 20 $newname =~ s/^\[ZA\]\.Saint\.Seiya\.Episode\.(\d+)\.DVDrip\.\[X264\.AAC\(Jpn-Fre\)\.Sub\(Fre-Eng\)\.Chap\]\.mkv$/[D-YFI] Saint Seiya - $1 [DVD].mkv/;
21 $newname =~ s/^Witchblade - ([[:digit:]]+) \[24\] - .+\[(Makoto|AniSubs)\]\[([[:xdigit:]]{8})\]\[v2\]\.(mkv)$/[$2] Witchblade - $1 [DVD][v2][${3}].$4/; 21 $newname =~ s/^HajimeNoIppo.*Round(\d+)-.*\(anime-mx\)/[Anime-MX] Fighting Spirit - $1 /;
22 $newname =~ s/Sakura\.Wars\.([[:digit:]]{2}).*/[AM] Sakura Wars - $1.mkv/; 22 $newname =~ s/^(\[ACX\])(Final Fantasy Unlimited) - (\d+) .*\[ALI\] /$1 $2 - $3 /;
23 $newname =~ s/^Black Lagoon Omake /[OCZ] Black Lagoon - Special /; 23 $newname =~ s/^\[a-s\] inuyasha - (\d+-\d+) rs2 /[a-S] Inuyasha - $1 /;
24 $newname =~ s/_AIR_/ Air /; 24 $newname =~ s/^(\[Kira-Fansub\]) Uchuu no (Stellvia) /$1 $2 /;
25 $newname =~ s/\(b-a\)/[B-A] /i; 25 $newname =~ s/^(\[RaX\])(Chobits) - (\d+`\d) .*\(x264 aac\) /$1 $2 - $3 /;
26 #$newname =~ s/ ([[:digit:]]{2}) / 0$1 /; 26 $newname =~ s/ Maria( |†)Holic / Maria+Holic /i;
27 #$newname =~ s/^Feather #([[:digit:]]{2}) .*(\.mkv)$/[DmonHiro] Sekirei - $1$2/; 27 $newname =~ s/^Legend of Galactic Heroes - (\d+) \(([A-F0-9]{8})\) \[Central Anime\]/[Central Anime] Legend of Galactic Heroes - $1 [$2]/;
28 #$newname =~ s/(Galaxy Angel)/$1 S3 - /; 28 $newname =~ s/\[Hnk\]/[HnK]/;
29 #$newname =~ s/Legend Of The Crystals OAV - 0/- Legend of the Crystals OVA - /; 29 $newname =~ s/^Inuyasha - (\d+|\d+-\d+)\[167\] - .*(\[DVD\]\[AHQ\])/Inuyasha - $1 $2/;
30 #$newname =~ s/^Kaleido_Star_-_([[:digit:]]{2}).*(\[[[:xdigit:]]{8}\]\.mkv)$/[joseole99] Kaleido Star - $1 [DVD]$2/i; 30 $newname =~ s/^Saint Seiya Hades OVA - (\d+) \[(AonE-SpA|SpA)\]/[$2] Saint Seiya Hades OVA - $1/;
31 #$newname =~ s/^Kaleido_Star_-_Clean_ED([[:digit:]]).*(\[[[:xdigit:]]{8}\]\.mkv)$/[joseole99] Kaleido Star - Ending $1 (Clean) [DVD]$2/i; 31 $newname =~ s/\[\d+\] Saint Seiya Hades OVA - (\d+)/[SpA] Saint Seiya Hades OVA - $1/;
32 #$newname =~ s/^Kaleido_Star_-_Clean_OP([[:digit:]]).*(\[[[:xdigit:]]{8}\]\.mkv)$/[joseole99] Kaleido Star - Opening $1 (Clean) [DVD]$2/i; 32 $newname =~ s/ Digimon Tamers - (\d)\./ Digimon Tamers - 0$1./;
33 #$newname =~ s/^Kidou Keisatsu Patlabor \(1989\) - ([[:digit:]]{2}) \[47\].*(\[[[:xdigit:]]{8}\])v2(\.[^.]+)$/[AM] Patlabor (1989) - $1 [DVD][v2] $2$3/i; 33 $newname =~ s/ Kore wa Zombie Desu ka / Kore wa Zombie desu ka /i;
34 #$newname =~ s/.*_-_([[:digit:]]{2})\[26\].*(\[[[:xdigit:]]{8}\]\.avi)$/[Triad] Akagi - $1 $2/i; 34 $newname =~ s/ Infinite Stratos - IS - / Infinite Stratos - /;
35 #$newname =~ s/^.*\.([[:digit:]]{2})\..*\.mkv$/[AM] Neo Ranga - $1.mkv/; 35 $newname =~ s/\[Keroro\]\.(\d+)\.\[Xvid\.mp3\]\./[Keroro] Keroro Gunsou - $1 /i;
36 #$newname =~ s/.* ([[:digit:]]+) .*/[AonE-AnY] Ah My Goddess - $1.avi/; 36 $newname =~ s/\[Keroro\] \.(\d+)\. \[\.mp3\] \. /[Keroro] Keroro Gunsou - $1 /i;
37 #$newname =~ s/\[24-\(Final\)\]_/24 [End]/; 37 $newname =~ s/Shadow\.Star\.Narutaru\.(\d+)\.\(Dual\.Audio\)\.XVID\.\[AM\]/[AM] Narutaru - $1 /;
38 #$newname =~ s/\[([[:digit:]]{2})\]/$1/; 38 $newname =~ s/Outlaw Star Remastered E(\d+) .*'/ Outlaw Star - $1 /;
39 #$newname =~ s/^Otaku no Musume-san c([[:digit:]]+) \[v03\](\[.+\])\.zip$/Otaku no Musume-san - $1 (v03) $2.zip/i; 39 $newname =~ s/Ground Defense Force Mao-chan (\d+)\[h\.264-AAC\]\[SSP-Corp\]/[SSP-Corp] Mao-chan - $1 /;
40 #$newname =~ s/ HQ //; 40 $newname =~ s/Koi Kaze (\d+) \[NAG&anime fin\]/[NAG anime-fin] Koi Kaze - $1 /;
41 $newname =~ s/ Toradora - / Toradora! - /;
42 $newname =~ s/ Dragon Crisis / Dragon Crisis! /;
43 $newname =~ s/ Mao Chan / Mao-chan /;
44 $newname =~ s/^Arigatou\.Bleach\.(\d+)\.\[h264\.AAC\]/Bleach - $1 [Arigatou]/;
45 $newname =~ s/^Arigatou\.Bleach\.(\d+)\.\[x264\.AAC\]/Bleach - $1 [Arigatou]/;
46 $newname =~ s/^Arigatou\.Bleach\.(\d+)\. \[\.AAC\]/Bleach - $1 [Arigatou]/;
47 $newname =~ s/^Arigatou\.Bleach\.(\d+)v2\. \[\.AAC\]/Bleach - $1 [Arigatou][v2]/;
48 $newname =~ s/ Ep(\d+)v3 \[R2 Video\]/ - $1 [v3]/;
49 $newname =~ s/ Brighter Than The Dawning Blue - Crescent Love Ep(\d+) Subbed / Brigher Than The Dawning Blue - Crescent Love - $1 /;
50 $newname =~ s/ Brighter Than The Dawning Blue - Crescent Love - (\d+) Subbed / Brigher Than The Dawning Blue - Crescent Love - $1 /;
51 $newname =~ s/ Character Monologue 0/ Character Monologue /;
52 $newname =~ s/Ookami-san\.to\.Shichinin\.no\.Nakama-tachi\.EP(\d+)\(BD\.1080p\.AAC\)/Ookami-san - $1 [1080p BD]/;
53 $newname =~ s/Ore.?tachi ni tsubasa wa nai /Oretachi ni Tsubasa wa nai /i;
54 $newname =~ s/\[anime-rg . ray=out\]/[anime-rg ray=out]/;
55 $newname =~ s/^Arigatou\.Soul\.Eater\.Ep(\d+)\. \[x264\.AAC\]/[Arigatou] Soul Eater - $1 /;
56 $newname =~ s/^\[Doremi\]\.HeartCatch\.PreCure!\.(\d+)\.\[1280x720\]\./[Doremi] HeartCatch PreCure! - $1 [720p]/;
57 $newname =~ s/^\[Doremi-CureCom\]\.Suite\.PreCure!\.(\d+)\.\[1280x720\]\./[Doremi-CureCom] Suite PreCure! - $1 [720p]/;
58 $newname =~ s/^\[Doremi\]\.Motto\.Ojamajo\.Doremi\.(\d+)\./[Doremi] Motto Ojamajo Doremi - $1 /;
59 $newname =~ s/^\[HorribleSubs\] Lilpri /[HorribleSubs] Hime Chen! Otogi Chikku Idol Lilpri - /i;
60 $newname =~ s/^\[Jumonji-Giri\] \[AnY\]/[Jumonji-Giri]/;
61 $newname =~ s/\[(BWS|PM)\]Pocket Monsters Best Wishes (\d+) .+\[H264 /[$1] Pokemon Best Wishes - $2 [/;
62 $newname =~ s/ Ookiku Furikabutte - The Summer Tournament Chapter / Ookiku Furikabutte S2 /;
63 $newname =~ s/Les Miserables Shoujo Cosette /Les Miserables /;
64 $newname =~ s/\[Elysium\]Baka\.to\.Test\.to\.Shoukanjuu\.(EP)?/[Elysium] Baka to Test to Shokanju/;
65 $newname =~ s/\[Elysium\] Baka to Test to Shokanju/[Elysium] Baka to Test to Shokanju /;
66 $newname =~ s/\(BD\.1080p\.FLAC\)/[1080p BD]/;
67 $newname =~ s/Saizen & SD/Saizen-SD/;
68 $newname =~ s/Bleach - (\d{2}) /Bleach - 0$1 /;
69 $newname =~ s/Omamori Himari - ED \(Clean\) - 0(\d) / Omamori Himari - Ending $1 (Clean) /;
70 $newname =~ s/Omamori Himari - Opening \(Clean\) - (\d{2}) / Omamori Himari - Opening $1 (Clean) /;
71 $newname =~ s/\(B-A\)Great Teacher Onizuka - Lesson /[B-A] Great Teacher Onizuka - /;
72 $newname =~ s/Xam'd Lost Memories - (\d+) .* \[1080p,BluRay,,DTS\] - THORA\.mkv/[THORA] Xam'd Lost Memories - $1 [1080p BD].mkv/;
73 $newname =~ s/\(G P\) Escaflowne \(Remastered\)/[G_P] Escaflowne/;
74 $newname =~ s/SD&Taka/SD-Taka/;
75 $newname =~ s/Seikai no Senki/Banner of the Stars/;
76 $newname =~ s/Onii-chan no Koto \.\.\. /Onii-chan no Koto Nanka Zenzen Suki Janain Dakara ne /;
77 $newname =~ s/Onii-chan no Koto Nanka Zenzen Suki Janain Dakara ne /Onii-chan no Koto Nanka Zenzen Suki Janain Dakara ne!! /;
78 $newname =~ s/^Strawberry 100% - (\d+\.?\d*) \[ReDone-MDC\]/[ReDone-MDC] Strawberry 100% - $1 /;
79 $newname =~ s/^Strawberry 100% - OVA 0(\d+\.?\d*) \[ReDone-MDC\]/[ReDone-MDC] Strawberry 100% OVA - $1 /;
80 $newname =~ s/Dragonball Kai/Dragon Ball Kai/;
81 $newname =~ s/Natsu no Arashi - Akinai-chuu/Summer Storm! - Open for Business/;
82 $newname =~ s/Natsu no Arashi/Summer Storm!/;
83 $newname =~ s/Naruto (\d+-\d+) /Naruto - $1 /;
84 $newname =~ s/Lupin III Series 1 - (\d+) - .+ \[neo1024\]/[neo1024] Lupin III - $1 /;
85 $newname =~ s/Mitsudomoe Picture Drama - 0/Mitsudomoe Picture Drama - /;
86 $newname =~ s/Sora no Woto - ([^ ]+) \[BD 1080p\]\[AtsA\]/[AtsA] Sora no Woto - $1 [1080p BD]/;
87 $newname =~ s/Battle\.Programmer\.Shirase\./Battle Programmer Shirase /;
88 $newname =~ s/Battle Programmer Shirase - 0/Battle Programmer Shirase - /;
89 $newname =~ s/ Kuragehime / Princess Jellyfish /;
90 $newname =~ s/^\[OZC\]Code Geass Lelouch of the Rebellion R2 E(\d+) .*/[OZC] Code Geass R2 - $1.mkv/;
91 $newname =~ s/ Panty and Stocking with Garterbelt / Panty & Stocking with Garterbelt /;
92 $newname =~ s/ Spice and Wolf S2 / Spice and Wolf II /;
93 $newname =~ s/\[A-E & Saizen\]/[A-E Saizen]/;
94 $newname =~ s/\[Flomp\]\[SD\]/[Flomp]/;
95 $newname =~ s/\[Jumonji-Giri\]\[Ishin\]/[Jumonji-Giri]/;
96 $newname =~ s/\[Jumonji-Giri\]\[F-B&A-E\]/[Jumonji-Giri]/;
97 $newname =~ s/\[Jumonji-Giri\] \[Lunar\]/[Jumonji-Giri]/;
98 $newname =~ s/\[A-Kraze & Diffusion\]/[A-Kraze Diffusion]/;
99 $newname =~ s/ The Story Of Saiunkoku / Saiunkoku Monogatari /i;
100 $newname =~ s/Code Geass Lelouch of the Rebellion Episode (\d+) .*(\.mkv)$/ Code Geass - $1$2/i;
101 $newname =~ s/ To LOVE-Ru / To Love-Ru /i;
102 $newname =~ s/ Inuyasha Kanketsuhen / Inuyasha Kanketsu-hen /;
103 $newname =~ s/ AIR / Air /;
104 $newname =~ s/ Sister Princess Re Pure / Sister Princess Repure /;
105 $newname =~ s/C:\\Users\\Gad\\Desktop\\yankee-megane\\Release\\//;
106 $newname =~ s/\(END\)/[End]/i;
107 $newname =~ s/\(BD 1280x720 h264 JP.EN AAC\)/[720p BD]/i;
108 $newname =~ s/\[Final\]//i;
109 $newname =~ s/DB&L-E/DB L-E/;
110 $newname =~ s/IY-F&Oki/IY-F Oki/;
111 $newname =~ s/L-E&AonE/AonE L-E/;
112 $newname =~ s/^(Detective Conan - [[:digit:]]+-?[[:digit:]]*) (\[DCTP[^]]*\])(.+)$/$2 $1 $3/;
113 $newname =~ s/^(Detective Conan - [[:digit:]]+-?[[:digit:]]*) (\[AZFS[^]]*\])(.+)$/$2 $1 $3/;
114 $newname =~ s/^\[Derp\] Legend of the Legendary Heroes /[Derp] The Legend of the Legendary Heroes /;
115 $newname =~ s/ Sengoku BASARA Two / Sengoku Basara Two /;
116 $newname =~ s/ Asobi ni Ikuyo! / Asobi ni Iku Yo! /;
117 $newname =~ s/ Shinrei Tantei Yakumo / Psychic Detective Yakumo /;
118 $newname =~ s/ Ikkitousen Xtreme Xecutor OVA - 0/ Ikkitousen Xtreme Xecutor OVA - /;
119 $newname =~ s/ Megane na Kanojo OVA - 0/ Megane na Kanojo OVA - /;
120 $newname =~ s/\.Strange\.Dawn\.(\d+)\./ Strange Dawn - $1 /;
121 $newname =~ s/ (Tegami Bachi|Letter Bee) REVERSE / Letter Bee Reverse /i;
122 $newname =~ s/ Sora No Otoshimono / Sora no Otoshimono /;
123 $newname =~ s/ Kidou Tenshi Angelic Layer (ep)?/ Angelic Layer /i;
124 $newname =~ s/ Sora No Otoshimono - Forte / Sora no Otoshimono Forte /i;
125 $newname =~ s/ Shinryaku! Ika Musume / Squid Girl /;
126 #$newname =~ s/ Squid Girl / Shinryaku! Ika Musume /;
127 $newname =~ s/ Seikimatsu Occult Gakuin / Occult Academy /;
128 $newname =~ s/ Arakawa Under the Bridge ×2 / Arakawa Under the Bridge x2 /;
129 $newname =~ s/ K-ON!! S2 / K-ON!! /;
130 $newname =~ s/ Ookami-san To Shichinin No Nakama-tachi / Ookami-san /;
131 $newname =~ s/ K-On!! / K-ON!! /;
132 $newname =~ s/ Ore No Imouto / Ore no Imouto /;
133 $newname =~ s/ A Certain Magical Index II / Toaru Majutsu no Index II /i;
134 $newname =~ s/ TV Broadcast \[720p/ [LQ 720p/;
135 $newname =~ s/ ED(\d)/ - Ending $1 /;
136 $newname =~ s/ OP(\d)/ - Opening $1 /;
137 $newname =~ s/ ED / - Ending /;
138 $newname =~ s/ NCED / - Ending (Clean) /;
139 $newname =~ s/ NCOP / - Opening (Clean)/;
140 $newname =~ s/ OP / - Opening /;
141 $newname =~ s/ - - / - /;
142 $newname =~ s/ Ep / /ig;
143 #GENERAL RULES
144 $newname =~ s/\.DVD/[DVD]/;
145 $newname =~ s/ ~(.+)~ / - $1 /;
146 $newname =~ s/v2 \(BD-1080p\) / [v2 1080p BD]/i;
147 $newname =~ s/v2 \(BD H264 1280x960 24fps AAC\) / [v2 960p BD]/i;
148 $newname =~ s/BD 1280x720 FLAC\]/ 720p BD]/i;
149 $newname =~ s/\[HD\]\.mp4/.mp4/;
150 $newname =~ s/\[\.?AC3\]//i;
151 $newname =~ s/\[720p H264 AAC5\.1\]/[720p]/;
152 $newname =~ s/\[BD 720p\]/[720p BD]/;
153 $newname =~ s/ \(BD H264 1280x960 24fps AAC\) / [960p BD]/i;
154 $newname =~ s/ \(h\.264\) //i;
155 $newname =~ s/\(xvid-mp3\)//i;
156 $newname =~ s/\(BD 1920x1080 *\)/[1080p BD]/i;
157 $newname =~ s/v3 \(BD-1080p\) / [v3 1080p BD]/i;
158 $newname =~ s/v0 \[720p\]/ [v0 720p]/i;
159 $newname =~ s/v0 \[/ [v0 /i;
160 $newname =~ s/\[1080p - Bluray\]/[1080p BD]/;
161 $newname =~ s/\[Bluray - 1080p\]/[1080p BD]/;
162 $newname =~ s/\[BD 1080p AAC\]/[1080p BD]/;
163 $newname =~ s/ \(BD-1080p\) / [1080p BD]/i;
164 $newname =~ s/ \(720p, BD\) / [720p BD]/i;
165 $newname =~ s/ \(BD 1280x960 24fps 5\.1ch\) / [960p BD]/i;
166 $newname =~ s/ \(Bluray, 720p, AAC\) / [720p BD]/i;
167 $newname =~ s/ \(720p,BluRay\) / [720p BD]/i;
168 $newname =~ s/ \(BD, 720p, FLAC\) / [720p BD]/i;
169 $newname =~ s/\[END\]/[End]/;
170 $newname =~ s/\[BD\]\[720p FLAC\]/[720p BD]/;
171 $newname =~ s/\[BD\]\[720p\]/[720p BD]/;
172 $newname =~ s/\[BD\]\[1080p\]/[1080p BD]/;
173 $newname =~ s/\[h264-480p AAC\]//;
174 $newname =~ s/\[h.264-480p\]//i;
175 $newname =~ s/ v3 \[720p\]/[v3 720p]/i;
176 $newname =~ s/1280x720 H264 OGG/720p/;
177 $newname =~ s/ \[BD 1080p FLAC\]/ [1080p BD]/i;
178 $newname =~ s/ \[720p BD FLAC\]/ [720p BD]/i;
179 $newname =~ s/ \[720p Blu-ray AAC\]/ [720p BD]/i;
180 $newname =~ s/ \[BD\]\[h264-1080p FLAC\]/ [1080p BD]/i;
181 $newname =~ s/ \(1920x1080\) \[BD\]/ [1080p BD]/i;
182 $newname =~ s/ \(960x720 Blu-Ray FLAC\) / [720p BD]/i;
183 $newname =~ s/ \(1920x1080 Blu-Ray FLAC\) / [1080p BD]/i;
184 $newname =~ s/ \(1280x720 Blu-Ray FLAC\) / [720p BD]/i;
185 $newname =~ s/ \(1280x720 h264 BD FLAC\) / [720p BD]/i;
186 $newname =~ s/ \(704x480 DVD AAC\) / [DVD]/i;
187 $newname =~ s/ \(960x720\) \[BD\]/ [720p BD]/i;
188 $newname =~ s/\(704x396\)//;
189 $newname =~ s/\(1280x720\)/ [720p]/i;
190 $newname =~ s/\(1920x1080\)/ [1080p]/i;
191 $newname =~ s/\(720x480 DVD AC3\)/ [DVD]/i;
192 $newname =~ s/\(1024x576\)/ [576p]/i;
193 $newname =~ s/\(1280x720 h264\)/ [720p]/i;
194 $newname =~ s/\(1280x720 ?(h264|x264)?( aac)?\)/ [720p]/i;
195 $newname =~ s/\(720p\)/[720p]/i;
196 $newname =~ s/\(1080p\)/[1080p]/i;
197 $newname =~ s/\(1080p,BD\)/[1080p BD]/i;
198 $newname =~ s/\(BD,1080p\)/[1080p BD]/i;
199 $newname =~ s/\((BD 720p)\)/ [720p BD]/i;
200 $newname =~ s/\(DVD\)/ [DVD]/i;
201 $newname =~ s/\[h264-480p\]//i;
202 $newname =~ s/\[H264\]//i;
203 $newname =~ s/\[DVD\]\[v2\]/[v2 DVD]/i;
41 $newname =~ s/xvid//i; 204 $newname =~ s/xvid//i;
42 $newname =~ s/\(-mp3\)//; 205 $newname =~ s/\[AC3\]//i;
43 $newname =~ s/^\[Doremi\]\.HeartCatch\.PreCure!\.([[:digit:]]{2})\.\[1280x720\]\.\[([[:xdigit:]]{8})\]\.mkv$/[Doremi] HeartCatch PreCure! - $1 (1280x720) [$2].mkv/; 206 $newname =~ s/\[H264&MP3\]//i;
44 $newname =~ s/^\[Doremi\]\.Motto\.Ojamajo\.Doremi\.([[:digit:]]{2})\.\[([[:xdigit:]]{8})\]\.avi$/[Doremi] Motto Ojamajo Doremi - $1 [$2].avi/; 207 $newname =~ s/\[H264-AAC\]//i;
45 $newname =~ s/^(Detective Conan - [[:digit:]]+-?[[:digit:]]*) (\[DCTP[^]]*\])(.+)$/$2 $1 $3/; 208 $newname =~ s/\+AAC//i;
46 $newname =~ s/^(Detective Conan - [[:digit:]]+-?[[:digit:]]*) (\[Kienai[^]]*\])(.+)$/$2 $1 $3/; 209 $newname =~ s/\[720x480 H264-Vorbis\]//i;
47 $newname =~ s/^(Detective Conan - OVA[[:digit:]]+-?[[:digit:]]*) (\[DCTP[^]]*\])(.+)$/$2 $1 $3/; 210 $newname =~ s/\[BD\]\[1280x720 H264-Flac\]/[720p BD]/i;
48 $newname =~ s/^(Kamen Rider W - [[:digit:]]+)HD (\[W-Time\])(.+)$/$2 $1 $3/; 211 $newname =~ s/\[h264 Vorbis\]//i;
49 $newname =~ s/- TV -/-/; 212 $newname =~ s/\[640x480 h\.264 AAC\]//i;
50 $newname =~ s/^(\[Keroro\])\.([[:digit:]]+)\..*(\[[[:xdigit:]]{8}\].+)$/$1 Keroro Gunsou - $2 $3/; 213 $newname =~ s/\[720x480 AR h\.264 AAC\]//i;
51 $newname =~ s/SubDESU(.*)_-_Directors_Cut/SubDesu$1/; 214 $newname =~ s/\[DVD H264 640x476\]/[DVD]/i;
52 $newname =~ s/\[(480p|360p)\]//; 215 $newname =~ s/\[720p\]/[720p]/i;
53 $newname =~ s/^(\[EG\])ZZ_Gundam_BD_([[:digit:]]+)\(720p\)(.+)$/$1 Gundam ZZ - $2 (960x720) [BD]$3/; 216 $newname =~ s/\[720p\]\[BD\]/[720p BD]/i;
54 $newname =~ s/\]_Working_-/] Working!! -/; 217 $newname =~ s/\[H264 1280x720\]/[720p]/i;
55 $newname =~ s/WORKING!!/Working!!/; 218 $newname =~ s/\[H264 1280x720 OGG\]/[720p]/i;
56 $newname =~ s/\[Retrofit\]_\[Ayako-m\.3\.3\.w\.\]/[Retrofit-Ayako-m.3.3.w]/i; 219 $newname =~ s/\[1280x720\]/[720p]/i;
57 $newname =~ s/Rosario\+Vampire/Rosario + Vampire/i; 220 $newname =~ s/\[1280x720 BD\]/[720p BD]/i;
58 $newname =~ s/Rosario \+ Vampire - Capu2 - /Rosario + Vampire Capu 2 - /i; 221 $newname =~ s/\[h264-720p\]/[720p]/i;
59 $newname =~ s/ Hidamari Sketch Hoshimittsu / Hidamari Sketch - Hoshi Mittsu /i; 222 $newname =~ s/\[h264-1080p FLAC\]/[1080p]/i;
60 $newname =~ s/ HEROMAN / Heroman /i; 223 $newname =~ s/\[BD\]\[h264-1080p AC3\]/[1080p BD]/i;
61 #$newname =~ s/^/[ETB]/i; 224 $newname =~ s/\[-/[/i;
62 $newname =~ s/_/ /g; 225 $newname =~ s/ \(1280x720 x264 AAC\)/ [720p]/i;
63 $newname =~ s/ asobi ni ikuyo / Asobi ni Iku Yo! /i; 226 $newname =~ s/\[720p\]\[v2\]/[v2 720p]/i;
64 $newname =~ s/ Eve no Jikan / Time of Eve /i; 227 $newname =~ s/\[480p\]//i;
65 $newname =~ s/ DVD +\[/ [DVD][/i; 228 $newname =~ s/\[v2\]\[720p\]/[v2 720p]/i;
66 $newname =~ s/^(.+)\[(Z-Z)\](.+)$/[$2] $1 $3/; 229 $newname =~ s/\[H264 - AAC\]//i;
67 $newname =~ s/\[62\] - .*\[DVD\]/[DVD]/; 230 $newname =~ s/\[H264 1280x720 AAC\] /[720p]/i;
68 $newname =~ s/S0/Special /; 231 $newname =~ s/\[720p\]\[End\]/[End 720p]/i;
69 $newname =~ s/\(1080p\)/(1920x1080)/; 232 $newname =~ s/ R2 DVD\(H264\.AC3\)/ [DVD]/i;
70 $newname =~ s/ Seikimatsu Occult Gakuin / Occult Academy /; 233 $newname =~ s/ - Ep / - /i;
71 $newname =~ s/ rockman exe axess / Rockman.EXE Axess /i; 234 $newname =~ s/(h|x)\.?264//i;
72 $newname =~ s/\[& MP3\]//; 235 $newname =~ s/\[BD\]\[1080p-?\]/[1080p BD]/;
73 $newname =~ s/\[AAC\]//; 236 $newname =~ s/AAC5\.1//;
74 $newname =~ s/ DVD \[/[DVD][/i; 237 $newname =~ s/FLAC//;
75 $newname =~ s/\[720 \(853\)x480\]\[x264 & HE-AAC\]//; 238 $newname =~ s/ aac//i;
76 $newname =~ s/ Ep - ([[:digit:]]+) / - $1 /; 239 $newname =~ s/ ac3//i;
77 $newname =~ s/ Asobi ni Ikuyo! / Asobi ni Iku Yo! /i; 240 $newname =~ s/\.DVD/ [DVD]/i;
78 $newname =~ s/ \(Directors Cut\) / /; 241 $newname =~ s/ DVD / [DVD] /i;
79 $newname =~ s/ KimiKiss Pure Rouge / kimikiss pure rouge /i; 242 $newname =~ s/\(DVD ?\)/ [DVD] /i;
80 $newname =~ s/ HIGHSCHOOL OF THE DEAD / High School of the Dead /i; 243 $newname =~ s/ Ep(\d+) / - $1 /;
81 $newname =~ s/ ARIA The ORIGINATION / Aria the Origination /i; 244 $newname =~ s/ Ep(\d+)v2 / - $1 [v2]/;
82 $newname =~ s/ Shinseiki Evangelion / Evangelion /; 245 $newname =~ s/ (\d+) / - $1 /;
83 $newname =~ s/ Kuro no Keiyakusha / The Black Contractor /i; 246 $newname =~ s/ (\d+)v(2|3) / $1 [v${2}]/;
84 $newname =~ s/ Darker than Black / Darker than Black /i; 247 $newname =~ s/\[720x480 AR FLAC\]//i;
85 $newname =~ s/ ARIA The NATURAL / Aria the Natural /i; 248 $newname =~ s/\[DVD 640x480\]/[DVD]/;
86 $newname =~ s/^Clannad Ep([[:digit:]]+) \[1080p,BluRay,x264\] - THORA\.mkv$/[THORA] Clannad - $1 (1920x1080) [BD].mkv/i; 249 $newname =~ s/ Episode (- )+(\d+) / - $2 /;
87 $newname =~ s/ Mahou Kishi Rayearth / Magic Knight Rayearth /i; 250 #DANGEROUS CLEANUPS
88 $newname =~ s/rune soldier ep/ Rune Soldier /i; 251 $newname =~ s/ \[v(2|3)\]\[(.+)\]\[([0-9A-Fa-f]{8})\]/ [v$1 $2][$3]/;
89 $newname =~ s/ Harukanaru Toki no Naka de Hachiyoushou / Haruka Naru Toki no Naka de - Hachiyoushou /i; 252 $newname =~ s/\]/] /g;
90 $newname =~ s/ Harukanaru Toki no Naka de - / Haruka Naru Toki no Naka de - Hachiyoushou /i; 253 $newname =~ s/\[/ [/g;
91 $newname =~ s/ -Hachiyoushou - / - Hachiyoushou - /i; 254 $newname =~ s/\] +\[/][/g;
92 $newname =~ s/\[Retrofit\] \[Shinsen\] /[Retrofit-SHS] /i; 255 $newname =~ s/\[ +/[/g;
93 $newname =~ s/ You're Under Arrest - / You're Under Arrest! - /i; 256 $newname =~ s/ +\]/]/g;
94 $newname =~ s/ Rosario to Vampire / Rosario + Vampire /i; 257 $newname =~ s/( -)+ / - /g;
95 $newname =~ s/\[R2 Video\]//i; 258 $newname =~ s/(\[|\()([0-9a-fA-F]{8})(\]|\))/[\U$2]/;
96 $newname =~ s/ \(BD-720p\) \[/ (1280x720) [BD][/i; 259 $newname =~ s/ +(\.\w{3})$/$1/;
97 $newname =~ s/ TV Ep/ - /i; 260 $newname =~ s/\[\]//g;
98 $newname =~ s/\] AIR - /] Air - /i; 261 $newname =~ s/\(\)//g;
99 $newname =~ s/ - Episode / - /i; 262 #EXCEPTIONS
100 $newname =~ s/\[divx[[:digit:].]+\]//i; 263 $newname =~ s/^\[DB&L-E\]/[DB L-E]/;
101 $newname =~ s/\[BD\] \((1280x720|1920x1080)\) \[/($1) [BD][/i;
102 $newname =~ s/ Seiken no Blacksmith / The Sacred Blacksmith /i;
103 #$newname =~ s/^Rizelmine([[:digit:]]+)\.avi$/[AC] Rizelmine - $1.avi/i;
104 #$newname =~ s/\[v2\]/v2/i;
105 $newname =~ s/v2/[v2]/i;
106 $newname =~ s/\.AAC\]//;
107 $newname =~ s/ No / no /g;
108 #$newname =~ s/ 0([[:digit:]]) / $1 /;
109 $newname =~ s/\[(1280x720|1024x576)\]/($1) /;
110 #$newname =~ s/^.*( [[:digit:]]{2}v2).*(\[[[:xdigit:]]{8}\]\.mkv)$/[KAA] Ai Yori Aoshi - $1 [DVD]$2/;
111 $newname =~ s/ True Tears / true tears /i;
112 $newname =~ s/ Fate stay night TV Reproduction / Fate-stay night - TV Reproduction /i;
113 $newname =~ s/ The Tatami Galaxy \(Yojouhan Shinwa Taikei\) / The Tatami Galaxy /i;
114 $newname =~ s/ Saint Seiya The Lost Canvas / Saint Seiya - The Lost Canvas /i;
115 $newname =~ s/Mayoi Neko Overrun /Mayoi Neko Overrun! /;
116 $newname =~ s/Angel Beats /Angel Beats! /i;
117 $newname =~ s/Rainbow /Rainbow /i;
118 $newname =~ s/ Ookiku Furikabutte - The Summer Tournament Chapter / Ookiku Furikabutte S2 /i;
119 $newname =~ s/Senko no night raid /Senkou no Night Raid /i;
120 $newname =~ s/To Heart Mini Ep0/To Heart - Special /;
121 $newname =~ s/Mai Otome/Mai-Otome/i;
122 $newname =~ s/WORKING!!/Working!!/i;
123 $newname =~ s/ Sengoku Basara / Sengoku Basara /i;
124 $newname =~ s/ K-on!! S2 / K-ON!! /i;
125 #$newname =~ s/.*\[([[:digit:]]{2})\].*(\[[[:xdigit:]]{8}\]\.mkv)/[FuktLogik] Hidamari Sketch - $1 [DVD]$2/;
126 $newname =~ s/\(BD\) \[/ [BD][/i;
127 $newname =~ s/\[\[BD\]/[BD][/;
128 $newname =~ s/\(DVD \)/[DVD]/;
129 $newname =~ s/ AC3\]/ /;
130 $newname =~ s/ *(\.[[:alnum:]]+)[^[:alnum:]]*$/$1/;
131 $newname =~ s/\[webrip\]/[Webrip]/i;
132 $newname =~ s/\[[^]]*(640x360|[[:digit:]]{3}x480)[^]]*\]//;
133 $newname =~ s/([^]])\[/$1 [/;
134 #$newname =~ s/- .*x264 AAC\)//;
135 #$newname =~ s/ 0([[:digit:]]) / $1 /;
136 #$newname =~ s/ - Great Guardians OVA - / Great Guardians - Special - /;
137 #$newname =~ s/ ([\d]) / 0$1 /;
138 #$newname =~ s/.* ([\d]{2}) .*/[HL] Gundam ZZ - $1.mkv/;
139 #$newname =~ s/ \[[[:xdigit:]]{8}\]//;
140 $newname =~ s/^\(([^)]+)\)/[$1]/;
141 $newname =~ s/sonic x/Sonic X/i;
142 $newname =~ s/END/End/;
143 #$newname =~ s/\[[^]]*h\.?264[^]]*\]//;
144 $newname =~ s/h\.?264//i;
145 $newname =~ s/ op([\d]) / Opening $1 /i;
146 $newname =~ s/ ed([\d]) / Ending $1 /i;
147 $newname =~ s/ dragonball / Dragon Ball /i;
148 $newname =~ s/Kissxsis/ Kiss x Sis /i;
149 $newname =~ s/k-on/K-ON/i;
150 #$newname =~ s/ dvd (\(.*\) )?\[/ $1 [DVD][/i;
151 $newname =~ s/ ([\d]+)( |\.)/ - $1$2/;
152 $newname =~ s/\(([[:xdigit:]]{8})\)/[$1]/;
153 $newname =~ s/ ep([\d]+) / - $1 /i;
154 $newname =~ s/- \[/ [/;
155 $newname =~ s/&/ & /g;
156 $newname =~ s/ ([\d]{2})\[/ $1 [/;
157 $newname =~ s/(\[[0-9a-fA-F]{8})/\U$1/;
158 $newname =~ s/v([[:digit:].]+)([^\[]+)\[/${2}[v${1}][/i;
159 #$newname =~ s/v2 (?=\(.*\) ) \[/ $1 [v2][/;
160 $newname =~ s/([^ ])\[DVD\]\[x264\.AAC\]/$1 [DVD]/;
161 $newname =~ s/\(DVD\) +\[/[DVD][/;
162 $newname =~ s/^(\[[^]]+\])([^ ])/$1 $2/;
163 $newname =~ s/(\((1280x720|960x720)[^)]*\))/($2)/;
164 #$newname =~ s/(\((1920x1080)[^)]*\)) /($2) [BD]/;
165 $newname =~ s/\[[^]]*720p[^]]*\] ?/(1280x720) /;
166 $newname =~ s/\[[^]]*1080p[^]]*\] ?/(1920x1080) /;
167 $newname =~ s/\(720p\)/(1280x720)/;
168 $newname =~ s/\[1280x720[^]]+\]/ (1280x720) /;
169 $newname =~ s/\([^)]*704x480[^)]*\)//;
170 $newname =~ s/([^ ])\(/$1 (/;
171 $newname =~ s/\.avi\.avi/.avi/;
172 $newname =~ s/^\[([^]&\-]*) +& +([^]&\-]*)\]/[$1-$2]/;
173 $newname =~ s/\(704x396 x264 AAC\)//;
174 $newname =~ s/\] +\[/][/;
175 $newname =~ s/~([^~]+)~/- $1 /;
176 $newname =~ s/\[DVD[^]]+\]/[DVD]/;
177 $newname =~ s/(\[BD\])+/[BD]/;
178 #$newname =~ s/Ep //;
179 $newname =~ s/([[:digit:]])v([[:digit:]]) \[/$1 [v$2][/;
180 $newname =~ s/([^-]) ([0-9]{2,3}) /$1 - $2 /;
181 $newname =~ s/- *\[/ [/;
182 $newname =~ s/( ?- )+/ - /g;
183 #$newname =~ s/ Special - / Special /;
184 $newname =~ s/ (\)|\])/$1/;
185 $newname =~ s/(\(|\[) /$1/;
186 $newname =~ s/(\(\)|\[\])+//;
187 #$newname =~ s/\) +\[/) [BD][/;
188 #$newname =~ s/SP/- Special /;
189 $newname =~ s/\[(Final|End)\]/[End]/i;
190 #$newname =~ s/Gurren Lagann Parallel Works - 2/Gurren Lagann Parallel Works 2/;
191 $newname =~ s/ - special - ([[:digit:]]+)( |\.)/ - Special $1$2/i;
192 $newname =~ s/ memories off - 3\.5 - / Memories Off 3.5 - /i;
193 $newname =~ s/ - Navigation - / - Navigation /;
194 $newname =~ s/ - Picture Drama - / - Picture Drama /;
195 $newname =~ s/\[W B\]/[W_B]/;
196 $newname =~ s/ OP / - Opening /;
197 $newname =~ s/ ED / - Ending /;
198 $newname =~ s/ - (Ending|Opening) - 1 / - $1 /;
199 $newname =~ s/ (Ending|Opening) - / - $1 /;
200 $newname =~ s/ Strike Witches - 2 - / Strike Witches 2 - /;
201 $newname =~ s/ Macross - 7 - / Macross 7 - /;
202 $newname =~ s/ Samurai - 7 - / Samurai 7 - /;
203 $newname =~ s/Seed Character Theater - /SEED - Character Theater /;
204 $newname =~ s/ - (Ending|Opening) - ([[:digit:]]+) / - $1 $2 /;
205 $newname =~ s/ Captain Tsubasa Road to - 2002 - / Captain Tsubasa Road to 2002 - /i;
206 $newname =~ s/ Golgo - 13 - / Golgo 13 - /i;
207 $newname =~ s/\]v3\./][v3]./;
208 $newname =~ s/^(.+)(\[v2\])(.+)$/$2 $1 $3/;
209 $newname =~ s/^(.+)(\[v3\])(.+)$/$2 $1 $3/;
210 $newname =~ s/(\[v2\]) (.+) (\[.+)/$2 ${1}$3/;
211 $newname =~ s/(\[v3\]) (.+) (\[.+)/$2 ${1}$3/;
212 $newname =~ s/\) \./)./;
213 $newname =~ s/\[+/[/g;
214 $newname =~ s/\]+/]/g;
215 $newname =~ s/( ?- )+/ - /g;
216 $newname =~ s/\[+ *\]+//g;
217 $newname =~ s/ +/ /g;
218 $newname =~ s/ VS Knight Lamune & - 40 fire / VS Knight Lamune & 40 fire /; 264 $newname =~ s/ VS Knight Lamune & - 40 fire / VS Knight Lamune & 40 fire /;
219 print(qq($_: $newname already exists, skipping\n)) and next() if -e $newname and $_ ne $newname; 265 $newname =~ s/ RAINBOW / Rainbow /;
220 if ($_ eq $newname) { 266 $newname =~ s/ Golgo - 13 / Golgo 13 /;
221 print("$_: no need to rename, skipping\n"); 267 $newname =~ s/ Strike Witches - 2 / Strike Witches 2 - /;
222 } else { 268 $newname =~ s/ 07-GHOST / 07-Ghost /;
223 if($skip==1) { print("Result: $_ --> $newname\n"); } 269 $newname =~ s/ K-ON!! B-Side Theater - Uraon!! - / K-ON!! B-Side Theater - Uraon!! /;
224 else { 270 $newname =~ s/ Captain Tsubasa Road to - 2002 / Captain Tsubasa Road to 2002 /;
225 if(rename($_, $newname)) { print("$_ -> $newname\n"); } 271 $newname =~ s/ SP0/ - Special /;
226 else { print("$_: rename failed\n"); } 272 $newname =~ s/ Special - / - Special /;
227 } 273 $newname =~ s/ Opening - / Opening /;
228 } 274 $newname =~ s/ Ending - / Ending /;
229 next(); 275 $newname =~ s/ Hidamari Sketch Hoshimittsu - Special / Hidamari Sketch Hoshimittsu Special - /;
276 $newname =~ s/ Spice and Wolf S2 - BD Menu - 0/ Spice and Wolf S2 - BD Menu /;
277 $newname =~ s/ Canvas - 2 - / Canvas 2 - /;
278 $newname =~ s/ Mitsudomoe - 2 - / Mitsudomoe 2 - /;
279 $newname =~ s/ Eyeshield - 21 - / Eyeshield 21 - /;
280 $newname =~ s/ Eyeshield 21 - (\d{2}) / Eyeshield 21 - 0$1 /;
281 $newname =~ s/ Eyeshield 21 - (\d{2})-(\d{2}) / Eyeshield 21 - 0$1-0$2 /;
282 $newname =~ s/ - 2010 Young Animator / 2010 Young Animator /;
283 $newname =~ s/\[G P\]/[G_P]/i;
284 #SAFE CLEANUPS
285 $newname =~ s/ +/ /g;
286 $newname =~ s/^ +//;
287 $newname =~ s/(- )+/- /;
288 $newname =~ s/^\[N - F\]/[N-F]/;
289 $newname =~ s/^\[K-F & AKUPX\]/[K-F AKUPX]/;
290 $newname =~ s/^\[([\s\w\- ]+)\] (Kyou Kara Maou|Bleach|Naruto|One Piece|Detective Conan) - (Opening \d+|Special \d+|\d+|\d+-\d+) /$2 - $3 [$1]/;
291 $newname =~ s/^Naruto - (\d{2}) /Naruto - 0$1 /;
292 $newname =~ s/^Naruto - (\d{2})-(\d{2}) /Naruto - 0$1-0$2 /;
293 print(qq($_: $newname already exists, skipping\n)) and next() if -e $newname and $_ ne $newname;
294 if ($_ eq $newname) {
295 print("$_: no need to rename, skipping\n");
296 } else {
297 if($skip==1) { print("Result: $_ --> $newname\n"); }
298 else {
299 if(rename($_, $newname)) { print("$_ -> $newname\n"); }
300 else { print("$_: rename failed\n"); }
301 }
302 }
303 next();
230 } 304 }
231 305
232 exit(0); 306 exit(0);