RETROBAT Official Board
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Script to add roms mixed from multiple external storages at the same time

3 posters

Go down

Script to add roms mixed from multiple external storages at the same time Empty Script to add roms mixed from multiple external storages at the same time

Post by hozerino 17/11/22, 06:08 am

Hey everyone, when I started using RetroBat, I got into the same point of when I used EmuELEC: I wanted to read roms from both the internal drive and external drives, so instead of making symbolic links rom by rom or folder by folder, I decided to make a (very "ugly") script to do so. I used to have a Bash Script for EmuELEC (I won't post it here because that's not the intention, but it's easy to find online if you need), and I kinda transformed it into two Python scripts where I can use it on my Windows PC.

Besides having some .py files, what I do (and recommend) is using py2exe and creating an executable file so any PC can run it (even without Python installed); however I won't post the executables because you wouldn't be able to (easily) verify what's in it.

Scripts:
https://github.com/Hozerino/rom-linker

How to use them:
1) Add all 3 files on the RetroBat root folder (the script needs to be 1 folder away of the /roms/)
2) Have one (or more) external drives with a folder called "roms" on the ROOT of it
3) Run clear_and_create_links.py to create the links
4) Restart RetroBat or update Game Lists
5) [Optional] Run clear.py to remove the links and make it all like before

How does it work:
Basically what it does is:
For every external drive, it will look for the roms/ folder, inside of it, if there are any folders, it will create a symbolic link on RetroBat/roms/that_folder pointing to external_drive/roms/that_folder, that way, when RetroBat accesses "that_folder", it will look into the folder inside external_drive.
Also, the folder that already existed inside RetroBat/roms will be renamed to "that_folder_bkp", which the "clear" part of the script returns to normal.

Problems:
- If you have the SAME console folder on more than one external drive, it may behave in a weird way. I only tested it by using 1 external storage
- There's no (known) way to run it from inside RetroBat's UI. I added the exe I created as a Windows game, but as it needs to be executed as Admin, I couldn't make it run.


EDIT: Forgot to mention. My original idea was to take the bash script I used on EmuELEC and transform it into a Batch script, but I realized that my batch knowledge was far from ideal (my Python knowledge isn't ideal as well, but it gets the job done sometimes). So if there is already some script that does that natively for Windows, I'll appreciate it.


Last edited by hozerino on 26/09/23, 08:54 pm; edited 2 times in total (Reason for editing : Mentioning a bit of background for the script origin)
hozerino
hozerino

Messages : 50
Date d'inscription : 2022-11-17

Aynshe likes this post

Back to top Go down

Script to add roms mixed from multiple external storages at the same time Empty Re: Script to add roms mixed from multiple external storages at the same time

Post by Aynshe 18/11/22, 05:13 pm

Hi, thanks for sharing.
If the opportunity arises I will give it a try.


Script to add roms mixed from multiple external storages at the same time Modo
Aynshe
Aynshe

Messages : 432
Date d'inscription : 2022-03-18

Back to top Go down

Script to add roms mixed from multiple external storages at the same time Empty Re: Script to add roms mixed from multiple external storages at the same time

Post by aleeat 21/11/22, 09:40 pm

hi, does this work to link another internal drive? What happens is that a disk is already full, and I have another one connected, but I don't know how to configure retrobat so that it reads ROMs in different folders or SSDs
aleeat
aleeat

Messages : 1
Date d'inscription : 2022-11-21

Back to top Go down

Script to add roms mixed from multiple external storages at the same time Empty Re: Script to add roms mixed from multiple external storages at the same time

Post by hozerino 21/11/22, 09:49 pm

aleeat wrote:hi, does this work to link another internal drive?  What happens is that a disk is already full, and I have another one connected, but I don't know how to configure retrobat so that it reads ROMs in different folders or SSDs

As long as the other internal drive has a letter assigned to it (example: your roms are in F: drive) and has a folder on the path "F:/roms/*" (where * is the console location, like F:/roms/nds, F:/roms/megadrive etc), it will work.

What it does is:
Say your RetroBat is in C:/RetroBat, so your roms folder is C:/RetroBat/roms, right?
You'll put the scripts in C:/RetroBat/script_here.py, when you run it, it will look for EVERY drive letter, trying to find the "X:/roms" folder, if it does find it, the script will do as follows:
- Check every console folder inside "X:/roms", let's say it finds a "X:/roms/n64"
- If there is a console, make a backup of "C:/RetroBat/n64" -> "C:/RetroBat/n64_bkp"
- Create a symbolic link from "C:/RetroBat/n64" to "X:/roms/n64"
So everytime RetroBat looks for roms inside N64, it will see the games from the X: drive.

Does that make sense?
hozerino
hozerino

Messages : 50
Date d'inscription : 2022-11-17

Back to top Go down

Script to add roms mixed from multiple external storages at the same time Empty Re: Script to add roms mixed from multiple external storages at the same time

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum