Page 1 of 1

Anime Renaming? (Absolute to Season Format)

Posted: February 13th, 2011, 11:01 am
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.

Re: Anime Renaming? (Absolute to Season Format)

Posted: February 17th, 2011, 6:49 pm
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

Re: Anime Renaming? (Absolute to Season Format)

Posted: February 19th, 2011, 12:24 am
by Plexi
I works perfectly. Glad you were able to fix the original script. Thank you for all your help.  :)

Re: Anime Renaming? (Absolute to Season Format)

Posted: March 25th, 2011, 1:32 pm
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;                                                                                            
        }                                                                                                                   
}               

Re: Anime Renaming? (Absolute to Season Format)

Posted: March 25th, 2011, 6:15 pm
by squareatom
Sweet. Post the whole thing on pastebin if you could and up the version. :-)

Re: Anime Renaming? (Absolute to Season Format)

Posted: April 17th, 2011, 2:23 pm
by fda
Here my version that include the fix for the episodes that  start with a 0 :

http://pastebin.com/HYSLBEu2

Re: Anime Renaming? (Absolute to Season Format)

Posted: May 1st, 2011, 8:13 pm
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

Re: Anime Renaming? (Absolute to Season Format)

Posted: May 15th, 2011, 5:24 pm
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

Re: Anime Renaming? (Absolute to Season Format)

Posted: June 26th, 2011, 9:17 pm
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!

Re: Anime Renaming? (Absolute to Season Format)

Posted: December 17th, 2014, 5:20 pm
by caisley69
how can i get this work with sab as soon as the dowmoald is complete