Mercurial > ec-dotfiles
diff bin/ren @ 13:97f46d6a11d3
Improved (as in, even more monstrous) ren.
author | Edho Prima Arief <me@myconan.net> |
---|---|
date | Tue, 03 Aug 2010 21:15:04 +0700 |
parents | 8a0391d8e8d0 |
children | b975a587f8f6 |
line wrap: on
line diff
--- a/bin/ren Tue Aug 03 21:14:35 2010 +0700 +++ b/bin/ren Tue Aug 03 21:15:04 2010 +0700 @@ -9,28 +9,47 @@ foreach (@files) { my $newname = $_; print(qq(Could not find file "$_", skipping\n)) and next() unless -e $_; + $newname =~ s/ \'[^']+\'//; + #$newname =~ s/ Kiss x Sis OVA / Kiss x Sis OAD /; + $newname =~ s/x264//; + $newname =~ s/ - 0/ - /; + $newname =~ s/\[HorribleSubs\] Lilpri /[HorribleSubs] Hime Chen! Otogi Chikku Idol Lilpri - /i; + $newname =~ s/\[HorribleSubs\] Uraboku /[HorribleSubs] Uragiri wa Boku no Namae wo Shitteiru - /i; + $newname =~ s/ GIG E/ GIG - /; + $newname =~ s/^Kidou_Keisatsu_Patlabor_\(1990\)_-_([[:digit:]]+)\[16\]_-_.+_\[640x480\]\[DVD\]\[A-Et\]\[([[:xdigit:]]{8})\]\.(mkv)$/[A-Et] Patlabor (1990) - $1 [DVD][${2}].$3/; + $newname =~ s/^Witchblade_-_([[:digit:]]+)\[24\]_-_.+\[(Makoto|AniSubs)\]\[([[:xdigit:]]{8})\]\.(mkv)$/[$2] Witchblade - $1 [DVD][${3}].$4/; + $newname =~ s/^Witchblade - ([[:digit:]]+) \[24\] - .+\[(Makoto|AniSubs)\]\[([[:xdigit:]]{8})\]\[v2\]\.(mkv)$/[$2] Witchblade - $1 [DVD][v2][${3}].$4/; $newname =~ s/Sakura\.Wars\.([[:digit:]]{2}).*/[AM] Sakura Wars - $1.mkv/; + $newname =~ s/^Black Lagoon Omake /[OCZ] Black Lagoon - Special /; + $newname =~ s/_AIR_/ Air /; + $newname =~ s/\(b-a\)/[B-A] /i; + #$newname =~ s/ ([[:digit:]]{2}) / 0$1 /; + #$newname =~ s/^Feather #([[:digit:]]{2}) .*(\.mkv)$/[DmonHiro] Sekirei - $1$2/; + #$newname =~ s/(Galaxy Angel)/$1 S3 - /; #$newname =~ s/Legend Of The Crystals OAV - 0/- Legend of the Crystals OVA - /; #$newname =~ s/^Kaleido_Star_-_([[:digit:]]{2}).*(\[[[:xdigit:]]{8}\]\.mkv)$/[joseole99] Kaleido Star - $1 [DVD]$2/i; #$newname =~ s/^Kaleido_Star_-_Clean_ED([[:digit:]]).*(\[[[:xdigit:]]{8}\]\.mkv)$/[joseole99] Kaleido Star - Ending $1 (Clean) [DVD]$2/i; #$newname =~ s/^Kaleido_Star_-_Clean_OP([[:digit:]]).*(\[[[:xdigit:]]{8}\]\.mkv)$/[joseole99] Kaleido Star - Opening $1 (Clean) [DVD]$2/i; - #$newname =~ s/.*_-_([[:digit:]]{2})\[47\].*(\[[[:xdigit:]]{8}\]\.mkv)$/[AniMecha] - $1 [DVD]$2/i; - #$newname =~ s/.*\.([[:digit:]]{2})\.\[.*([[:xdigit:]]{8}\]\.mkv)$/[Arigatou] Blade of the Immortal - $1 [$2/i; + #$newname =~ s/^Kidou Keisatsu Patlabor \(1989\) - ([[:digit:]]{2}) \[47\].*(\[[[:xdigit:]]{8}\])v2(\.[^.]+)$/[AM] Patlabor (1989) - $1 [DVD][v2] $2$3/i; + #$newname =~ s/.*_-_([[:digit:]]{2})\[26\].*(\[[[:xdigit:]]{8}\]\.avi)$/[Triad] Akagi - $1 $2/i; + #$newname =~ s/^.*\.([[:digit:]]{2})\..*\.mkv$/[AM] Neo Ranga - $1.mkv/; #$newname =~ s/.* ([[:digit:]]+) .*/[AonE-AnY] Ah My Goddess - $1.avi/; #$newname =~ s/\[24-\(Final\)\]_/24 [End]/; #$newname =~ s/\[([[:digit:]]{2})\]/$1/; #$newname =~ s/^Otaku no Musume-san c([[:digit:]]+) \[v03\](\[.+\])\.zip$/Otaku no Musume-san - $1 (v03) $2.zip/i; #$newname =~ s/ HQ //; $newname =~ s/xvid//i; + $newname =~ s/\(-mp3\)//; $newname =~ s/^\[Doremi\]\.HeartCatch\.PreCure!\.([[:digit:]]{2})\.\[1280x720\]\.\[([[:xdigit:]]{8})\]\.mkv$/[Doremi] HeartCatch PreCure! - $1 (1280x720) [$2].mkv/; $newname =~ s/^\[Doremi\]\.Motto\.Ojamajo\.Doremi\.([[:digit:]]{2})\.\[([[:xdigit:]]{8})\]\.avi$/[Doremi] Motto Ojamajo Doremi - $1 [$2].avi/; $newname =~ s/^(Detective Conan - [[:digit:]]+-?[[:digit:]]*) (\[DCTP[^]]*\])(.+)$/$2 $1 $3/; + $newname =~ s/^(Detective Conan - [[:digit:]]+-?[[:digit:]]*) (\[Kienai[^]]*\])(.+)$/$2 $1 $3/; $newname =~ s/^(Detective Conan - OVA[[:digit:]]+-?[[:digit:]]*) (\[DCTP[^]]*\])(.+)$/$2 $1 $3/; $newname =~ s/^(Kamen Rider W - [[:digit:]]+)HD (\[W-Time\])(.+)$/$2 $1 $3/; $newname =~ s/- TV -/-/; $newname =~ s/^(\[Keroro\])\.([[:digit:]]+)\..*(\[[[:xdigit:]]{8}\].+)$/$1 Keroro Gunsou - $2 $3/; $newname =~ s/SubDESU(.*)_-_Directors_Cut/SubDesu$1/; - $newname =~ s/\[480p\]\.mkv$/.mkv/; + $newname =~ s/\[(480p|360p)\]//; $newname =~ s/^(\[EG\])ZZ_Gundam_BD_([[:digit:]]+)\(720p\)(.+)$/$1 Gundam ZZ - $2 (960x720) [BD]$3/; $newname =~ s/\]_Working_-/] Working!! -/; $newname =~ s/WORKING!!/Working!!/; @@ -41,7 +60,28 @@ $newname =~ s/ HEROMAN / Heroman /i; #$newname =~ s/^/[ETB]/i; $newname =~ s/_/ /g; + $newname =~ s/ asobi ni ikuyo / Asobi ni Iku Yo! /i; + $newname =~ s/ Eve no Jikan / Time of Eve /i; + $newname =~ s/ DVD +\[/ [DVD][/i; + $newname =~ s/^(.+)\[(Z-Z)\](.+)$/[$2] $1 $3/; + $newname =~ s/\[62\] - .*\[DVD\]/[DVD]/; + $newname =~ s/S0/Special /; + $newname =~ s/\(1080p\)/(1920x1080)/; + $newname =~ s/ Seikimatsu Occult Gakuin / Occult Academy /; + $newname =~ s/ rockman exe axess / Rockman.EXE Axess /i; + $newname =~ s/\[& MP3\]//; + $newname =~ s/\[AAC\]//; + $newname =~ s/ DVD \[/[DVD][/i; + $newname =~ s/\[720 \(853\)x480\]\[x264 & HE-AAC\]//; + $newname =~ s/ Ep - ([[:digit:]]+) / - $1 /; + $newname =~ s/ Asobi ni Ikuyo! / Asobi ni Iku Yo! /i; + $newname =~ s/ \(Directors Cut\) / /; + $newname =~ s/ KimiKiss Pure Rouge / kimikiss pure rouge /i; + $newname =~ s/ HIGHSCHOOL OF THE DEAD / High School of the Dead /i; $newname =~ s/ ARIA The ORIGINATION / Aria the Origination /i; + $newname =~ s/ Shinseiki Evangelion / Evangelion /; + $newname =~ s/ Kuro no Keiyakusha / The Black Contractor /i; + $newname =~ s/ Darker than Black / Darker than Black /i; $newname =~ s/ ARIA The NATURAL / Aria the Natural /i; $newname =~ s/^Clannad Ep([[:digit:]]+) \[1080p,BluRay,x264\] - THORA\.mkv$/[THORA] Clannad - $1 (1920x1080) [BD].mkv/i; $newname =~ s/ Mahou Kishi Rayearth / Magic Knight Rayearth /i; @@ -58,14 +98,15 @@ $newname =~ s/\] AIR - /] Air - /i; $newname =~ s/ - Episode / - /i; $newname =~ s/\[divx[[:digit:].]+\]//i; - $newname =~ s/\[BD\] \(1280x720\) \[/(1280x720) [BD][/i; + $newname =~ s/\[BD\] \((1280x720|1920x1080)\) \[/($1) [BD][/i; $newname =~ s/ Seiken no Blacksmith / The Sacred Blacksmith /i; #$newname =~ s/^Rizelmine([[:digit:]]+)\.avi$/[AC] Rizelmine - $1.avi/i; - $newname =~ s/\[v2\]/v2/i; + #$newname =~ s/\[v2\]/v2/i; + $newname =~ s/v2/[v2]/i; $newname =~ s/\.AAC\]//; $newname =~ s/ No / no /g; #$newname =~ s/ 0([[:digit:]]) / $1 /; - $newname =~ s/\[1280x720\]/(1280x720) /; + $newname =~ s/\[(1280x720|1024x576)\]/($1) /; #$newname =~ s/^.*( [[:digit:]]{2}v2).*(\[[[:xdigit:]]{8}\]\.mkv)$/[KAA] Ai Yori Aoshi - $1 [DVD]$2/; $newname =~ s/ True Tears / true tears /i; $newname =~ s/ Fate stay night TV Reproduction / Fate-stay night - TV Reproduction /i; @@ -120,7 +161,7 @@ $newname =~ s/\(DVD\) +\[/[DVD][/; $newname =~ s/^(\[[^]]+\])([^ ])/$1 $2/; $newname =~ s/(\((1280x720|960x720)[^)]*\))/($2)/; - $newname =~ s/(\((1920x1080)[^)]*\)) /($2) [BD]/; + #$newname =~ s/(\((1920x1080)[^)]*\)) /($2) [BD]/; $newname =~ s/\[[^]]*720p[^]]*\] ?/(1280x720) /; $newname =~ s/\[[^]]*1080p[^]]*\] ?/(1920x1080) /; $newname =~ s/\(720p\)/(1280x720)/; @@ -147,15 +188,34 @@ #$newname =~ s/SP/- Special /; $newname =~ s/\[(Final|End)\]/[End]/i; #$newname =~ s/Gurren Lagann Parallel Works - 2/Gurren Lagann Parallel Works 2/; - $newname =~ s/ - special - ([[:digit:]]+) / - Special $1 /i; + $newname =~ s/ - special - ([[:digit:]]+)( |\.)/ - Special $1$2/i; $newname =~ s/ memories off - 3\.5 - / Memories Off 3.5 - /i; $newname =~ s/ - Navigation - / - Navigation /; $newname =~ s/ - Picture Drama - / - Picture Drama /; $newname =~ s/\[W B\]/[W_B]/; + $newname =~ s/ OP / - Opening /; + $newname =~ s/ ED / - Ending /; $newname =~ s/ - (Ending|Opening) - 1 / - $1 /; + $newname =~ s/ (Ending|Opening) - / - $1 /; + $newname =~ s/ Strike Witches - 2 - / Strike Witches 2 - /; + $newname =~ s/ Macross - 7 - / Macross 7 - /; + $newname =~ s/ Samurai - 7 - / Samurai 7 - /; $newname =~ s/Seed Character Theater - /SEED - Character Theater /; $newname =~ s/ - (Ending|Opening) - ([[:digit:]]+) / - $1 $2 /; + $newname =~ s/ Captain Tsubasa Road to - 2002 - / Captain Tsubasa Road to 2002 - /i; + $newname =~ s/ Golgo - 13 - / Golgo 13 - /i; + $newname =~ s/\]v3\./][v3]./; + $newname =~ s/^(.+)(\[v2\])(.+)$/$2 $1 $3/; + $newname =~ s/^(.+)(\[v3\])(.+)$/$2 $1 $3/; + $newname =~ s/(\[v2\]) (.+) (\[.+)/$2 ${1}$3/; + $newname =~ s/(\[v3\]) (.+) (\[.+)/$2 ${1}$3/; + $newname =~ s/\) \./)./; + $newname =~ s/\[+/[/g; + $newname =~ s/\]+/]/g; + $newname =~ s/( ?- )+/ - /g; + $newname =~ s/\[+ *\]+//g; $newname =~ s/ +/ /g; + $newname =~ s/ VS Knight Lamune & - 40 fire / VS Knight Lamune & 40 fire /; print(qq($_: $newname already exists, skipping\n)) and next() if -e $newname and $_ ne $newname; if ($_ eq $newname) { print("$_: no need to rename, skipping\n");