view bin/ren @ 727:49538e2aad65 default tip

Add a useful editrc
author nanaya <me@nanaya.net>
date Tue, 24 Sep 2024 16:58:15 +0900
parents 0d928126fcf6
children
line wrap: on
line source

#!/usr/bin/env perl

use warnings;
use strict;
use File::Basename;

my @files = @ARGV or print("Usage: ",basename($0)," file1 ... fileN\n") && exit(1);
my $skip=0;
foreach (@files) {
  print(qq(Could not find file "$_", skipping\n)) and next() unless -e $_;
  my $newname = $_;
  #START HERE
  $newname =~ s/_/ /g;
  # GROUP NAMES
  $newname =~ s/\[UTW Mazui\]/[UTW-Mazui]/i;
  $newname =~ s/\[tsundere\]/[Tsundere]/i;
  $newname =~ s/\[t-n\]/[T-N]/i;
  #TITLE AND NAMES
  $newname =~ s/^(\(|\[)W B(\)|\])/[W_B]/;
  if ($newname =~ m/\[(Doremi|Elysium)/) {
    $newname =~ s/\.([a-z0-9]+)$/,$1/i;
    $newname =~ s/\./ /g;
    $newname =~ s/,([a-z0-9]+)$/.$1/i;
  }
  $newname =~ s/Pocket Monsters Best Wishes Season 2 Decolora Adventure (\d+) .+\[H264 720P\]/ Pokemon Best Wishes S2 Decolora Adventure - $1 [720p]/i;
  $newname =~ s/^Gundam Seed (\d+|\d+\[v2\])\.DVD\(H264\.AAC\)\[KAA\]/[KAA] Gundam SEED - $1 [DVD]/i;
  $newname =~ s/(\[ACX\])(Spiral)( - \d+) - .* (\[[a-f0-9]{8}\]\.mkv)$/$1 $2$3 $4/i;
  $newname =~ s/^Genesis of Aquarion - (\d+) \[3xR\]\[Blu-ray.720p.H264.FLAC.AC3\](v2|)/[3xR] Genesis of Aquarion - $1 [$2 720p BD]/;
  $newname =~ s/^Otogi Zoshi Act\.(\d+)\[x264 AAC\]\[SSP-Corp\]/[SSP-Corp] Otogi Zoshi - $1 /;
  $newname =~ s/(Ending) (\(Clean\)) - 0(\d+)/$1 $3 $2/;
  $newname =~ s/(Opening) (\(Clean\))0(\d+)/$1 $3 $2/;
  $newname =~ s/ A\+Channel / A Channel - Special /;
  $newname =~ s/ Arcana✴Famiglia / Arcana Famiglia /i;
  $newname =~ s/ Yuru Yuri♪♪ / Yuru Yuri S2 /i;
  $newname =~ s/\[Retrofit\] *\[AI A-F&Ishin\] Kanon 2002 /[Retrofit] Kanon (2002) /i;
  $newname =~ s/ The Story of Perrine / Perrine /i;
  $newname =~ s/\] Chitose Get you!!? - /] Chitose Get You!! - /i;
  $newname =~ s/ Dog Days' / Dog Days S2 /i;
  $newname =~ s/\[commie\]/[Commie]/i;
  $newname =~ s/Onii-chan no Koto Nanka Zenzen Suki Janain Dakara ne!! - (\d+) \[Uncut\]/Onii-chan no Koto Nanka Zenzen Suki Janain Dakara ne!! - $1 /;
  $newname =~ s/^(Ayashi no Ceres|Chikyuu Shoujo Arjuna|Futari wa Precure  Splash Star) - (\d+)\[\d+\] - .*(\[DVD\])(\[[^]]+\])(\[[a-f0-9]{8}\]\.[^.]+)$/$4 $1 - $2 $3$5/i;
  $newname =~ s/^(Futari wa Precure  Splash Star) - (C\d+)\[\d+\] - .*(\[DVD\])(\[[^]]+\])(\[[a-f0-9]{8}\]\.[^.]+)$/$4 $1 - $2 $3$5/i;
  $newname =~ s/^(Air Master|Black Jack Special|Cinderella Boy|Damekko Doubutsu|Crystal Blaze) - (\d+)\[\d+\] - .*(\[[^]]+\])(\[[a-f0-9]{8}\]\.[^.]+)$/$3 $1 - $2 $4/i;
  $newname =~ s/^cor\.extras\.infinite\.ryvius\.textless\.opening(\d+)\./[cor] Infinite Ryvius - Opening $1 (Clean) /;
  $newname =~ s/^cor\.extras\.infinite\.ryvius\.textless\.ending(\d+)\./[cor] Infinite Ryvius - Ending $1 (Clean) /;
  $newname =~ s/^cor\.extras\.infinite\.ryvius\.art\.gallery\.and\.audio\.drama(\d+)\./[cor] Infinite Ryvius - Picture Drama $1 /;
  $newname =~ s/^cor\.extras\.infinite\.ryvius\.ryvius\.vj\.mix(\d+)\./[cor] Infinite Ryvius - Ryvius VJ Mix $1 /;
  $newname =~ s/^cor\.extras\.infinite\.ryvius\.ryvius\.illusion(\d+)\.mini-episode(\d+)\./[cor] Infinite Ryvius - Ryvius Illusion $1 - Mini Episode $2 /;
  $newname =~ s/^cor\.extras\.infinite\.ryvius\.ryvius\.illusion(\d+)\.(introduction|ending)\./[cor] Infinite Ryvius - Ryvius Illusion $1 - $2 /;
  $newname =~ s/ (Ryvius Illusion \d+) - ending / $1 - Ending /;
  $newname =~ s/ (Mitsudomoe Zouryouchuu\! - )0/ $1/;
  $newname =~ s/ (Ryvius Illusion \d+) - introduction / $1 - Introduction /;
  $newname =~ s/^Arigatou\.Tokyo\.Majin\.Ep(\d+)\./[Arigatou] Tokyo Majin - $1 /;
  $newname =~ s/ (Inazuma Eleven - )(\d{2}) / $1 0$2 /;
  $newname =~ s/\] *Pocket Monsters - (\d+) - .*\[(H264 |)SUB\]/] Pokemon - $1 /i;
  $newname =~ s/\] Ebiten - Koritsu Ebisugawa Koukou Tenmon-Bu - /] Ebiten - /i;
  $newname =~ s/\] Fafner - /] Soukyuu no Fafner - /;
  $newname =~ s/\] Senyuu\. - /] Senyuu - /i;
  $newname =~ s/\] Amnesia - /] Amnesia - /i;
  $newname =~ s/\] Date A Live - /] Date A Live - /i;
  $newname =~ s/\] Yahari Ore no Seishun Love Comedy wa Machigatteiru - My Teenage RomCom SNAFU - /] Yahari Ore no Seishun Love Comedy wa Machigatteiru - /i;
  $newname =~ s/\] Ore no Imouto ga Konnani Kawaii Wake ga Nai. - My Little Sister Can't Be This Cute. - /] Ore no Imouto ga Konnani Kawaii Wake ga Nai S2 - /i;
  $newname =~ s/\] Kotoura-san - /] Kotoura - /i;
  $newname =~ s/\] Sasami-san\@Ganbaranai - /] Sasami\@Ganbaranai - /i;
  $newname =~ s/\] Major OVA - World Series - /] Major World Series OVA - /i;
  $newname =~ s/\] D\.C\.( )?III ~Da Capo III~ /] Da Capo III /i;
  $newname =~ s/\] Ore no Kanojo to Osananajimi ga Shuraba( )?Sugiru( - My Girlfriend and Childhood Friend Fight Too Much)? /] Ore no Kanojo to Osananajimi ga Shuraba Sugiru /i;
  $newname =~ s/\] Sukitte Ii na yo\. - /] Sukitte Iinayo - /i;
  $newname =~ s/\] .+80%8CK.+80%8D - /] K - /i;
  $newname =~ s/\] Kono Naka ni Hitori Imouto ga Iru - /] Kono Naka ni Hitori Imouto ga Iru - /i;
  $newname =~ s/\] Yakitate Japan (- |Ep)/] Yakitate!! Japan - /i;
  $newname =~ s/\] Inu × Boku SS - /] Inu x Boku SS - /i;
  $newname =~ s/\] Onii-chan Dakedo Ai Sae Areba Kankeinai Yo Ne - /] Onii-chan Dakedo Ai Sae Areba Kankeinai yo ne - /i;
  $newname =~ s/\] 「K」 - /] K - /i;
  $newname =~ s/\] Hidamari Sketch(×|×)Honeycomb - /] Hidamari Sketch x Honeycomb - /i;
  $newname =~ s/\] Tasogare Otome × Amnesia - /] Tasogare Otome x Amnesia - /i;
  $newname =~ s/\] Haiyore! Nyarlko-san - /] Haiyore! Nyarlko - /i;
  $newname =~ s/\] Inu x Boku Secret Service - /] Inu x Boku SS - /i;
  $newname =~ s/\] Black Rock Shooter - 0/] Black Rock Shooter - /i;
  $newname =~ s/\] Mashiro iro symphony - /] Mashiro-iro Symphony - /i;
  $newname =~ s/\] To Aru Kagaku no Railgun /] Toaru Kagaku no Railgun /i;
  $newname =~ s/\] To Aru Majutsu no Index /] Toaru Majutsu no Index /i;
  $newname =~ s/\] Shakugan no Shana III /] Shakugan no Shana Final /i;
  $newname =~ s/\] Boku Ha Tomodachi Ga Sukunai - /] Boku wa Tomodachi ga Sukunai - /i;
  $newname =~ s/\] Boku Ha Tomodachi Ga Sukunai next - /] Boku wa Tomodachi ga Sukunai NEXT - /i;
  $newname =~ s/\] Seikon no Qwaser II BD - (\d+) \[720p\]/] Seikon no Qwaser II - $1 [720p BD]/i;
  $newname =~ s/\] Seikon no Qwaser Picture Drama - (\d+) /] Seikon no Qwaser - Picture Drama $1 /i;
  $newname =~ s/\] Fortune Arterial Akai Yakusoku - /] Fortune Arterial - /;
  $newname =~ s/\] Full Metal Panic Fumoffu - /] Full Metal Panic Fumoffu - /i;
  $newname =~ s/\[HorribleSubs\] Hunter X Hunter - /[HorribleSubs] Hunter x Hunter (2011) - /i;
  $newname =~ s/\] Ookami to Koushinryou - /] Spice and Wolf - /;
  $newname =~ s/\] Saint Seiya The Lost Canvas - /] Saint Seiya - The Lost Canvas - /;
  $newname =~ s/\] Love GetChu - /] Love Get Chu - /i;
  $newname =~ s/\] Kamen Rider Blade /] Kamen Rider Blade /i;
  $newname =~ s/\] Lovedol ~ Lovely Idol - /] Lovedol ~Lovely Idol~ - /i;
  $newname =~ s/\] Mobile Suit Gundam AGE - /] Gundam AGE - /i;
  $newname =~ s/\] Kore wa Zombie Desu ka? of the Dead - /] Kore wa Zombie desu ka - of the Dead - /i;
  $newname =~ s/\] Kore wa Zombie Desu ka- of the Dead - /] Kore wa Zombie desu ka - of the Dead - /i;
  $newname =~ s/\] BAKUMATSU GIJINDEN ROMAN - /] Bakumatsu Gijinden Roman - /i;
  $newname =~ s/\] Soredemo Machi wa Mawatte Iru - /] Soredemo Machi wa Mawatteiru - /;
  $newname =~ s/\] Spiral - (\d+) .* \[640 x 480\]\[H\.264\]/] Spiral - $1 /;
  $newname =~ s/\] Mayo Chiki - /] Mayo Chiki! - /i;
  $newname =~ s/\] Kaitou Tenshi Twin Angel Kyun Kyun Tokimeki Paradise - /] Twin Angel - Twinkle Paradise - /i;
  $newname =~ s/\] Mai Hime - /] My-HiME - /i;
  $newname =~ s/\] EUREKA SEVEN AO - /] Eureka Seven AO - /;
  $newname =~ s/\] kill la kill - /] Kill la Kill - /;
  $newname =~ s/\] CØDE:BREAKER - /] Code Breaker - /i;
  $newname =~ s/\] Nazo no Kanojo X - /] Mysterious Girlfriend X - /i;
  $newname =~ s/\] Naruto Shippuden - /] Naruto Shippuuden - /i;
  $newname =~ s/\] -* *Ef - a Tale of Me(l|m)o(d|r)ies - /] ef - a tale of me$1o$2ies /i;
  $newname =~ s/\] Maji de Watashi ni Koi Shinasai!! /] Maji de Watashi ni Koi Shinasai! /i;
  $newname =~ s/\] Sei Juushi Bismarck /] Sei Juushi Bismark /i;
  $newname =~ s/\] Tamayura - hitotose - /] Tamayura ~hitotose~ - /i;
  $newname =~ s/\] Yumekui Merry /] Dream Eater Merry /i;
  $newname =~ s/\] Zero no Tsukaima Final /] Zero no Tsukaima F /i;
  $newname =~ s/\] Papa no Iukoto wo Kikinasai! /] Papa no Iu Koto wo Kikinasai! /i;
  $newname =~ s/\] Black★Rock Shooter /] Black Rock Shooter /i;
  $newname =~ s/\] Mobile Suit Gundam SEED HD Remaster /] Gundam SEED (Remaster) /i;
  $newname =~ s/\] *rockman exe axess /] Rockman.EXE Axess /i;
  $newname =~ s/\] *Jojo's Bizarre Adventure /] JoJo's Bizarre Adventure /i;
  $newname =~ s/^Arigatou\.Tsubasa\.Chronicles\.(|2\.)(\d{2})(|v2)\./[Arigatou] Tsubasa Chronicles $1 - $2$3/;
  $newname =~ s/^Niea\.Under\.Seven\.(\d+)\.\(Dual\.Audio\)\.XVID\.\[AM\]/[AM] Niea Under Seven - $1/;
  $newname =~ s/ Tsubasa Chronicles 2\. - / Tsubasa Chronicles 2 /;
  $newname =~ s/ *Moritasan wa Mukuchi */ Morita-san wa Mukuchi /i;
  $newname =~ s/ Hanasakeru Seishonen / Hanasakeru Seishounen /i;
  $newname =~ s/^YAMATO 3x(\d+).*/Yamato S3 - $1.mkv/i;
  $newname =~ s/ - (Ending|Opening) (\d+ *[a-z]*) (Clean) / - $1 $2 ($3) /i;
  $newname =~ s/^\[T-N\]Mirai Sentai TimeRanger (\d+)(\[[A-F0-9]{8}\])DVD(|ver2|ver3)(\.avi)$/[T-N] Mirai Sentai Time Ranger - $1 $3 [DVD]$2$4/;
  $newname =~ s/^Yamato (\d+) - remaster \(Central Anime\)/[Central Anime] Yamato - $1 /i;
  $newname =~ s/^Yamato S2 (\d+) - remaster \(Central Anime\)/[Central Anime] Yamato S2 - $1 /i;
  $newname =~ s/\[TSuNDeRe\]Tsuyokiss\.(\d+)\./[Tsundere] Tsuyokiss - $1 /i;
  $newname =~ s/\[RANDOMFAGGOTS\]/[Randomfaggots]/i;
  $newname =~ s/\[Keroro\]\.(\d+)\.\[Xvid\.mp3\]\./[Keroro] Keroro Gunsou - $1 /i;
  $newname =~ s/\[Keroro\] \.(\d+)\. \[\.mp3\] \. /[Keroro] Keroro Gunsou - $1 /i;
  $newname =~ s/\[WPP & T-N\]/[WPP T-N]/;
  $newname =~ s/(\[Jumonji-Giri\]) *\[[^]]+\]/$1/i;
  $newname =~ s/ Yuru Yuri / YuruYuri /i;
  $newname =~ s/ Creditless Ending (\d+) ver\. (\d+) / Ending $1.$2 (Clean) /i;
  $newname =~ s/ (ef - a tale of me[lm]o[dr]ies) (Ending|Opening) / $1 - $2 /i;
  $newname =~ s/ Clannad - After Story / Clannad After Story /i;
  $newname =~ s/ Manyuu Hikenchou - (\d+) ~DC~ / Manyuu Hikenchou - $1 [Uncut]/;
  $newname =~ s/\[Elysium\]K-ON!!\.EP(\d+)\(BD\.1080p\.FLAC\)/[Elysium] K-ON!! - $1 [1080p BD]/i;
  $newname =~ s/\[Elysium\]K-ON!!\.(ED|OP)(\d+)\(BD\.1080p\.FLAC\)/[Elysium] K-ON!! - $1 $2 [1080p BD]/i;
  $newname =~ s/\[Elysium\]K-ON!!\.SP\d+\[EP(\d+)\]\(BD\.1080p\.FLAC\)/[Elysium] K-ON!! - $1 [1080p BD]/i;
  $newname =~ s/^\[wpp\]digimon frontier /[wpp] Digimon Frontier /i;
  $newname =~ s/^\[ACX\]Fantastic Children - (\d+) .*/[ACX] Fantastic Children - $1.mkv/i;
  $newname =~ s/\[a-s\] sakigake!! cromartie high school - (\d+) - .* /[a-S] Sakigake!! Cromartie High School - $1 /;
  $newname =~ s/zx\.tenchi-universe\./[zx] Tenchi Universe - /;
  $newname =~ s/\[Saizen & Shinsen-Subs\]/[Saizen-SHS]/i;
  $newname =~ s/ ro-kyu-bu(!)? / Ro-Kyu-Bu! /i;
  $newname =~ s/^cor\.tv\.infinite\.ryvius\.(\d+)\./[cor] Infinite Ryvius - $1 /i;
  $newname =~ s/ Ore no Imouto ga Konna ni Kawaii Wake ga Nai / Ore no Imouto /i;
  $newname =~ s/ no 6 / No. 6 /i;
  $newname =~ s/\[ACX\]Gantz - (\d+) .* \[SaintDeath\] /[ACX] Gantz - $1 /i;
  $newname =~ s/ THE iDOLM\@STER / The Idolm\@ster /i;
  $newname =~ s/^- (\d+) - (\[neo1024\])/$2 Luping III S3 - $2/i;
  $newname =~ s/ Luping III S3 / Lupin III S3 /i;
  $newname =~ s/\] GARO - The One Who Shines in the Darkness - /] Garo - The One Who Shines in the Darkness - /i;
  $newname =~ s/( Transformers Headmasters - \d+) - .*\[/$1 [/i;
  $newname =~ s/^cor\.tv\.getbackers\.(\d+)\./[cor] GetBackers - $1 /;
  $newname =~ s/^cor\.extras\.getbackers\.(opening|ending)(\d+)\./[cor] GetBackers - $1 $2 /;
  $newname =~ s/^Revolutionary Girl Utena /[Henshin] Revolutionary Girl Utena /;
  $newname =~ s/His and Her Circumstances/His and Her Circumstances/i;
  $newname =~ s/ Lime-iro Senkitan / Lime-Colored War Tales /i;
  $newname =~ s/(Ninja Scroll) TV Ep\.(\d+)\[.*(\[SSP-Corp\])/$3 $1 - $2 /i;
  $newname =~ s/Magical Girl Madoka Magica/Puella Magi Madoka Magica/i;
  $newname =~ s/ Pretty Rhythm Aurora Dream / Pretty Rhythm - Aurora Dream /i;
  $newname =~ s/(\[dvdrip\] Transformers \(1984\) -) E(\d+) .*(\.avi)/$1 $2 $3/;
  $newname =~ s/ Highschool of the Dead / High School of the Dead /i;
  $newname =~ s/LOGH Gaiden 2 E(\d+) .*(\.avi|\.mkv)/Legend of Galactic Heroes Gaiden 2 - $1$2/i;
  $newname =~ s/^\[RaX\] *Kiba - (\d+) - .* (\[v2\] \[|\[)/[RaX] Kiba - $1 $2/;
  $newname =~ s/ (Gosick - \d+) \(Batch\) / $1 /;
  $newname =~ s/ Clannad - After Story - / Clannad After Story - /;
  $newname =~ s/ Uta no Prince Sama 2 - / Uta no Prince-sama 2 - /;
  $newname =~ s/ Ikoku Meiro no Croisée / Ikoku Meiro no Kurowaaze /i;
  $newname =~ s/^Mahoujin Guruguru TV2 - Doki Doki Densetsu Ep(\d+) \((Chamelenia)\)/[Chamelenia] Mahoujin Guruguru 2 - Doki Doki Densetsu - $1/i;
  $newname =~ s/\.divx5\.ogm$/.ogm/;
  #$newname =~ s/\[(neo1024)\] Lupin III - (\d+) - .+ \[/[$1] Lupin III S2 - $2 [/;
  $newname =~ s/ Lupin S2 - / Lupin III S2 - /;
  $newname =~ s/ Prince of Tennis (\d+)/ Prince of Tennis - $1/i;
  $newname =~ s/ Boogiepop - / Boogiepop Phantom - /i;
  $newname =~ s/ Aika Zero OVA / Aika Zero /i;
  $newname =~ s/^\[A-BT&Pakapuka\]PopoloCrois 2003 Ep/[A-BT Pakapuka] PopoloCrois (2003) - /;
  $newname =~ s/^\[A-BT&Pakapuka\] PopoloCrois Story 1998 /[A-BT Pakapuka] PopoloCrois (1998) - /;
  $newname =~ s/ (Pollyanna|Happy Kappi) Episode (\d+) / $1 - $2 /;
  $newname =~ s/\(G P\) Now and Then Here and There \(R2J\)/[G P] Now and Then Here and There - /;
  $newname =~ s/^\[Jumonji-Giri\]\[Soldats\]\[AonE&HQA\] D\.C\. Da Capo /[Jumonji-Giri] Da Capo /i;
  $newname =~ s/\[A-Flux&Lunar\]/[A-Flux Lunar]/i;
  $newname =~ s/^(Mushishi) - (\d+) - .* - (\[niizk\])/$3 $1 - $1/;
  $newname =~ s/^(Saikano) (\d+)\[h\.264-AAC\](\[SSP-Corp\])/$3 $1 - $2 /;
  $newname =~ s/^PitaTen.* Ep (\d+) .*\.avi/[Hnk] Pita Ten - $1.avi/;
  $newname =~ s/^\[a-S\] Inuyasha - (\d+|\d+-\d+) /Inuyasha - $1 [a-S]/;
  $newname =~ s/\[DVD\]\[AHQ\]/[AHQ][DVD]/;
  $newname =~ s/\[THORA\]/[Thora]/i;
  $newname =~ s/\[subdesu\]/[SubDesu]/i;
  $newname =~ s/ Zettai Shougeki - Platonic Heart / Zettai Shougeki /i;
  $newname =~ s/^ef a tale of memories (prologue|- Opening \d+|- Ending \d+|- \d+) .*THORA/[Thora] ef - a tale of memories - $1 [1080p BD]/i;
  $newname =~ s/ A-Channel / A Channel /i;
  $newname =~ s/^mars daybreak /[V-A] Mars Daybreak - /;
  $newname =~ s/ Shuffle! Episode / Shuffle! /;
  $newname =~ s/ A-Channel / A Channel /;
  $newname =~ s/ Moshidora \(Moshi Koko Yakyu no Joshi Manager ga Drucker no Management o Yondara\) / Moshidora /;
  $newname =~ s/^\[ZA\]\.Saint\.Seiya\.Episode\.(\d+)\.DVDrip\.\[X264\.AAC\(Jpn-Fre\)\.Sub\(Fre-Eng\)\.Chap\]\.mkv$/[D-YFI] Saint Seiya - $1 [DVD].mkv/;
  $newname =~ s/^HajimeNoIppo.*Round(\d+)-.*\(anime-mx\)/[Anime-MX] Fighting Spirit - $1 /;
  $newname =~ s/^(\[ACX\])(Final Fantasy Unlimited) - (\d+) .*\[ALI\] /$1 $2 - $3 /;
  $newname =~ s/^\[a-s\] inuyasha - (\d+-\d+) rs2 /[a-S] Inuyasha - $1 /;
  $newname =~ s/^(\[Kira-Fansub\]) Uchuu no (Stellvia) /$1 $2 /;
  $newname =~ s/^(\[RaX\])(Chobits) - (\d+`\d) .*\(x264 aac\) /$1 $2 - $3 /;
  $newname =~ s/ Maria( |†)Holic / Maria+Holic /i;
  $newname =~ s/ C³ / C3 - Cube x Cursed x Curious /i;
  $newname =~ s/ C3 Cube x Cursed x Curious / C3 - Cube x Cursed x Curious /i;
  $newname =~ s/ Fate( ⁄ | )Zero / Fate-Zero /i;
  $newname =~ s/ Fate( ⁄ | )Kaleid / Fate-Kaleid /i;
  $newname =~ s/ Rozen Maiden Zurückspulen / Rozen Maiden (2013) /i;
  $newname =~ s/ Watashi ga Motenai no wa Dou Kangaete ?mo Omaera ga Warui!? / Watashi ga Motenai no wa Dou Kangaete mo Omaera ga Warui! /i;
  $newname =~ s/ Pollyanna Episode / Pollyanna /;
  $newname =~ s/ Ef - A Fairy Tale of the Two / ef - A Fairy Tale of the Two /i;
  $newname =~ s/ Ef - A Fairy Tale of the Two-/ ef - A Fairy Tale of the Two -/i;
  $newname =~ s/ -Momoiro Paradox- / - Momoiro Paradox - /i;
  $newname =~ s/^Legend of Galactic Heroes - (\d+) \(([A-F0-9]{8})\) \[Central Anime\]/[Central Anime] Legend of Galactic Heroes - $1 [$2]/;
  $newname =~ s/\[Hnk\]/[HnK]/;
  $newname =~ s/^Inuyasha - (\d+|\d+-\d+)\[167\] - .*(\[DVD\]\[AHQ\])/Inuyasha - $1 $2/;
  $newname =~ s/^Saint Seiya Hades OVA - (\d+) \[(AonE-SpA|SpA)\]/[$2] Saint Seiya Hades OVA - $1/;
  $newname =~ s/\[\d+\] Saint Seiya Hades OVA - (\d+)/[SpA] Saint Seiya Hades OVA - $1/;
  $newname =~ s/ Digimon Tamers - (\d)\./ Digimon Tamers - 0$1./;
  $newname =~ s/ Kore wa Zombie Desu ka / Kore wa Zombie desu ka /i;
  $newname =~ s/ Infinite Stratos - IS - / Infinite Stratos - /;
  $newname =~ s/Shadow\.Star\.Narutaru\.(\d+)\.\(Dual\.Audio\)\.XVID\.\[AM\]/[AM] Narutaru - $1 /;
  $newname =~ s/Outlaw Star Remastered E(\d+) .*'/ Outlaw Star - $1 /;
  $newname =~ s/Ground Defense Force Mao-chan (\d+)\[h\.264-AAC\]\[SSP-Corp\]/[SSP-Corp] Mao-chan - $1 /;
  $newname =~ s/Koi Kaze (\d+) \[NAG&anime fin\]/[NAG anime-fin] Koi Kaze - $1 /;
  $newname =~ s/ Toradora - / Toradora! - /;
  $newname =~ s/ Dragon Crisis / Dragon Crisis! /;
  $newname =~ s/ Mao Chan / Mao-chan /;
  $newname =~ s/^Arigatou\.Bleach\.(\d+)\.\[h264\.AAC\]/Bleach - $1 [Arigatou]/;
  $newname =~ s/^Arigatou\.Bleach\.(\d+)\.\[x264\.AAC\]/Bleach - $1 [Arigatou]/;
  $newname =~ s/^Arigatou\.Bleach\.(\d+)\. \[\.AAC\]/Bleach - $1 [Arigatou]/;
  $newname =~ s/^Arigatou\.Bleach\.(\d+)v2\. \[\.AAC\]/Bleach - $1 [Arigatou][v2]/;
  $newname =~ s/ Ep(\d+)v3 \[R2 Video\]/ - $1 [v3]/;
  $newname =~ s/ Brighter Than The Dawning Blue - Crescent Love Ep(\d+) Subbed / Brigher Than The Dawning Blue - Crescent Love - $1 /;
  $newname =~ s/ Brighter Than The Dawning Blue - Crescent Love - (\d+) Subbed / Brigher Than The Dawning Blue - Crescent Love - $1 /;
  $newname =~ s/ Character Monologue 0/ Character Monologue /;
  $newname =~ s/Ookami-san\.to\.Shichinin\.no\.Nakama-tachi\.EP(\d+)\(BD\.1080p\.AAC\)/Ookami-san - $1 [1080p BD]/;
  $newname =~ s/Ore.?tachi ni tsubasa wa nai /Oretachi ni Tsubasa wa Nai /i;
  $newname =~ s/\[anime-rg . ray=out\]/[anime-rg ray=out]/;
  $newname =~ s/^Arigatou\.Soul\.Eater\.Ep(\d+)\. \[x264\.AAC\]/[Arigatou] Soul Eater - $1 /;
  $newname =~ s/^\[Doremi\]\.HeartCatch\.PreCure!\.(\d+)\.\[1280x720\]\./[Doremi] HeartCatch PreCure! - $1 [720p]/;
  $newname =~ s/^\[Doremi-CureCom\]\.Suite\.PreCure!\.(\d+)\.\[1280x720\]\./[Doremi-CureCom] Suite PreCure! - $1 [720p]/;
  $newname =~ s/^\[Doremi\]\.Motto\.Ojamajo\.Doremi\.(\d+)\./[Doremi] Motto Ojamajo Doremi - $1 /;
  $newname =~ s/^\[Doremi\] *\.Ojamajo\.Doremi\.Dokkaan!\.(\d+)\./[Doremi] Ojamajo Doremi Dokkaan! - $1 /;
  $newname =~ s/^\[HorribleSubs\] Lilpri /[HorribleSubs] Hime Chen! Otogi Chikku Idol Lilpri - /i;
  $newname =~ s/^\[Jumonji-Giri\] \[AnY\]/[Jumonji-Giri]/;
  $newname =~ s/\[(BWS|PM)\]Pocket Monsters Best Wishes (\d+) .+\[H264 /[$1] Pokemon Best Wishes - $2 [/;
  $newname =~ s/\[(BWS|PM)\] *Pocket Monsters Best Wishes Season (- )?2 (\d+) .+\ \[/[$1] Pokemon Best Wishes 2 - $3 [/;
  $newname =~ s/ Ookiku Furikabutte - The Summer Tournament Chapter / Ookiku Furikabutte S2 /;
  $newname =~ s/Les Miserables Shoujo Cosette /Les Miserables /;
  $newname =~ s/\[Elysium\]Baka\.to\.Test\.to\.Shoukanjuu\.(EP)?/[Elysium] Baka to Test to Shokanju/;
  $newname =~ s/\[Elysium\] Baka to Test to Shokanju/[Elysium] Baka to Test to Shokanju /;
  $newname =~ s/ Baka to Test to Shou?kanjuu? / Baka to Test to Shokanju /;
  $newname =~ s/\(BD\.1080p\.FLAC\)/[1080p BD]/;
  $newname =~ s/\(1920x1080\) \[BD\]/[1080p BD]/i;
  $newname =~ s/\[1080p\]\[BD\]/[1080p BD]/i;
  $newname =~ s/Saizen & SD/Saizen-SD/;
  $newname =~ s/Bleach - (\d{2}) /Bleach - 0$1 /;
  $newname =~ s/Omamori Himari - ED \(Clean\) - 0(\d) / Omamori Himari - Ending $1 (Clean) /;
  $newname =~ s/Omamori Himari - Opening \(Clean\) - (\d{2}) / Omamori Himari - Opening $1 (Clean) /;
  $newname =~ s/\(B-A\)Great Teacher Onizuka - Lesson /[B-A] Great Teacher Onizuka - /;
  $newname =~ s/Xam'd Lost Memories - (\d+) .* \[1080p,BluRay,,DTS\] - THORA\.mkv/[THORA] Xam'd Lost Memories - $1 [1080p BD].mkv/;
  $newname =~ s/\(G P\) Escaflowne \(Remastered\)/[G_P] Escaflowne/;
  $newname =~ s/^\(G P\) /[G_P] /;
  $newname =~ s/SD&Taka/SD-Taka/;
  $newname =~ s/Seikai no Senki/Banner of the Stars/;
  $newname =~ s/Onii-chan no Koto \.\.\. /Onii-chan no Koto Nanka Zenzen Suki Janain Dakara ne /;
  $newname =~ s/Onii-chan no Koto Nanka Zenzen Suki Janain Dakara ne /Onii-chan no Koto Nanka Zenzen Suki Janain Dakara ne!! /;
  $newname =~ s/^Strawberry 100% - (\d+\.?\d*) \[ReDone-MDC\]/[ReDone-MDC] Strawberry 100% - $1 /;
  $newname =~ s/^Strawberry 100% - OVA 0(\d+\.?\d*) \[ReDone-MDC\]/[ReDone-MDC] Strawberry 100% OVA - $1 /;
  $newname =~ s/Dragonball Kai/Dragon Ball Kai/;
  $newname =~ s/Natsu no Arashi - Akinai-chuu/Summer Storm! - Open for Business/;
  $newname =~ s/Natsu no Arashi/Summer Storm!/;
  $newname =~ s/Naruto (\d+-\d+) /Naruto - $1 /;
  $newname =~ s/Lupin III Series 1 - (\d+) - .+ \[neo1024\]/[neo1024] Lupin III - $1 /;
  $newname =~ s/Mitsudomoe Picture Drama - 0/Mitsudomoe Picture Drama - /;
  $newname =~ s/^(Fullmetal Alchemist Brotherhood .*|Star Driver .*)(\[AtsA\])/$2 $1 /i;
  $newname =~ s/(Sora no Woto|Ichiban Ushiro no Daimaou|Mayoi Neko Overrun!) - ([^ ]+|OP Clean|ED Clean|Theater [a-z0-9]+) \[BD 1080p\]\[AtsA\]/[AtsA] $1 - $2 [1080p BD]/;
  $newname =~ s/(Sora no Woto|Ichiban Ushiro no Daimaou|Mayoi Neko Overrun!) ([^ ]+|Opening Clean|Ending Clean|Theater - [a-z0-9]+) \[1080p BD\]\[AtsA\]/[AtsA] $1 - $2 [1080p BD]/;
  $newname =~ s/Battle\.Programmer\.Shirase\./Battle Programmer Shirase /;
  $newname =~ s/Battle Programmer Shirase - 0/Battle Programmer Shirase - /;
  $newname =~ s/ Kuragehime / Princess Jellyfish /;
  $newname =~ s/^\[OZC\]Code Geass Lelouch of the Rebellion R2 E(\d+) .*/[OZC] Code Geass R2 - $1.mkv/;
  $newname =~ s/ Panty and Stocking with Garterbelt / Panty & Stocking with Garterbelt /;
  $newname =~ s/ Spice and Wolf S2 / Spice and Wolf II /;
  $newname =~ s/\[A-E & Saizen\]/[A-E Saizen]/;
  $newname =~ s/\[Flomp\]\[SD\]/[Flomp]/;
  $newname =~ s/\[Jumonji-Giri\]\[Ishin\]/[Jumonji-Giri]/;
  $newname =~ s/\[Jumonji-Giri\]\[F-B&A-E\]/[Jumonji-Giri]/;
  $newname =~ s/\[Jumonji-Giri\] \[Lunar\]/[Jumonji-Giri]/;
  $newname =~ s/\[A-Kraze & Diffusion\]/[A-Kraze Diffusion]/;
  $newname =~ s/ The Story Of Saiunkoku / Saiunkoku Monogatari /i;
  $newname =~ s/Code Geass Lelouch of the Rebellion Episode (\d+) .*(\.mkv)$/ Code Geass - $1$2/i;
  $newname =~ s/ To LOVE-Ru / To Love-Ru /i;
  $newname =~ s/ Inuyasha Kanketsuhen / Inuyasha Kanketsu-hen /;
  $newname =~ s/ AIR / Air /;
  $newname =~ s/ Sister Princess Re Pure / Sister Princess Repure /;
  $newname =~ s/C:\\Users\\Gad\\Desktop\\yankee-megane\\Release\\//;
  $newname =~ s/ Ep(\d+)/ $1/i;
  $newname =~ s/\(END\)/[End]/i;
  $newname =~ s/\(BD 1280x720 h264 JP.EN AAC\)/[720p BD]/i;
  $newname =~ s/\[Final\]//i;
  $newname =~ s/DB&L-E/DB L-E/;
  $newname =~ s/IY-F&Oki/IY-F Oki/;
  $newname =~ s/L-E&AonE/AonE L-E/;
  $newname =~ s/^(Detective Conan - [[:digit:]]+-?[[:digit:]]*) (\[DCTP[^]]*\])(.+)$/$2 $1 $3/;
  $newname =~ s/^(Detective Conan - [[:digit:]]+-?[[:digit:]]*) (\[AZFS[^]]*\])(.+)$/$2 $1 $3/;
  $newname =~ s/^(Detective Conan - \d+) - .* (\[M-L\])/$1 $2/;
  $newname =~ s/^\[Derp\] Legend of the Legendary Heroes /[Derp] The Legend of the Legendary Heroes /;
  $newname =~ s/ Sengoku BASARA Two / Sengoku Basara Two /;
  $newname =~ s/ Asobi ni Ikuyo! / Asobi ni Iku Yo! /;
  $newname =~ s/ Shinrei Tantei Yakumo / Psychic Detective Yakumo /;
  $newname =~ s/ Ikkitousen Xtreme Xecutor OVA - 0/ Ikkitousen Xtreme Xecutor OVA - /;
  $newname =~ s/ Megane na Kanojo OVA - 0/ Megane na Kanojo OVA - /;
  $newname =~ s/\.Strange\.Dawn\.(\d+)\./ Strange Dawn - $1 /;
  $newname =~ s/ (Tegami Bachi|Letter Bee) REVERSE / Letter Bee Reverse /i;
  $newname =~ s/ Sora No Otoshimono / Sora no Otoshimono /;
  $newname =~ s/ Kidou Tenshi Angelic Layer (ep)?/ Angelic Layer /i;
  $newname =~ s/ Sora No Otoshimono - Forte / Sora no Otoshimono Forte /i;
  $newname =~ s/ Shinryaku! Ika Musume / Squid Girl /;
  #$newname =~ s/ Squid Girl / Shinryaku! Ika Musume /;
  $newname =~ s/ Seikimatsu Occult Gakuin / Occult Academy /;
  $newname =~ s/ Arakawa Under the Bridge ×2 / Arakawa Under the Bridge x2 /;
  $newname =~ s/ K-ON!! S2 / K-ON!! /;
  $newname =~ s/ Ookami-san To Shichinin No Nakama-tachi / Ookami-san /;
  $newname =~ s/ K-On!! / K-ON!! /;
  $newname =~ s/ Ore No Imouto / Ore no Imouto /;
  $newname =~ s/ A Certain Magical Index II / Toaru Majutsu no Index II /i;
  $newname =~ s/ TV Broadcast \[720p/ [LQ 720p/;
  $newname =~ s/ ED(\d+[a-z]*)/ - Ending $1 /i;
  $newname =~ s/ OP(\d+[a-z]*)/ - Opening $1 /i;
  $newname =~ s/ ED / - Ending /;
  $newname =~ s/ Clean (Opening|Ending) v2/ - $1 (Clean) [v2]/i;
  $newname =~ s/ Creditless (Opening|Ending) (\d+) / - $1 $2 (Clean) /i;
  $newname =~ s/ Ep(\d+) Creditless Ending / - Ending $1 (Clean) /i;
  $newname =~ s/ NC-?ED *(\d+) / - Ending $1 (Clean) /i;
  $newname =~ s/ NC-?OP *(\d+) / - Opening $1 (Clean) /i;
  $newname =~ s/ (NC-?ED|Ending Clean) / - Ending (Clean) /i;
  $newname =~ s/ (NC-?OP|Opening Clean) / - Opening (Clean)/i;
  $newname =~ s/ OP / - Opening /;
  $newname =~ s/ (\d+-\d+) / - $1 /;
  $newname =~ s/ - - / - /g;
  $newname =~ s/ Ep / /ig;
  ##SLICED BREAD
  #v2
  $newname =~ s/(\(|\[) *(10bit-v2) *(\)|\])/[v2]/i;
  #dvd v2
  $newname =~ s/ \[DVD\] v2/ [v2 DVD]/i;
  #nothing
  $newname =~ s/(\(|\[) *(AVC|480p-AC3|10bit-&MP3|h264-10bit-&MP3|divx5\.2|H264 704x400|640x480 DivX511 120fps mp3|640x480 DivX511 mp3|h\.264-Hi10P|720x480|10-?bit|10bit 480p H264|640x360|640x360 H264 AAC|h264\.aac|hi10p|10bit|\d+th Release|x264\.aac|xvid|divx5\.2\.1|divx5\.1|divx5\.05|divx5\.1\.1|h\.?264 AC3|848x480|H264 848x480|h264-480p AAC|h\.264-480p) *(\)|\])//i;
  #dvd
  $newname =~ s/(\(|\[) *(DVDRip Xvid 864x480 AC3|DVDRip 864x480|DVDRip 640x480|DVDRip h264 640x480 AAC|DVD, 480p|DVD\]\[1024x576 -|DVD H264 Hi10P 640x480|DVD Hi10P 640x480|DVD-480p-AAC|DVD x264 10-bit AC3|DVD 10bit) *(\)|\])/[DVD]/i;
  #dvd again
  $newname =~ s/(\(|\[) *(DVD 712x480|R2 DVD\.H264\.AC3|DVD H264 720x480|DVD 720x480 x264 FLAC|R1DVD 720x480 x264 AC-3|DVD 712x480 AC-3|DVD 720x480 AC-3|R\d DVD\.H264\.AC3|DVD 1024x576 x264 FLAC|DVD H264 640x480|DVD H264 720x480 AAC|DVD 704x480 H264 AC3|DVD 704x480|DVDRip\.Xvid\.864x480\.Vorbis|DVD H264 848x480|DVD 720x480|DVD H264 720x480|DVD, wmv, mp3) *(\)|\])/[DVD]/i;
  #1080p BD
  $newname =~ s/(\(|\[) *(BD\]\[1080p-AAC|1080p BD|1080p -Hi10P|1080p x264-Hi10P FLAC|BD\]\[10bit-1080p-AAC|BDRip 1080p x264 FLAC|BD Hi10P 1920x1080|BD Hi10P 1920x1080 H264 FLAC|BD 1920x1080 x264 Hi10P FLAC|BD 1920x1080 Hi10P|1920x1080 BD AAC|BD\]\[h264-1080p FLAC|BD-h264-10bit-1080p|BD\]\[1080p-FLAC|BD 1080|1920x1080 Hi10p h264 AAC|BD 1920x1080 x264 AAC|BD 1080p Hi10P|BDRip 1080p x264 FLAC|BD-1080p-|BD-1080p-FLAC|1920x1038 Blu-Ray FLAC|1920x1080 Blu-Ray FLAC|1920x1080 h264 BD FLAC|1920x1080 BD|BD\.1080p\.FLAC|BD 1080p H\.264 AAC 5\.1|BD 1080p) *(\)|\])/[1080p BD]/i;
  #720p
  $newname =~ s/(\(|\[) *(720p 10bit|10-bit 720p( AAC)?|720|Hi10P 720p-FLAC|1280x720 10bit|1280x720 10bit h264 AAC|1280x720 8bit|1280x720 x264-Hi10P AAC|AT-X Hi10P 1280x720 H264|AT-X Hi10P 1280x720|1280x720 Hi10p|AT-X Hi10P 1280x720|1280x720 Hi10p AAC|AT-X 1280x720 H264|Hi10P 1280x720 H264|Hi10P 1280x720|1280x720 Hi10P|1280x720 5\.1|1280x720 x264 AAC|1280x720 H264 AAC|720p H264 AAC|1280x720|1280x720 H\.?264 AAC) *(\)|\])/[720p]/i;
  #720p BD
  $newname =~ s/(\(|\[) *(BD 720p AAC|BD 720p|BD, 720p|BD 1280x720|BDRip 1280x720 10bit|BDRip 720p H\.264 AACx2|BDRip 720p H\.264 AAC|BDRip 720i H\.264 AAC|BDRip 720i|BD 10-bit 1280x720 x264 AAC|BD\]\[720p-|BD, 720p, 10bit, AAC|BDRip 720p x264 FLAC|BDRip 720p|BD 720p DA|Blu-Ray 960x720 Dual Audio FLAC|BD, 720p|BD\]\[h264-720p\]\[FLAC|BD Hi10P 1280x720|BD, 720p, 10bit,|BD, 720, 10bit, AAC|BDrip 720p Vorbis|BD 720p Hi10P AAC|BD, 720p,|BD 720p H264-AAC|BDRip 720p|BD, 720p, ,|1280x720 BD|BD 1280x720 H264 AAC|BD 720p|BD 720p FLAC|BD 1280x720 H264 AAC) *(\)|\])/[720p BD]/i;
  #BD
  $newname =~ s/(\(|\[) *(Blu-Ray|BD 540p) *(\)|\])/[BD]/i;
  #576p
  $newname =~ s/(\(|\[) *(576p hi10|1024x576|H264 1024x576) *(\)|\])/[576p]/i;
  #1080p
  $newname =~ s/(\(|\[) *(1080p Hi10p DTS|1920x1080) *(\)|\])/[1080p]/i;
  ##SLICED BREAD pt.2
  $newname =~ s/(\d+)v(\d+)/$1 [v$2]/i;
  $newname =~ s/\[BD\]\[1920x1080 H264-Flac\]/[1080p BD]/i;
  $newname =~ s/\[BD\]\[720p-AAC\]/[720p BD]/i;
  $newname =~ s/\.DVD/[DVD]/;
  #$newname =~ s/ ~(.+)~ / - $1 /;
  $newname =~ s/v2 \(BD-1080p\) / [v2 1080p BD]/i;
  $newname =~ s/v2 \(BD H264 1280x960 24fps AAC\) / [v2 960p BD]/i;
  $newname =~ s/BD 1280x720 FLAC\]/ 720p BD]/i;
  $newname =~ s/\[HD\]\.mp4/.mp4/;
  $newname =~ s/\[\.?AC3\]//i;
  $newname =~ s/\[720p H264 AAC5\.1\]/[720p]/;
  $newname =~ s/\[BD 720p\]/[720p BD]/;
  $newname =~ s/ \(BD H264 1280x960 24fps AAC\) / [960p BD]/i;
  $newname =~ s/ \(h\.264\) //i;
  $newname =~ s/\(xvid-mp3\)//i;
  $newname =~ s/\(BD 1920x1080 *\)/[1080p BD]/i;
  $newname =~ s/\[BD 1080p\]/[1080p BD]/i;
  $newname =~ s/v3 \(BD-1080p\) / [v3 1080p BD]/i;
  $newname =~ s/v0 \[720p\]/ [v0 720p]/i;
  $newname =~ s/v0 \[/ [v0 /i;
  $newname =~ s/\[BD 1920x1080\]/[1080p BD]/;
  $newname =~ s/\[1080p - Bluray\]/[1080p BD]/;
  $newname =~ s/\[Bluray - 1080p\]/[1080p BD]/;
  $newname =~ s/\[BD 1080p AAC\]/[1080p BD]/;
  $newname =~ s/ \(BD-1080p\) / [1080p BD]/i;
  $newname =~ s/ \(720p, BD\) / [720p BD]/i;
  $newname =~ s/ \(BD 1280x960 24fps 5\.1ch\) / [960p BD]/i;
  $newname =~ s/ \(Bluray, 720p, AAC\) / [720p BD]/i;
  $newname =~ s/ \(720p,BluRay\) / [720p BD]/i;
  $newname =~ s/ \(BD, 720p, FLAC\) / [720p BD]/i;
  $newname =~ s/\[END\]/[End]/;
  $newname =~ s/\[BD\]\[720p FLAC\]/[720p BD]/;
  $newname =~ s/\[BD\]\[720p\]/[720p BD]/;
  $newname =~ s/\[BD\]\[1080p\]/[1080p BD]/;
  $newname =~ s/\[h264-480p AAC\]//;
  $newname =~ s/\[h.264-480p\]//i;
  $newname =~ s/ v3 \[720p\]/[v3 720p]/i;
  $newname =~ s/1280x720 H264 OGG/720p/;
  $newname =~ s/ \[BD 1080p FLAC\]/ [1080p BD]/i;
  $newname =~ s/ \[720p BD FLAC\]/ [720p BD]/i;
  $newname =~ s/ \[720p Blu-ray AAC\]/ [720p BD]/i;
  $newname =~ s/ \[BD\]\[h264-1080p FLAC\]/ [1080p BD]/i;
  $newname =~ s/ \(1920x1080\) \[BD\]/ [1080p BD]/i;
  $newname =~ s/ \(960x720 Blu-Ray FLAC\) / [720p BD]/i;
  $newname =~ s/ \(1920x1080 Blu-Ray FLAC\) / [1080p BD]/i;
  $newname =~ s/ \(1280x720 Blu-Ray FLAC\) / [720p BD]/i;
  $newname =~ s/ \(1280x720 h264 BD FLAC\) / [720p BD]/i;
  $newname =~ s/\((704|720)x480 DVD (AC3|AAC)\)/ [DVD]/i;
  $newname =~ s/ \(960x720\) \[BD\]/ [720p BD]/i;
  $newname =~ s/\(704x396\)//;
  $newname =~ s/\(1280x720\)/ [720p]/i;
  $newname =~ s/\(1920x1080\)/ [1080p]/i;
  $newname =~ s/\(1024x576\)/ [576p]/i;
  $newname =~ s/\[v(\d+) 1024x576\]/[v$1 576p]/i;
  $newname =~ s/\(1280x720 h264\)/ [720p]/i;
  $newname =~ s/\(1280x720 ?(h264|x264)?( aac)?\)/ [720p]/i;
  $newname =~ s/\(720p\)/[720p]/i;
  $newname =~ s/\(1080p\)/[1080p]/i;
  $newname =~ s/\(1080p,BD\)/[1080p BD]/i;
  $newname =~ s/\(BD,1080p\)/[1080p BD]/i;
  $newname =~ s/\((BD 720p)\)/ [720p BD]/i;
  $newname =~ s/\(DVD\)/ [DVD]/i;
  $newname =~ s/\[h264-480p\]//i;
  $newname =~ s/\[H264\]//i;
  $newname =~ s/\[DVD\]\[v2\]/[v2 DVD]/i;
  $newname =~ s/xvid//i;
  $newname =~ s/\[(AC3|AAC|H264|X264)\]//i;
  $newname =~ s/\[H264&MP3\]//i;
  $newname =~ s/\[H264-AAC\]//i;
  $newname =~ s/\+AAC//i;
  $newname =~ s/\[720x480 H264-Vorbis\]//i;
  $newname =~ s/\[BD\]\[1280x720 H264-Flac\]/[720p BD]/i;
  $newname =~ s/\[h264 Vorbis\]//i;
  $newname =~ s/\[640x480 h\.264 AAC\]//i;
  $newname =~ s/\[720x480 AR h\.264 AAC\]//i;
  $newname =~ s/\[DVD H264 640x476\]/[DVD]/i;
  $newname =~ s/\[720p\]/[720p]/i;
  $newname =~ s/\[720p\]\[BD\]/[720p BD]/i;
  $newname =~ s/\[H264 1280x720\]/[720p]/i;
  $newname =~ s/\[H264 1280x720 OGG\]/[720p]/i;
  $newname =~ s/\[1280x720\]/[720p]/i;
  $newname =~ s/\[1280x720 BD\]/[720p BD]/i;
  $newname =~ s/\[h264-720p\]/[720p]/i;
  $newname =~ s/\[h264-1080p FLAC\]/[1080p]/i;
  $newname =~ s/\[BD\]\[h264-1080p AC3\]/[1080p BD]/i;
  $newname =~ s/\[-/[/i;
  $newname =~ s/ \(1280x720 x264 AAC\)/ [720p]/i;
  $newname =~ s/ *\( *\d+x(1080|960|720|576) *Blu-Ray *(FLAC|) *\) */[$1p BD]/i;
  $newname =~ s/\[720p\]\[v2\]/[v2 720p]/i;
  $newname =~ s/\[480p\]//i;
  $newname =~ s/\[v2\]\[720p\]/[v2 720p]/i;
  $newname =~ s/\[(v\d)\]\[(\d+p)(| BD)\]/[$1 $2$3]/i;
  $newname =~ s/\[H264 - AAC\]//i;
  $newname =~ s/\[H264 1280x720 AAC\] /[720p]/i;
  $newname =~ s/\[DVD 480p\]/[DVD]/i;
  $newname =~ s/\[704x480 DVD\]/[DVD]/i;
  $newname =~ s/\[720p\]\[End\]/[End 720p]/i;
  $newname =~ s/ R2 DVD\(H264\.AC3\)/ [DVD]/i;
  $newname =~ s/ - Ep / - /i;
  $newname =~ s/(h|x)\.?264//i;
  $newname =~ s/\[BD\]\[1080p-?\]/[1080p BD]/;
  $newname =~ s/AAC5\.1//;
  $newname =~ s/FLAC//;
  $newname =~ s/ aac//i;
  $newname =~ s/ ac3//i;
  $newname =~ s/\.DVD/ [DVD]/i;
  $newname =~ s/ DVD / [DVD] /i;
  $newname =~ s/\(DVD ?\)/ [DVD] /i;
  $newname =~ s/ Ep(\d+) / - $1 /;
  $newname =~ s/ Ep(\d+)v2 / - $1 [v2]/;
  #$newname =~ s/ (\d+) / - $1 /;
  $newname =~ s/ (\d+)v(2|3) / $1 [v${2}]/;
  $newname =~ s/\[720x480 AR FLAC\]//i;
  $newname =~ s/\[DVD 640x480\]/[DVD]/;
  $newname =~ s/\[BD 1280x720\]/[720p BD]/i;
  $newname =~ s/\[v(\d+) (1280x)(720)\]/[v$1 $3p]/i;
  $newname =~ s/ Episode (- )+(\d+) / - $2 /;
  $newname =~ s/ - (\d+) *v(\d) / - $1 [v$2]/i;
  $newname =~ s/\[V(\d)\]/[v$1]/;
  #DANGEROUS CLEANUPS
  $newname =~ s/ \[v(2|3)\]\[(.+)\]\[([0-9A-Fa-f]{8})\]/ [v$1 $2][$3]/;
  $newname =~ s/\]/] /g;
  $newname =~ s/\[/ [/g;
  $newname =~ s/\] +\[/][/g;
  $newname =~ s/(\[|\() +/$1/g;
  $newname =~ s/ +(\]|\))/$1/g;
  $newname =~ s/( -)+ / - /g;
  $newname =~ s/(\[|\()([0-9a-fA-F]{8})(\]|\))/[\U$2]/;
  $newname =~ s/ +(\.\w{3})$/$1/;
  $newname =~ s/\[\]//g;
  $newname =~ s/\(\)//g;
  #$newname =~ s/ - (\d+) - (\d+) / $1 - $2 /;
  #EXCEPTIONS
  $newname =~ s/^\[DB&L-E\]/[DB L-E]/;
  $newname =~ s/ VS Knight Lamune & - 40 fire / VS Knight Lamune & 40 fire /;
  $newname =~ s/ RAINBOW / Rainbow /;
  $newname =~ s/ (Infinite Ryvius - Ryvius Illusion|Infinite Ryvius - Ryvius VJ Mix|Kara no Kyoukai - Cinema Intro) - / $1 /;
  $newname =~ s/ Golgo - 13 / Golgo 13 /;
  $newname =~ s/ Strike Witches - 2 / Strike Witches 2 - /;
  $newname =~ s/ 07-GHOST / 07-Ghost /;
  $newname =~ s/ K-ON!! B-Side Theater - Uraon!! - / K-ON!! B-Side Theater - Uraon!! /;
  $newname =~ s/ Captain Tsubasa Road to - 2002 / Captain Tsubasa Road to 2002 /;
  $newname =~ s/ Ultraviolet Code - 044 - / Ultraviolet Code 044 - /;
  $newname =~ s/ Persona - 3 Picture Drama - She Goes For A Walk / Persona 3 Picture Drama - She Goes For A Walk - /;
  $newname =~ s/ SP0/ - Special /;
  $newname =~ s/ SP(\d+) / - Special $1 /;
  $newname =~ s/ (Menu|Special) - / - $1 /;
  $newname =~ s/ Animated Commentary - / - Animated Commentary /;
  $newname =~ s/ Fullmetal Alchemist Brotherhood (- |)Skit - / Fullmetal Alchemist Brotherhood - Skit /i;
  $newname =~ s/ - Picture Drama - / - Picture Drama /;
  $newname =~ s/ (Mayoi Neko Overrun! - Theater) - / $1 /;
  $newname =~ s/ Opening - / Opening /;
  $newname =~ s/ Ending - / Ending /;
  $newname =~ s/ Hidamari Sketch Hoshimittsu - Special / Hidamari Sketch Hoshimittsu Special - /;
  $newname =~ s/ Spice and Wolf S2 - BD Menu - 0/ Spice and Wolf S2 - BD Menu /;
  $newname =~ s/ Canvas - 2 - / Canvas 2 - /;
  $newname =~ s/ Devil Survivor - 2 The Animation - / Devil Survivor 2 The Animation - /;
  $newname =~ s/ Hentai Ouji to Warawanai Neko\. - / Hentai Ouji to Warawanai Neko - /i;
  $newname =~ s/\] *Photokano *- /] Photo Kano - /i;
  $newname =~ s/ To Heart - 2 / To Heart 2 /;
  $newname =~ s/ Tsubasa Chronicles - 2 (\d{2}) / Tsubasa Chronicles 2 - $1 /;
  $newname =~ s/ Mitsudomoe - 2 - / Mitsudomoe 2 - /;
  $newname =~ s/ Morita-san wa Mukuchi - 2 / Morita-san wa Mukuchi 2 /i;
  $newname =~ s/ Eyeshield - 21 - / Eyeshield 21 - /;
  $newname =~ s/ - opening - (\d+) / - Opening $1 /i;
  $newname =~ s/ - ending - (\d+) / - Ending $1 /i;
  $newname =~ s/ Eyeshield 21 - (\d{2}) / Eyeshield 21 - 0$1 /;
  $newname =~ s/ Eyeshield 21 - (\d{2})-(\d{2}) / Eyeshield 21 - 0$1-0$2 /;
  $newname =~ s/ - 2010 Young Animator / 2010 Young Animator /;
  $newname =~ s/ Mahoujin Guruguru - 2 - Doki Doki Densetsu - / Mahoujin Guruguru 2 - Doki Doki Densetsu - /;
  $newname =~ s/ The World God Only Knows - 2 - / The World God Only Knows 2 - /;
  $newname =~ s/ Legend of Galactic Heroes Gaiden - 2 - / Legend of Galactic Heroes Gaiden 2 - /;
  $newname =~ s/ Yes!* Pretty Cure - 5 Go Go! / Yes! Pretty Cure 5 Go Go! - /i;
  $newname =~ s/ Kara no Kyoukai - (\d+) / Kara no Kyoukai - Chapter $1/;
  $newname =~ s/ Persona - 4 The Animation / Persona 4 - /;
  $newname =~ s/ Persona - 4 / Persona 4 - /;
  $newname =~ s/\[G P\]/[G_P]/i;
  $newname =~ s/\[-'\]/[-__-']/;
  $newname =~ s/\['\]/[-__-']/;
  #SAFE CLEANUPS
  $newname =~ s/ +/ /g;
  $newname =~ s/^ +//;
  $newname =~ s/ *(\.[^ ]+$)/$1/;
  $newname =~ s/(- )+/- /;
  $newname =~ s/^\[N - F\]/[N-F]/;
  $newname =~ s/^\[K-F & AKUPX\]/[K-F AKUPX]/;
  $newname =~ s/^\[([&!\.\s\w\- ]+)\] (Love Get Chu|Air Master|Crystal Blaze|Fairy Tail|Yawara|Ultraviolet Code 044|Gintama|Prince of Tennis|Lupin III S2|Kyou Kara Maou|Bleach|Naruto|One Piece|Detective Conan) - (Ending \d+|Opening \d+|Special \d+|\d+|\d+-\d+) /$2 - $3 [$1]/;
  $newname =~ s/ (Senran Kagura|Aquarion EVOL|Amagami SS Plus) - (Opening|Ending) 0/ $1 - $2 /;
  $newname =~ s/^Naruto - (\d{2}) /Naruto - 0$1 /;
  $newname =~ s/^Fairy Tail - (\d{2}) /Fairy Tail - 0$1 /;
  $newname =~ s/^Naruto - (\d{2})-(\d{2}) /Naruto - 0$1-0$2 /;
  $newname =~ s/\[(v\d+)\]\[(DVD)\]/[$1 $2]/i;
  if ($^O eq "MSWin32") { $newname =~ s/ *\\ */\\/g; }
  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");
  } else {
    if($skip==1) { print("Result: $_ --> $newname\n"); }
    else {
      if(rename($_, $newname)) { print("$_ -> $newname\n"); }
      else { print("$_: rename failed\n"); }
    }
  }
  next();
}

exit(0);