I have put together a very very rough mod installer, which installs mods (given a mod directory with .tp2 files) based on a previous saved weidu.log. This is very much a work in progress, but I would appreciate any input or thoughts. The intent with this mod is to optimize the install experience if you have a long log file then it can take a considerable amount of time to install mods. This tool should help that.
Here is an example:
mod_installer --log-file /home/x/projects/bg_mods/current_bg1_weidu.log --game-directory /home/casefold/bg1--weidu-binary /home/x/projects/bg_mods/tools/weidu/weidu --mod-directories /home/x/projects/bg_mods/mods (you can browse my layout here)
Here above I am using my bg1 weidu log, I have given my game directory as /home/casefold/bg1, my weidu-binary from my tools folder and some mod directories to search.
The tool traverses folder structure (4 levels deep) until it finds a .tp2 file, which it attempts to match to an entry in the weidu.log file. From there it executes weidu with the following:
weidu {mod_name}/{mod_tp_file} --quick-log --yes --ask-only {component} --use-lang {game_lang} --language {mod_lang}
This is executed from rust as a separate process, if errors are detected the process exits, if prompts are detected user input is asked for, otherwise the mod is auto installed. Re or Already installed mods are skipped.
https://user-images.githubusercontent.com/52840419/273416999-98127744-850e-43a1-a9be-adc078b2a829.webm
Source is found here:
https://github.com/dark0dave/mod_installer
mirrors:
https://gitlab.com/dark0dave/mod_installer
https://git.sr.ht:~dark0dave/mod_installer
Shout out to @morpheus562 for being helpful as always.