Mass-rename/folder creation for Nintendon't

Discussion in 'Wii - Backup Loaders' started by Cyber Akuma, Oct 15, 2015.

  1. VashTS

    VashTS Beat it, son

    Member
    8
    GBAtemp Patron
    VashTS is a Patron of GBAtemp and is helping us stay independent!

    Our Patreon
    Mar 14, 2009
    United States
    Upstate NY
    I've had this from a member here quite a while ago. This is what I used to rename my GC isos.
     

    Attached Files:

  2. Kazuma77

    Kazuma77 GBAtemp Maniac

    Member
    6
    May 11, 2008
    United States
    Unfortunately, I can't remember what it was. And I obviously have no need to try to do it again just to get the error. All I can remember is it said something right after it finished the scan and started processing the first file, then it halted the entire operation. It's a Redump set, so, it can't be a problem with the actual files.

    USB Loader GX, Wiiflow, Postloader, Nintendont's own front end, and any other loader worth downloading is going to read the ID straight from the ISO. So, yes, having them in the folder name is completely cosmetic. Far more cosmetic than split FLAC tracks. Actually, there's nothing cosmetic about split FLAC tracks. Splitting a FLAC will actually destroy hidden track 1 audio if present, so they actually present a real threat to proper audio preservation. But you get what I mean. If you're using Foobar2000 and something like Facets, you're not complaining about properly ripped music in image format with the cue and artwork embedded, because you can see the tracks where you actually need to be able to. How the game appears on the Wii is completely up to the launcher's UI. The folder's name has zero impact. My covers downloaded just fine.

    Also, it sounds like you went to more trouble than me if it took you a few minutes to fix the 2 disc files. The entire process I described took me less than 2 minutes to actually perform. I fully automated the "disc2" renaming, merging of folders by eliminating "Disc #" from the folder names, etc. I batch processed everything, 2 disc games included. I had to separate them into 3 folders temporarily to do that, but it was easy. Once I moved everything back together, the 2 disc games merged into the correct folders on their own. The only complicated thing was trying to describe the process in a way that everyone can understand it.

    As for the batch file, it was something I already had for the purpose of downloading album art. You can't have multiple copies of folder.jpg in the same folder after all, so I use that to temporarily separate my albums into folders, then after AAD is done, I feed them back to CueTools and have it re-encode them back to the artist folder as image files with everything embedded, and delete the folders. Not the most direct approach, but I've got over 4000 albums (from over 400 artists), so embedding artwork manually is out of the question.

    Regardless, we're splitting hairs over a terrible naming scheme. Clearly the people who come up with things like this and "program.rom" have never had to run recovery software on a drive -- the folder's name is not usually something you get the luxury of recovering after all.

    Looks kind-of ghetto compared to Total Commander's mass rename tool ;) Still, any mass rename tool should get the job done. I would separate the multi-disc games so you can mass rename the "Disc 1" and "Disc 2" off of the folders, and mass rename the second discs to "disc2.iso" instead of "game.iso" as well. Then you can just move everything back to one folder and the two disc games will merge automatically. Saves you the trouble of renaming and merging them manually. But do whatever you find easier. The end result is all that matters.
     
    Last edited by Kazuma77, Mar 21, 2016
  3. rogerx

    rogerx Newbie

    Newcomer
    2
    Nov 30, 2006
    United States
    This was, indeed, the most useful post on the internet for organizing backups, so again, thank you!

    I can confirm that there is a quicker way to move - without scrubbing/copying the .iso - by using this syntax:

    Code:
    wit MOVE --source ./ --DEST "games\%N [%I]\game.iso"

    You can specify the source directory to be any specific directory (in this case, dot-slash is the current directory). I use %N in place of %G to pull the canonical game title from the database, and like you, I need to clean up multi-disc directories by hand. But it's MUCH faster that wit COPY.
     
  4. Germini

    Germini Member

    Newcomer
    2
    Oct 13, 2007
    United States
    I've created this little python script.
    What It does:
    • Verifies iso file is a valid game from wiitdb database
    • Copies iso files from current directory and subdirectories to "games" folder. In a 1:1 way. No compression.
    • Assigns game title and gameid to destination folder
    • Reads disc number, renaming iso file to disc2, instead of game.iso
    How to: place the script and wiitdb.txt in the folder where all your games are
    Get wiitdb.txt from here
    Any improvement would be appreciated : )

    Code:
    import os
    import re
    import shutil
    
    total_games = 0
    dir = "./"
    dirs = os.listdir("./")
    wiitdb = open("wiitdb.txt", "r")
    
    for root, dirs, files in os.walk(dir):
        if 'games' in dirs:
            dirs.remove('games')
        for file in files:
            if file.endswith(".iso"):
                pathfile = os.path.join(root, file)
                print("Reading file: "+ pathfile)
                f = open(pathfile)
                f.seek(0)
                header = f.read(7)
                gameid = header[:6]
                disc_number = ord(header[-1:])
                disc_number += 1
                print("GameID: "+ gameid + " Disc: "+ str(disc_number))
                match = re.search(r'\w+', gameid)
                if match:
                    if not os.path.exists(dir + "games"):
                        os.makedirs(dir+"games")
                    with open("wiitdb.txt", encoding='utf-8') as wiitdb:
                        for line in wiitdb:
                           m= re.match(gameid+r" = ([\w\W\s]+)", line)
                           if m:
                                gamename = m.group(1)
                                if ":" in gamename:
                                    gamename = gamename.replace(':', ' - ')
                                if "\n" in gamename:
                                    gamename = gamename.replace ('\n', '')
                                print("Game title: "+gamename)
                                newgamepath = dir+"games"+"/"+gamename+" ["+gameid+"]"
                                if not os.path.exists(newgamepath):
                                    os.makedirs(newgamepath)
                                    print("Copying game...")
                                    shutil.copy(pathfile, newgamepath + "/game.iso")
                                    total_games += 1
                                if  not os.path.exists(newgamepath+"/disc"+ str(disc_number)+".iso") and disc_number > 1:
                                    print("Copying game...")
                                    shutil.copy(pathfile, newgamepath + "/disc"+ str(disc_number) +".iso")
                                    total_games += 1
                else:
                    print("GameID: Invalid!!")
                print("====================================")
    print("Total games copied: " + str(total_games))
              
              
    
     
    Tx3Jorge and Prodeje79 like this.
  5. ca032769

    ca032769 GBAtemp Fan

    Member
    4
    Jan 11, 2012
    United States
    Riverside, CA
    Sorry in advance, I'm not a programmer, how do I use this to rename my GC's?
     
  6. Germini

    Germini Member

    Newcomer
    2
    Oct 13, 2007
    United States
    You must install python, then paste the code into a notepad and save it as script.py in the place where you have all your gamecube iso's, then execute it and wait :)
    I could make it an executable file but would be like 30mb :s
     
    Last edited by Germini, Sep 13, 2016
  7. ca032769

    ca032769 GBAtemp Fan

    Member
    4
    Jan 11, 2012
    United States
    Riverside, CA
    If you did make it an executable file would I still need to install Python? If not, executable file requested please.
     
  8. Prodeje79

    Prodeje79 Newbie

    Newcomer
    1
    Sep 23, 2016
    United States
    Long time lurker, just finally joined to like you post!

    This worked great for me! I am basically converting from a Wii only flash drive to a 1TB hard drive with Wii and GC stuff.....

    Next step is to edit USBLGx settings to work with Nintendont, figure out how to load all game covers to 1TB drive (instead of my SD card), and maybe add a run USBLoaderGX from home menu....

    thanks again!

    EDIT:
    I had 3 games not work. It might be because : cannot be used in a folder name? not sure.
    Maybe its the existing naming convention:
    THE LEGEND OF ZELDA The Wind Waker for USA [GZLE01]
    The Legend of Zelda - Four Swords FOR NINTENDO GAMECUBE [G4SE01]
    ZELDA OCARINA MULTI PACK [D43J01]

     
    Last edited by Prodeje79, Sep 23, 2016
    Tx3Jorge likes this.
  9. Tx3Jorge

    Tx3Jorge Newbie

    Newcomer
    1
    Sep 28, 2016
    United States
    Made an account just to give a huuge shoutout to Germini for saving me so much time with his script. It's running in the background for me as I type this post.

    I'll attach some screens so people get a feel for what it looks like. I'm using windows 10 Btw. Downloaded Python from Python.org

    Screens
     
  10. Vantis

    Vantis Member

    Newcomer
    2
    Feb 12, 2018
    Canada
    Thank you for the script

    I have a question when I try on a about 50 titles it will close the error I get is saying missing “txt” not sure if some titles are not listed in the text file and it just closes

    Have you seen this before ?

    QUOTE="Germini, post: 6676697, member: 106616"]You must install python, then paste the code into a notepad and save it as script.py in the place where you have all your gamecube iso's, then execute it and wait :)
    I could make it an executable file but would be like 30mb :s[/QUOTE]
     
  11. Vantis

    Vantis Member

    Newcomer
    2
    Feb 12, 2018
    Canada
    Germini,

    So if there is a game file the program can not scan it closes and does not continue on to the next game

    Is there a way to continue to the next one with out shutting down script ?
     
  12. evertonstz

    evertonstz Member

    Newcomer
    1
    Jan 5, 2019
    Brazil
    I know the topic is a little old, but I "fixed" some things in @Gemini 's python code to run a little better for me, if anyone is interested:
    What I changed:
    • added a percentage counter of how much the file was copied, I used threads so I don't really know how... unusual was my code...
    • the script will skip to the next iso in case it can't match the ID with the wiitdb.txt
    • in case there's already a iso in the destiny folder, the script will compare them, if they match it'll skip, if not it'll overwrite the destination iso with the source iso (can be a little slow in case the filesizes are equal, as both files will have to be hashed, but it's faster than copying the file again)
    • I'm reading the iso as bytes, seems to work better
    • cleaned the code a little and removed the need for "re matching"
    You can get it at github: https://github.com/evertonstz/nintendont-move-isos
    Any problems you guys can open an issue on github or just pm me :)
     
    Last edited by evertonstz, Feb 8, 2019
  13. scrappysphinx

    scrappysphinx Newbie

    Newcomer
    1
    Oct 30, 2010
    Hi, i tried to use your python script (just wanted to test so only 2 different games, a single disc and a multi disc game) but it gives me a GameID invalid error. Any ideas what i've done wrong?

    Reading file: ./4x4 Evo 2 (USA).iso
    GameID: Invalid!!
    ====================================

    Reading file: ./Resident Evil (USA) (Disc 1).iso
    GameID: Invalid!!
    ====================================

    Reading file: ./Resident Evil (USA) (Disc 2).iso
    GameID: Invalid!!
    ====================================

    Total ISOs copied: 0 Total ISOs ignored: 3

    I then tried the original script by Gemini earlier in the thread and that give the following output (nothing about invalid but doesn't actually make any directories or copy any games)

    Reading file: ./4x4 Evo 2 (USA).iso
    GameID: GE4E7D Disc: 1
    ====================================
    Reading file: ./Resident Evil (USA) (Disc 1).iso
    GameID: GBIE08 Disc: 1
    ====================================
    Reading file: ./Resident Evil (USA) (Disc 2).iso
    GameID: GBIE08 Disc: 2
    ====================================
    Total games copied: 0
     
  14. scrappysphinx

    scrappysphinx Newbie

    Newcomer
    1
    Oct 30, 2010
    I'm all sorted, used Wiimm and got myself a nice Nintendont folder.

    Also i reported the issues with the python script on github and evertonstz replied and advised he'll look into it which was nice :)
     
Loading...