Anime Renaming? (Absolute to Season Format)

Come up with a useful post-processing script? Share it here!
Post Reply
Plexi
Newbie
Newbie
Posts: 2
Joined: February 13th, 2011, 11:00 am

Anime Renaming? (Absolute to Season Format)

Post by Plexi »

Does anybody know of an efficient way to automate the renaming of anime files? Preferably changing the absolute number to the season episode format using data from the tvdb.

For example:   [HorribleSubs] Naruto Shippuuden - 197 [720p].mkv should be renamed to Naruto Shippuuden S10E01.

I tried using this script: http://forums.sabnzbd.org/index.php?topic=1477.0  However, it keeps giving me the error that the requested show does not have absolute number when it clearly does. Unfortunately, I have very limited knowledge of php scripting.

Any help or suggestions are appreciated.
Last edited by Plexi on February 13th, 2011, 3:42 pm, edited 1 time in total.
squareatom
Newbie
Newbie
Posts: 26
Joined: February 17th, 2011, 6:40 pm

Re: Anime Renaming? (Absolute to Season Format)

Post by squareatom »

Hi there. I updated the original script and it appears to work. I tried it on one file and it worked. I suggest trying it on one file to see if it works.

http://pastebin.com/XsXt0j6a

Props to the original author :D


EDIT: I tried on my Bleach collection and it worked as the orig author described. Oh yea!

Code: Select all

bleach.229.avi
Show name: bleach 229
Possible season number: 
Episode number: 229
Clean Show Name: bleach
TheTVDB Series Name: Bleach
TheTVDB Series ID: 74796
TheTVDB Series Season: 12
TheTVDB Series Episode: 17
SUCCESS, Renamed from TV Shows/bleach/bleach.229.avi to  TV Shows/bleach/bleach.229.S12E17.avi
Last edited by squareatom on February 17th, 2011, 6:54 pm, edited 1 time in total.
Plexi
Newbie
Newbie
Posts: 2
Joined: February 13th, 2011, 11:00 am

Re: Anime Renaming? (Absolute to Season Format)

Post by Plexi »

I works perfectly. Glad you were able to fix the original script. Thank you for all your help.  :)
fda
Newbie
Newbie
Posts: 2
Joined: March 25th, 2011, 1:25 pm

Re: Anime Renaming? (Absolute to Season Format)

Post by fda »

The script has a bug with anime episodes that are starting with a zero like episode 01,02...09.
I've changed the function that check episode number to remove the 0 and it fixed the problem.
Here the changes :

Code: Select all

function get_episode_number($input) {                                                                                       
        if (preg_match('/' . '(E|e)([0-9]+)' . '/', $input, $episodenumber) > 0) {                                          
                $episodenumber = array('del' => $episodenumber[0], 'res' => $episodenumber[2]);                             
            // fda change <--start                                                                                          
            if ($episodearray['res'][0] == '0')                                                                             
                $episodenumber['res'] = substr($episodenumber['res'], 1);                                                   
            // fda changes end-->                                                                                           
                return $episodenumber;                                                                                      
        } else {                                                                                                            
                preg_match_all('/' . '[0-9]+' . '/', $input, $matches);                                                     
                //Kijk voor alle episodes                                                                                   
                $matches = $matches[0];                                                                                     
                for ($i=0; $i < count($matches); $i++) {                                                                    
                        $lastnum = $matches[$i];                                                                            
                }                                                                                                           
                $lastnum = array('del' => $lastnum, 'res' => $lastnum);                                                     
            // fda change <--start                                                                                          
            if ($lastnum['res'][0] == '0')                                                                                  
              $lastnum['res'] = substr($lastnum['res'], 1);                                                                 
            // fda changes end-->                                                                                           
                return $lastnum;                                                                                            
        }                                                                                                                   
}               
squareatom
Newbie
Newbie
Posts: 26
Joined: February 17th, 2011, 6:40 pm

Re: Anime Renaming? (Absolute to Season Format)

Post by squareatom »

Sweet. Post the whole thing on pastebin if you could and up the version. :-)
fda
Newbie
Newbie
Posts: 2
Joined: March 25th, 2011, 1:25 pm

Re: Anime Renaming? (Absolute to Season Format)

Post by fda »

Here my version that include the fix for the episodes that  start with a 0 :

http://pastebin.com/HYSLBEu2
wingfat
Newbie
Newbie
Posts: 7
Joined: May 1st, 2011, 7:57 pm

Re: Anime Renaming? (Absolute to Season Format)

Post by wingfat »

After years of manually renaming files and using various renaming programs, I have found one that has a very high success rate. Specials can be problematic and some times I have to process twice - initally through TVrage or AniDB before processing through TVDB. I use YAMJ with PopcornHour so I need my files exactly in sync with TVDB. The program is called FileBot and is available here: http://filebot.sourceforge.net/

You can install it or run it via java on the web.

Info:  FileBot is the ultimate tool for renaming your tv shows and anime, downloading subtitles from various sources or just simple file verification.
Rename hundreds of media files in a matter of seconds

Fetch episode lists from TVRage, AniDB, TV.com, IMDb or TheTVDB
Highly accurate file / episode matching Series / Anime name auto-detection
Powerful and highly customizable episode naming scheme

I have not tried the scripts referenced in this thread but this is simple to use on any OS running Java.

WF
User avatar
Clayboy
Newbie
Newbie
Posts: 5
Joined: May 15th, 2011, 5:22 pm

Re: Anime Renaming? (Absolute to Season Format)

Post by Clayboy »

Could someone please help me set this script up to work with my sab im running windows 7 64bit i am completely lost
Jere_Tristan
Newbie
Newbie
Posts: 26
Joined: January 22nd, 2008, 1:14 am
Location: Chigau! Orewa Chigau!

Re: Anime Renaming? (Absolute to Season Format)

Post by Jere_Tristan »

wingfat wrote: After years of manually renaming files and using various renaming programs, I have found one that has a very high success rate. Specials can be problematic and some times I have to process twice - initally through TVrage or AniDB before processing through TVDB. I use YAMJ with PopcornHour so I need my files exactly in sync with TVDB. The program is called FileBot and is available here: http://filebot.sourceforge.net/

You can install it or run it via java on the web.

Info:  FileBot is the ultimate tool for renaming your tv shows and anime, downloading subtitles from various sources or just simple file verification.
Rename hundreds of media files in a matter of seconds

Fetch episode lists from TVRage, AniDB, TV.com, IMDb or TheTVDB
Highly accurate file / episode matching Series / Anime name auto-detection
Powerful and highly customizable episode naming scheme

I have not tried the scripts referenced in this thread but this is simple to use on any OS running Java.

WF

Thanks for this, it's an awesome program! I used to use TVRename, but apparently this one is much more robust! I still use TV Rename for fine-tuning the names, but what used to take me am million years now happens in just seconds, so thanks!
caisley69
Newbie
Newbie
Posts: 15
Joined: October 25th, 2012, 4:20 pm

Re: Anime Renaming? (Absolute to Season Format)

Post by caisley69 »

how can i get this work with sab as soon as the dowmoald is complete
Post Reply