Last active
August 29, 2022 14:17
-
-
Save thingsiplay/21595bf70743dde56539696f7bd942ad to your computer and use it in GitHub Desktop.
Download RetroArch playlists from balb and convert paths to native Linux installation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env bash | |
# https://gist.github.com/thingsiplay/21595bf70743dde56539696f7bd942ad | |
# Downloads playlists from "balb" user to be used in RetroArch under native | |
# installation for Linux. It will download all playlists, convert internal | |
# paths, change the filename and move it to the playlists folder. You have to | |
# set all three "_dir" variables below, as the default values are only my | |
# personal setup. | |
### YOUR SETTINGS | |
# Update the path to the main roms directory in the .lpl file. | |
roms_dir="~/Emulatoren/games/" | |
# Update the path to the cores directory in the .lpl file. | |
cores_dir="~/.config/retroarch/cores/" | |
# Destination folder for playlists files of your RetroArch installation. | |
# Created .lpl files will be copied to this place. | |
playlists_dir="~/.config/retroarch/playlists/" | |
### END OF YOUR SETTINGS | |
git clone "https://github.com/balb/lakka-playlists" | |
cd "lakka-playlists/playlists" | |
roms_dir="$(readlink -f "${roms_dir/#\~/$HOME}")" | |
cores_dir="$(readlink -f "${cores_dir/#\~/$HOME}")" | |
playlists_dir="$(readlink -f "${playlists_dir/#\~/$HOME}")" | |
if [ ! -d "$roms_dir" ]; then | |
echo "Directory does not exist: \"$roms_dir\"" | |
exit | |
fi | |
if [ ! -d "$cores_dir" ]; then | |
echo "Directory does not exist: \"$cores_dir\"" | |
exit | |
fi | |
if [ ! -d "$playlists_dir" ]; then | |
echo "Directory does not exist: \"$playlists_dir\"" | |
exit | |
fi | |
for file in *.lpl | |
do | |
file="$(readlink -f "$file")" | |
new_file="${file/A - /balb - }" | |
cp "$file" "$new_file" | |
path="\"path\": \"/storage/roms/" | |
replace="\"path\": \"$roms_dir/" | |
sed -e "s,$path,$replace," "$new_file" -i | |
path="\"core_path\": \"/tmp/cores/" | |
replace="\"core_path\": \"$cores_dir/" | |
sed -e "s,$path,$replace," "$new_file" -i | |
mv "$new_file" "$playlists_dir" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment