myonions Posted September 14, 2012 Share Posted September 14, 2012 I wrote a little application yesterday for a specific purpose as there didn't seem to be anything around to do what I wanted. Hopefully it will be of use to others!ProblemI have a set of disc images for a particular Emulator.The files were all zipped in rar format and unzipped into ISO, CUE files.The filenames were a bit untidy so I wanted to rename them. A few examples:3_in_1_DUO_Demo_CD_(NTSC-U)_[DUO_DEMO_01].rarAdvanced_Variable_Geo_(NTSC-J)_[GLCD4001].rarBasted_(NTSC-J)_[NAPR-1042].rarF1_Team_Simulation_Project_F_(NTSC-J)_[TJCD2026].rarZero_Wing_(NTSC-J)_[NXCD1003].rarI know that GameEx can replace underscores and hide text in brackets but I wanted to tidy them up. You can use the same method for simple things like changing the Regions from (U) to (USA) for thousands of files...Solution - Part 1 - Extract AllFirstly I selected all 500+ files and selected WinRAR option "Extract Here".This left me with 1000+ files in this format:3_in_1_DUO_Demo_CD_(NTSC-U)_[DUO_DEMO_01].iso3_in_1_DUO_Demo_CD_(NTSC-U)_[DUO_DEMO_01].cueAdvanced_Variable_Geo_(NTSC-J)_[GLCD4001].isoAdvanced_Variable_Geo_(NTSC-J)_[GLCD4001].cueBasted_(NTSC-J)_[NAPR-1042].isoBasted_(NTSC-J)_[NAPR-1042].cueF1_Team_Simulation_Project_F_(NTSC-J)_[TJCD2026].isoF1_Team_Simulation_Project_F_(NTSC-J)_[TJCD2026].cueZero_Wing_(NTSC-J)_[NXCD1003].isoZero_Wing_(NTSC-J)_[NXCD1003].cueSolution - Part 2 - Renaming FilesI copied the ISOs and CUEs only into a seperate folder.I then downloaded this portable application:http://portableapps....enamer_portableWhat you do is point Ant Renamer to a folder and then you can replace or delete certain characters from the filenames in one swoop.I made these changes:- String Replacement - Replace '(NTSC-J)' with '(Japan)'- String Replacement - Replace '(NTSC-U)' with '(USA)'- Characters Deletion - After The String ')' to remove the text in square brackets (i.e. '[NXCD1003]'). I had to click this a few times until everything was cleared. It does not touch the file extension so you can spam it.- String Replacement - Replace '_' with ' ' to replace the Underscores with spaces.The files are now named like this:3 in 1 DUO Demo CD (USA).cue3 in 1 DUO Demo CD (USA).isoAdvanced Variable Geo (Japan).cueAdvanced Variable Geo (Japan).isoBasted (Japan).cueBasted (Japan).isoF1 Team Simulation Project F (Japan).cueF1 Team Simulation Project F (Japan).isoZero Wing (Japan).cueZero Wing (Japan).isoSolution - Part 3 - The CUE ProblemNow this is where I have a problem. Each cue file will have an entry on the first line pointing to the name of the related ISO/BIN/IMG file like this:FILE "3_IN_1_DUO_DEMO_CD_(NTSC-U)_[DUO_DEMO_01].ISO" BINARY TRACK 01 AUDIO INDEX 01 00:00:00 TRACK 02 MODE1/2352 PREGAP 00:03:00 INDEX 01 00:44:65 TRACK 03 AUDIO PREGAP 00:02:00 INDEX 01 01:04:29 TRACK 04 MODE1/2352 etc etcAs you can see - it still has the name of the old file. It needs to now read like this:FILE "3 in 1 DUO Demo CD (USA).ISO" BINARY TRACK 01 AUDIO INDEX 01 00:00:00 TRACK 02 MODE1/2352 PREGAP 00:03:00 INDEX 01 00:44:65 TRACK 03 AUDIO PREGAP 00:02:00 INDEX 01 01:04:29 TRACK 04 MODE1/2352 etc etcI scanned the internet for something that would change just the first row in a text file to the name of another file. Nothing exists and so this means manually copying and pasting the new filename into each of the 500+ cue files.. Solution - Part 4 - Correcting the CuesSince nothing exists I wrote a small application in Dot.Net to do the job.Here it is! CUERenamer.exe.txt (Remove .txt Extension)It was written using Dot.net 3.5 which runs natively in Windows 7 so it doesn't need to be installed. You may have to install the Dot Net framework on XP though.My colleague at work has also made a ".bat" file for this purpose as well so if you don't trust running my EXE file I will post this as well. Mine is quicker though - processing 500 cue files in about 3 seconds!This is how to use the app:- Open the App- Select a folder that contains the CUE files using the '...' button at the top- All CUE files found will be populated into the list box- Click "Process" and it will go through all of the CUE files one by one and amend the first row to correspond with the name of the CUE file. So this:FILE "3_IN_1_DUO_DEMO_CD_(NTSC-U)_[DUO_DEMO_01].ISO" BINARYBecomes this:FILE "3 in 1 DUO Demo CD (USA).ISO" BINARYThe file extension (iso, bin, img) will remain the same as the original - just the filename will change (the bit highlighted in blue above).It will read the original CUE files and write new CUE files for each into a Subfolder named 'Output'. It won't change the original files.Note that if you have cue files with entries to multiple BIN files or WAV/MP3 files - these will have to be updated manually - this only updates the first row.Took me about 3 hours to write this application but has saved 3 times that time in effort already.Here are some screenshots showing what I describe above.ProcessCUEsVisualGuide.pdfHope it's of some use to others. 3 Quote Link to comment Share on other sites More sharing options...
Adultery Posted September 14, 2012 Share Posted September 14, 2012 Always nice to see things being coded up! Nice work. Quote Link to comment Share on other sites More sharing options...
KRC Posted September 14, 2012 Share Posted September 14, 2012 Good Stuff myonions Quote Link to comment Share on other sites More sharing options...
myonions Posted September 14, 2012 Author Share Posted September 14, 2012 Here is the BAT file my colleague made as well:CueRen.bat.txt (remove .txt Extension)Simply put the bat file in the folder with all of your CUES and run it.Amended CUEs are again copied into a "\Output" folder.It will do the same thing - albeit a little slower Nice to see we are both making the most of our time at work eh!I think you just have to amend this line if your cue files relate to anything but ISOs:set str=%str:cue=iso%change to (for example)set str=%str:cue=bin%set str=%str:cue=img%etc Quote Link to comment Share on other sites More sharing options...
Bigby Posted September 14, 2012 Share Posted September 14, 2012 This has been a HUGE help to me... thank you!What can I now use to batch rezip them?I would want them all individually 7-zipped. Quote Link to comment Share on other sites More sharing options...
myonions Posted September 14, 2012 Author Share Posted September 14, 2012 This has been a HUGE help to me... thank you!What can I now use to batch rezip them?I would want them all individually 7-zipped.That would require some more bat file work.I'll give it some thought for you! Quote Link to comment Share on other sites More sharing options...
myonions Posted September 14, 2012 Author Share Posted September 14, 2012 OK.Download 7-Zip portable and install if you don't have it. Get a portable version here:http://portableapps..../7-zip_portableThe only files you will need from the installation are:7z.exe7z.dllCopy these from the 7z Installation folder (eg. PortableApps\7-ZipPortable\App\7-Zip) into the same folder as the cue files and related bins/isos.Download this bat file and copy this to the same folder as well:Rezip.bat.txt (remove .txt extension)Run the Rezip.bat file! 1 Quote Link to comment Share on other sites More sharing options...
Bigby Posted September 14, 2012 Share Posted September 14, 2012 Thanks again! Quote Link to comment Share on other sites More sharing options...
MoggFanatic Posted March 18, 2014 Share Posted March 18, 2014 Thank you for your great tool!It saved me a lot of work!One tiny thing, why a output folder? i now have to move many files :-(, maybe there should be a checkbox if you want it to be in a output folder (ok i got it, it's only a probelm when you have separate folders :-(and maybe look in foldersKeep up the good workPS: It took me hours to figure out why MEDNAFEN (PCE CD) was suddenly not working, GameEx changed the Name of the Iso's, replacing dashes, and the CUE files pointed to the original names with dashes.Maybe there should be a little warning when enabling it in GameEx-Wizard, like: warning beware of your cue files etc. this will screw you! ;-) Quote Link to comment Share on other sites More sharing options...
soqueroeu Posted February 9, 2019 Share Posted February 9, 2019 Nice Tools. Saved may day! Thanks a lot! myonions, i love you Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.