FEATURES: migrated deploy_helper_files and find_empty_rom_folders

This commit is contained in:
XargonWan 2024-08-07 22:27:54 +09:00
parent ae0eaf7297
commit 44d693f40e
3 changed files with 14 additions and 15 deletions

View file

@ -44,14 +44,9 @@ find_empty_rom_folders() {
empty_rom_folders_list=()
all_empty_folders=()
all_helper_files=()
while IFS='^' read -r file dest || [[ -n "$file" ]];
do
if [[ ! "$file" == "#"* ]] && [[ ! -z "$file" ]]; then
all_helper_files=("${all_helper_files[@]}" "$file")
fi
done < "$helper_files_list"
# Extract helper file names using jq and populate the all_helper_files array
all_helper_files=($(jq -r '.helper_files | to_entries | .[] | .value.filename' "$features"))
for system in $(find "$roms_folder" -mindepth 1 -maxdepth 1 -type d -printf '%f\n')
do
@ -70,8 +65,8 @@ find_empty_rom_folders() {
all_empty_folders=("${all_empty_folders[@]}" "$(realpath $dir)")
echo "$(realpath $dir)" >> "$godot_empty_roms_folders" # Godot data transfer temp file
elif [[ $count -eq 2 ]] && [[ "$files" =~ "systeminfo.txt" ]]; then
# Directory contains 2 files, one of which is "systeminfo.txt"
for helper_file in ${all_helper_files[@]} # Compare helper file list to dir file list
contains_helper_file="false"
for helper_file in "${all_helper_files[@]}" # Compare helper file list to dir file list
do
if [[ "$files" =~ "$helper_file" ]]; then
contains_helper_file="true" # Helper file was found
@ -87,3 +82,4 @@ find_empty_rom_folders() {
fi
done
}

View file

@ -45,7 +45,6 @@ remote_network_target_1="https://flathub.org"
remote_network_target_2="$rd_repo" # The URL of a common internet target for testing network access
remote_network_target_3="https://one.one.one.one" # The URL of a common internet target for testing network access
helper_files_folder="$config/retrodeck/helper_files" # The parent folder of RetroDECK documentation files for deployment
helper_files_list="$config/retrodeck/reference_lists/helper_files_list.cfg" # The list of files to be deployed and where they go
rd_appdata="/app/share/appdata/net.retrodeck.retrodeck.appdata.xml" # The shipped appdata XML file for this version
rpcs3_firmware="http://dus01.ps3.update.playstation.net/update/ps3/image/us/2023_0228_05fe32f5dc8c78acbcd84d36ee7fdc5b/PS3UPDAT.PUP"
RA_API_URL="https://retroachievements.org/dorequest.php" # API URL for RetroAchievements.org

View file

@ -570,18 +570,22 @@ update_splashscreens() {
}
deploy_helper_files() {
# This script will distribute helper documentation files throughout the filesystem according to the $helper_files_list
# This script will distribute helper documentation files throughout the filesystem according to the JSON configuration
# USAGE: deploy_helper_files
while IFS='^' read -r file dest || [[ -n "$file" ]];
do
if [[ ! "$file" == "#"* ]] && [[ ! -z "$file" ]]; then
# Extract helper files information using jq
helper_files=$(jq -r '.helper_files | to_entries | map("\(.value.filename)^\(.value.location)")[]' "$features")
# Iterate through each helper file entry
while IFS='^' read -r file dest; do
if [[ ! -z "$file" ]] && [[ ! -z "$dest" ]]; then
eval current_dest="$dest"
cp -f "$helper_files_folder/$file" "$current_dest/$file"
fi
done < "$helper_files_list"
done <<< "$helper_files"
}
splash_screen() {
# This function will replace the RetroDECK startup splash screen with a different image if the day and time match a listing in the JSON data.
# USAGE: splash_screen