mirror of
https://github.com/dragoonDorise/EmuDeck.git
synced 2025-05-05 16:02:48 +00:00
Uninstall: Fix find errors (#1277)
* If these folders do not exist, find fails, test if they exist first fix cache folder logs fix parsers rom library rom library .reset Revert "rom library .reset" This reverts commit d3f76bb8c18c0b5223e83f3932c55b52b97d89cf. ignore emulators folder -p cleaner name fuzzy fuzzy
This commit is contained in:
parent
1cae37fba2
commit
d7913c6038
@ -1,6 +1,7 @@
|
||||
#!/bin/bash
|
||||
generateGameLists() {
|
||||
pegasus_setPaths
|
||||
mkdir -p "$HOME/emudeck/cache/"
|
||||
python $HOME/.config/EmuDeck/backend/tools/generate_game_lists.py "$romsPath"
|
||||
}
|
||||
|
||||
@ -9,93 +10,107 @@ generateGameListsJson() {
|
||||
python $HOME/.config/EmuDeck/backend/tools/generate_game_lists.py "$romsPath"
|
||||
cat $HOME/emudeck/cache/roms_games.json
|
||||
#generateGameLists_artwork $userid &> /dev/null &
|
||||
generateGameLists_artwork &> /dev/null &
|
||||
generateGameLists_artwork &> /dev/null &
|
||||
generateGameLists_artwork &> /dev/null &
|
||||
generateGameLists_artwork &> /dev/null &
|
||||
generateGameLists_artwork &> /dev/null &
|
||||
if [ -f "$HOME/emudeck/cache/.romlibrary_first" ]; then
|
||||
generateGameLists_artwork &> /dev/null &
|
||||
else
|
||||
generateGameLists_artwork &> /dev/null &
|
||||
generateGameLists_artwork &> /dev/null &
|
||||
generateGameLists_artwork &> /dev/null &
|
||||
generateGameLists_artwork &> /dev/null &
|
||||
generateGameLists_artwork &> /dev/null &
|
||||
touch "$HOME/emudeck/cache/.romlibrary_first"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
generateGameLists_artwork() {
|
||||
{
|
||||
mkdir -p "$HOME/emudeck/cache/"
|
||||
local json_file="$HOME/emudeck/cache/roms_games.json"
|
||||
local json=$(cat "$json_file")
|
||||
local platforms=$(echo "$json" | jq -r '.[].id' | shuf)
|
||||
mkdir -p "$HOME/emudeck/cache/"
|
||||
echo "" > "$HOME/emudeck/logs/romlibrary.log"
|
||||
local json_file="$HOME/emudeck/cache/roms_games.json"
|
||||
local json=$(cat "$json_file")
|
||||
local platforms=$(echo "$json" | jq -r '.[].id' | shuf)
|
||||
|
||||
accountfolder=$(ls -td $HOME/.steam/steam/userdata/* | head -n 1)
|
||||
accountfolder=$(ls -td $HOME/.steam/steam/userdata/* | head -n 1)
|
||||
|
||||
dest_folder="$accountfolder/config/grid/emudeck/"
|
||||
mkdir -p "$dest_folder"
|
||||
dest_folder="$accountfolder/config/grid/emudeck/"
|
||||
mkdir -p "$dest_folder"
|
||||
|
||||
declare -A processed_games
|
||||
declare -A processed_games
|
||||
|
||||
for platform in $platforms; do
|
||||
echo "Processing platform: $platform"
|
||||
games=$(echo "$json" | jq -r --arg platform "$platform" '.[] | select(.id == $platform) | .games[]?.name' | shuf)
|
||||
for platform in $platforms; do
|
||||
echo "Processing platform: $platform" >> "$HOME/emudeck/logs/romlibrary.log"
|
||||
games=$(echo "$json" | jq -r --arg platform "$platform" '.[] | select(.id == $platform) | .games[]?.name' | shuf)
|
||||
|
||||
declare -a download_array
|
||||
declare -a download_dest_paths
|
||||
declare -a download_array
|
||||
declare -a download_dest_paths
|
||||
|
||||
for game in $games; do
|
||||
file_to_check="$dest_folder${game// /_}*"
|
||||
for game in $games; do
|
||||
file_to_check="$dest_folder${game// /_}*"
|
||||
|
||||
if ! ls $file_to_check 1> /dev/null 2>&1 && [ -z "${processed_games[$game]}" ]; then
|
||||
echo -e "$game"
|
||||
if ! ls $file_to_check 1> /dev/null 2>&1 && [ -z "${processed_games[$game]}" ]; then
|
||||
echo -e "$game" >> "$HOME/emudeck/logs/romlibrary.log"
|
||||
|
||||
fuzzygame=$(python $HOME/.config/EmuDeck/backend/tools/fuzzy_search_rom.py "$game")
|
||||
fuzzygame="${fuzzygame// /_}"
|
||||
response=$(curl -s -G "https://bot.emudeck.com/steamdbimg.php?name=$fuzzygame")
|
||||
fuzzygame=$(python $HOME/.config/EmuDeck/backend/tools/fuzzy_search_rom.py "$game")
|
||||
fuzzygame="${fuzzygame// /_}"
|
||||
echo -e "$fuzzygame" >> "$HOME/emudeck/logs/romlibrary.log"
|
||||
response=$(curl -s -G "https://bot.emudeck.com/steamdbimg.php?name=$fuzzygame")
|
||||
game_name=$(echo "$response" | jq -r '.name')
|
||||
game_img_url=$(echo "$response" | jq -r '.img')
|
||||
filename=$(basename "$game_img_url")
|
||||
dest_path="$dest_folder$game.jpg"
|
||||
|
||||
if [ ! -f "$dest_path" ] && [ "$game_img_url" != "null" ]; then
|
||||
echo -e " - $game_img_url" - $dest_path
|
||||
download_array+=("$game_img_url")
|
||||
download_dest_paths+=("$dest_path")
|
||||
processed_games[$game]=1
|
||||
|
||||
# Update the JSON with the image URL
|
||||
#json=$(echo "$json" | jq --arg platform "$platform" --arg game "$game" --arg img_url "$game_img_url" ' (.[].games[] | select(.name == $game) | .img) |= $img_url ')
|
||||
else
|
||||
response=$(curl -s -G "https://bot.emudeck.com/steamdbimg.php?name=$game")
|
||||
game_name=$(echo "$response" | jq -r '.name')
|
||||
game_img_url=$(echo "$response" | jq -r '.img')
|
||||
filename=$(basename "$game_img_url")
|
||||
dest_path="$dest_folder$game.jpg"
|
||||
|
||||
if [ ! -f "$dest_path" ] && [ "$game_img_url" != "null" ]; then
|
||||
echo -e " - $game_img_url" - $dest_path
|
||||
download_array+=("$game_img_url")
|
||||
download_dest_paths+=("$dest_path")
|
||||
processed_games[$game]=1
|
||||
|
||||
# Update the JSON with the image URL
|
||||
#json=$(echo "$json" | jq --arg platform "$platform" --arg game "$game" --arg img_url "$game_img_url" ' (.[].games[] | select(.name == $game) | .img) |= $img_url ')
|
||||
else
|
||||
echo -e " - No picture"
|
||||
if [ "$game_img_url" = "null" ]; then
|
||||
echo -e " - No picture" >> "$HOME/emudeck/logs/romlibrary.log"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Download in batches of 10
|
||||
if [ ${#download_array[@]} -ge 10 ]; then
|
||||
echo ""
|
||||
echo "Start batch"
|
||||
for i in "${!download_array[@]}"; do
|
||||
{
|
||||
curl -s -o "${download_dest_paths[$i]}" "${download_array[$i]}" > /dev/null 2>&1
|
||||
} &
|
||||
done
|
||||
wait
|
||||
# Clear the arrays for the next batch
|
||||
download_array=()
|
||||
download_dest_paths=()
|
||||
echo "Completed batch"
|
||||
echo ""
|
||||
fi
|
||||
done
|
||||
|
||||
# Download images for the current platform
|
||||
if [ ${#download_array[@]} -ne 0 ]; then
|
||||
# Download in batches of 10
|
||||
if [ ${#download_array[@]} -ge 10 ]; then
|
||||
echo ""
|
||||
echo "Start batch" >> "$HOME/emudeck/logs/romlibrary.log"
|
||||
for i in "${!download_array[@]}"; do
|
||||
{
|
||||
curl -s -o "${download_dest_paths[$i]}" "${download_array[$i]}"
|
||||
curl -s -o "${download_dest_paths[$i]}" "${download_array[$i]}" >> "$HOME/emudeck/logs/romlibrary.log"
|
||||
} &
|
||||
done
|
||||
wait
|
||||
# Clear the arrays for the next batch
|
||||
download_array=()
|
||||
download_dest_paths=()
|
||||
echo "Completed batch" >> "$HOME/emudeck/logs/romlibrary.log"
|
||||
echo ""
|
||||
fi
|
||||
wait
|
||||
|
||||
echo "Completed downloads for platform: $platform"
|
||||
done
|
||||
|
||||
# Save the updated JSON back to the file
|
||||
#echo "$json" > "$json_file"
|
||||
}
|
||||
} | tee "$HOME/emudeck/logs/romLibrary.log" 2>&1
|
||||
# Download images for the current platform
|
||||
if [ ${#download_array[@]} -ne 0 ]; then
|
||||
for i in "${!download_array[@]}"; do
|
||||
{
|
||||
curl -s -o "${download_dest_paths[$i]}" "${download_array[$i]}" >> "$HOME/emudeck/logs/romlibrary.log"
|
||||
} &
|
||||
done
|
||||
fi
|
||||
wait
|
||||
|
||||
echo "Completed downloads for platform: $platform" >> "$HOME/emudeck/logs/romlibrary.log"
|
||||
done
|
||||
|
||||
# Save the updated JSON back to the file
|
||||
#echo "$json" > "$json_file"
|
||||
}
|
||||
|
@ -33,10 +33,15 @@ uninstallEmuAI() {
|
||||
rm -rf "$HOME/.local/share/applications/$name.desktop"
|
||||
|
||||
shName=$(echo "$name" | awk '{print tolower($0)}')
|
||||
find "${launcherPath}/" "${romsPath}/emulators" "${romsPath}/desktop/remoteplay" "${romsPath}/desktop/generic-applications" -maxdepth 1 -type f \( -iname "$shName.sh" -o -iname "$shName-emu.sh" \) | \
|
||||
while read -r f
|
||||
do
|
||||
echo "deleting $f"
|
||||
rm -f "$f"
|
||||
for romfolder in "${launcherPath}/" "${romsPath}/emulators" "${romsPath}/desktop/remoteplay" "${romsPath}/desktop/generic-applications"; do
|
||||
if [ -d "$romfolder" ]; then
|
||||
find "$romfolder" -maxdepth 1 -type f \( -iname "$shName.sh" -o -iname "$shName-emu.sh" \) | \
|
||||
while read -r f; do
|
||||
echo "deleting $f"
|
||||
rm -f "$f"
|
||||
done
|
||||
else
|
||||
echo "Skipping. $romfolder does not exist."
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
@ -29,10 +29,15 @@ uninstallEmuFP() {
|
||||
flatpak uninstall "$ID" -y --system
|
||||
|
||||
shName=$(echo "$scriptname" | awk '{print tolower($0)}')
|
||||
find "${launcherPath}/" "${romsPath}/emulators" "${romsPath}/desktop/remoteplay" "${romsPath}/desktop/generic-applications" -maxdepth 1 -type f \( -iname "$shName.sh" -o -iname "$shName-emu.sh" \) | \
|
||||
while read -r f
|
||||
do
|
||||
echo "deleting $f"
|
||||
rm -f "$f"
|
||||
for romfolder in "${launcherPath}/" "${romsPath}/emulators" "${romsPath}/desktop/remoteplay" "${romsPath}/desktop/generic-applications"; do
|
||||
if [ -d "$romfolder" ]; then
|
||||
find "$romfolder" -maxdepth 1 -type f \( -iname "$shName.sh" -o -iname "$shName-emu.sh" \) | \
|
||||
while read -r f; do
|
||||
echo "deleting $f"
|
||||
rm -f "$f"
|
||||
done
|
||||
else
|
||||
echo "Skipping. $romfolder does not exist."
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
@ -27,10 +27,15 @@ uninstallGeneric() {
|
||||
rm -rf $executablepath
|
||||
|
||||
shName=$(echo "$name" | awk '{print tolower($0)}')
|
||||
find "${launcherPath}/" "${romsPath}/emulators" -maxdepth 1 -type f \( -iname "$shName.sh" -o -iname "$shName-emu.sh" \) | \
|
||||
while read -r f
|
||||
do
|
||||
echo "deleting $f"
|
||||
rm -f "$f"
|
||||
for romfolder in "${launcherPath}/" "${romsPath}/emulators" "${romsPath}/desktop/remoteplay" "${romsPath}/desktop/generic-applications"; do
|
||||
if [ -d "$romfolder" ]; then
|
||||
find "$romfolder" -maxdepth 1 -type f \( -iname "$shName.sh" -o -iname "$shName-emu.sh" \) | \
|
||||
while read -r f; do
|
||||
echo "deleting $f"
|
||||
rm -f "$f"
|
||||
done
|
||||
else
|
||||
echo "Skipping. $romfolder does not exist."
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
@ -20,7 +20,11 @@ def generate_game_lists(roms_path):
|
||||
name_cleaned = name_cleaned.replace(' ', '_')
|
||||
name_cleaned = name_cleaned.replace('-', '_')
|
||||
name_cleaned = re.sub(r'_+', '_', name_cleaned)
|
||||
|
||||
name_cleaned = name_cleaned.replace('+', '_')
|
||||
name_cleaned = name_cleaned.replace('&', '_')
|
||||
name_cleaned = name_cleaned.replace('!', '')
|
||||
name_cleaned = name_cleaned.replace("'", '')
|
||||
name_cleaned = name_cleaned.replace('.', '')
|
||||
name_cleaned_pegasus = name.replace(' ', '_')
|
||||
|
||||
clean_name = name_cleaned
|
||||
@ -48,7 +52,7 @@ def generate_game_lists(roms_path):
|
||||
game_list = []
|
||||
|
||||
for system_dir in valid_system_dirs:
|
||||
if any(x in system_dir for x in ["/ps3", "/xbox360", "/model2", "/genesiswide", "/mame"]):
|
||||
if any(x in system_dir for x in ["/ps3", "/xbox360", "/model2", "/genesiswide", "/mame", "/emulators"]):
|
||||
continue
|
||||
|
||||
with open(os.path.join(system_dir, 'metadata.txt')) as f:
|
||||
|
Loading…
x
Reference in New Issue
Block a user