emmercm / igir

🕹 A zero-setup ROM collection manager that sorts, filters, extracts or archives, patches, and reports on collections of any size on any OS.
https://igir.io/
GNU General Public License v3.0
399 stars 18 forks source link

Support region-specific consoles with output path tokens #1375

Open dirn opened 1 month ago

dirn commented 1 month ago

Is your feature request related to a problem?

Frontends like ES-DE support multiple system names for consoles released in multiple regions. For example, sfc and snes, megadrive and genesis. igir only supports ones of each of these names. In these examples it would pick snes and megadrive. I don't doubt that it's much more common for folks to keep all of the games together, but I prefer to keep them separate, partially for organization, partially because ES-DE will give me different console art when browsing through the systems.

Describe the solution you'd like

I would like a way to keep roms organized by region-specific system names. I realize there's no great way to do this as the systems will be in the same dat file. But there are region and language tokens; perhaps there's a way to factor one of those into selecting a system.

    new GameConsole(/(\W|^)SNES(\W|$)|Super (Nintendo Entertainment System|Famicom)/i, ['.sfc', '.smc'], {
      // ...
      emulationstation: {EUR: 'snes', JPN: 'sfc', USA: 'snes', WORLD: 'snes'},
      // ...
    }),

WORLD could serve as the default.

Additional context

No response

Europia79 commented 1 month ago

in the meantime, you can do your igir operations as-is... ...then afterwards, you can run a Linux, Mac, or Git-for-Windows script:

it would look something like this:

!#/bin/bash
THIS_FILE=$(realpath -P "${0}");
THIS_PATH=$(dirname "${THIS_FILE}");
roms_dir="${THIS_PATH}/roms";
us_dir="${roms_dir}/us";
eu_dir="${roms_dir}/eu";
jp_dir="${roms_dir}/jp";
wd_dir="${roms_dir}/world";

mkdir -p "${us_dir}";
mkdir -p "${eu_dir}";
mkdir -p "${jp_dir}";
mkdir -p "${wd_dir}";

find ${roms_dir} -type f -name "*" -print0 | while IFS= read -r -d '' file;
do
case "${file}" in
*Europe*|*Germany*|*France*|*Spain*|*Sweden*)
mv -- "${file}" "${eu_dir}/${file}"
;;
*Japan*|*Korea*|*China*|*Taiwan*|*Asia*)
mv -- "${file}" "${jp_dir}/${file}"
;;
*USA*)
mv -- "${file}" "${us_dir}/${file}"
;;
*Russia*|*Brazil*|*Australia*|*Argentina*|*Mexico*|*Unknown*)
mv -- "${file}" "${wd_dir}/${file}"
;;
*World*)
mv -- "${file}" "${wd_dir}/${file}"
;;
*)
mv -- "${file}" "${wd_dir}/${file}"
;;
done

Altho, this is just an example script: You will need to modify it according to your personal preferences.