Compare commits

...

17 commits

Author SHA1 Message Date
Dragoon Dorise 92421ea669
Merge acb1e0da95 into 73f38af040 2024-05-09 20:03:52 -05:00
Dragoon Dorise 73f38af040 snes 2024-05-10 00:02:59 +02:00
Dragoon Dorise b3af3ae4d4 genesis 2024-05-10 00:02:18 +02:00
Dragoon Dorise b027aaafe3 all systems but ps3 2024-05-10 00:00:31 +02:00
Dragoon Dorise cc58433b05 snes test 2024-05-09 23:57:47 +02:00
Dragoon Dorise d9d3a826e4 no ps3 2024-05-09 23:56:23 +02:00
Dragoon Dorise e78606b819 no ps3 2024-05-09 23:53:34 +02:00
Dragoon Dorise 3085288717 all games 2024-05-09 23:50:36 +02:00
Dragoon Dorise e79b1aff03 fixes [] 2024-05-09 23:48:16 +02:00
Dragoon Dorise 7c61546295 snes test 2024-05-09 23:36:13 +02:00
Dragoon Dorise 7810440101 using jq 2024-05-09 23:00:25 +02:00
Dragoon Dorise 007275f6c7 file count gamelist 2024-05-09 22:54:52 +02:00
Dragoon Dorise 48e07bfc1f paths 2024-05-09 21:39:56 +02:00
Dragoon Dorise c49a0eb284
generateGameLists (#1218) 2024-05-09 21:18:16 +02:00
Dragoon Dorise 69a5c9a98e flatpakupdate 2024-05-09 19:35:35 +02:00
Dragoon Dorise acb1e0da95
Merge branch 'dev' into issue/1208 2024-05-07 16:48:49 +02:00
Dragoon Dorise e6ba4aad8d 1208 2024-04-29 12:51:26 +02:00
7 changed files with 237 additions and 12 deletions

View file

@ -1,20 +1,20 @@
#!/bin/bash
BINUP_toolName="EmuDeck Tool Updater"
BINUP_toolName="EmuDeck AppImage Updater"
BINUP_toolType="script"
BINUP_toolPath="${toolsPath}/binupdate/binupdate.sh"
BINUP_Shortcutlocation="$HOME/Desktop/EmuDeckBinUpdate.desktop"
BINUP_install(){
BINUP_install(){
rsync -avhp --mkpath "$EMUDECKGIT/tools/binupdate" "$toolsPath/"
chmod +x "$BINUP_toolPath"
#update the paths in the script
sed -i "s|/run/media/mmcblk0p1/Emulation/roms|${romsPath}|g" "$BINUP_toolPath"
sed -i "s|/run/media/mmcblk0p1/Emulation/tools|${toolsPath}|g" "$BINUP_toolPath"
sed -i "s|/run/media/mmcblk0p1/Emulation/tools|${toolsPath}|g" "$BINUP_toolPath"
#createDesktopShortcut "$BINUP_Shortcutlocation" "$BINUP_toolName" "bash $BINUP_toolPath" "True"
}

View file

@ -0,0 +1,19 @@
#!/bin/bash
FlatpakUP_toolName="EmuDeck Flatpak Updater"
FlatpakUP_toolType="script"
FlatpakUP_toolPath="${toolsPath}/flatpakupdate/flatpakupdate.sh"
FlatpakUp_install(){
rsync -avhp --mkpath "$EMUDECKGIT/tools/flatpakupdate" "$toolsPath/"
chmod +x "$FlatpakUP_toolPath"
#update the paths in the script
sed -i "s|/run/media/mmcblk0p1/Emulation/roms|${romsPath}|g" "$FlatpakUP_toolPath"
sed -i "s|/run/media/mmcblk0p1/Emulation/tools|${toolsPath}|g" "$FlatpakUP_toolPath"
#createDesktopShortcut "$FlatpakUP_Shortcutlocation" "$FlatpakUP_toolName" "bash $FlatpakUP_toolPath" "True"
}

View file

@ -0,0 +1,140 @@
#!/bin/bash
#based in https://gist.github.com/ibackz/b959df705ed071852146510714f970d7
EmuDeckM3U(){
local system=$1
# A variable to store all M3U files to be created
declare -A m3u_files
# Iterate through all directories in the current location
for dir in $romsPath/$system; do
# Skip if not a directory
[ -d "$dir" ] || continue
# Change into the directory
cd "$dir"
# Iterate through all files in the directory
for file in *; do
# Check if the file contains the pattern '(Disc {digit})', skip if not
if [[ ! $file =~ \(Disc\ [0-9]+\).* ]]; then
continue
fi
# Extract the base filename by removing everything from the pattern '(Disc {digit})' onward
base_name="${file%% (Disc [0-9]*).*}"
# Skip if the M3U file already exists
if [ -f "$base_name.m3u" ]; then
continue
fi
# Append the file to the list associated with its base name
m3u_files["$base_name"]+="$base_name/$file"$'\n'
done
# Change back to the parent directory
cd ..
done
# Check if there are any M3U files to be created
if [ ${#m3u_files[@]} -eq 0 ]; then
text="$(printf "<b>No M3U files to be created.</b>\nMake sure your files are named\n<b>Game (Disc X)</b> with no spaces in (Disc X)")"
zenity --error \
--title="EmuDeck M3U tool" \
--width=250 \
--ok-label="Bye" \
--text="${text}" 2>/dev/null
exit
fi
# List all M3U files to be created
concatenated=""
for base_name in "${!m3u_files[@]}"; do
concatenated+="$base_name.m3u "
done
concatenated="${concatenated% }"
# Provide a rough estimate for time needed
#echo "Estimated time to complete: ${#m3u_files[@]} seconds."
# Ask the user for confirmation
text="$(printf "Lists to be created: $concatenated")"
zenity --question \
--title="Would you like to create the playlists?" \
--width=450 \
--cancel-label="Exit" \
--ok-label="Continue" \
--text="${text}" 2>/dev/null
ans=$?
if [ $ans -eq 0 ]; then
echo "Continue..."
else
exit
fi
for dir in $romsPath/$system; do
# Skip if not a directory
[ -d "$dir" ] || continue
# Change into the directory
cd "$dir"
# Iterate through all files in the directory
for file in *; do
# Check if the file contains the pattern '(Disc {digit})', skip if not
if [[ ! $file =~ \(Disc\ [0-9]+\).* ]]; then
continue
fi
# Extract the base filename by removing everything from the pattern '(Disc {digit})' onward
base_name="${file%% (Disc [0-9]*).*}"
#We move the files in its own subfolders
mkdir -p $base_name
mv "$file" "$base_name/$file"
done
# Change back to the parent directory
cd ..
done
# Iterate through the base filenames and create .m3u files for each
for dir in */; do
# Skip if not a directory
[ -d "$dir" ] || continue
# Change into the directory
cd "$dir"
for base_name in "${!m3u_files[@]}"; do
# Get the files for this base name
files="${m3u_files["$base_name"]}"
# Define the M3U file path
m3u_file="$base_name.m3u"
# Create an .m3u file
echo -e "$files" > "$m3u_file"
echo "Created $m3u_file"
done
# Change back to the parent directory
cd ..
done
zenity --info \
--text="Lists created, old files moved to new subfolders" \
--title="EmuDeck M3U Tool" \
--width=400 \
--height=300
# Close the window (this might be OS-dependent)
exit
}

View file

@ -45,6 +45,7 @@ source "$EMUDECKGIT"/functions/createFolders.sh
source "$EMUDECKGIT"/functions/runSRM.sh
source "$EMUDECKGIT"/functions/appImageInit.sh
source "$EMUDECKGIT"/functions/autofix.sh
source "$EMUDECKGIT"/functions/generateGameLists.sh
#toolScripts
@ -54,6 +55,7 @@ source "$EMUDECKGIT"/functions/ToolScripts/emuDeckPlugins.sh
source "$EMUDECKGIT"/functions/ToolScripts/emuDeckSRM.sh
source "$EMUDECKGIT"/functions/ToolScripts/emuDeckCHD.sh
source "$EMUDECKGIT"/functions/ToolScripts/emuDeckBINUP.sh
source "$EMUDECKGIT"/functions/ToolScripts/emuDeckFlatpakUP.sh
source "$EMUDECKGIT"/functions/ToolScripts/emuDeckCloudBackup.sh
source "$EMUDECKGIT"/functions/ToolScripts/emuDeckCloudSync.sh
source "$EMUDECKGIT"/functions/ToolScripts/emuDeckRemotePlayWhatever.sh

View file

@ -2,19 +2,20 @@
createDesktopIcons(){
local sandbox=""
local desktop=$(xdg-user-dir DESKTOP)
if command -v apt-get >/dev/null; then
sandbox=" --no-sandbox"
fi
#We delete the old icons
rm -rf ~/Desktop/EmuDeckUninstall.desktop 2>/dev/null
rm -rf ~/Desktop/EmuDeckCHD.desktop 2>/dev/null
rm -rf ~/Desktop/EmuDeck.desktop 2>/dev/null
rm -rf ~/Desktop/EmuDeckSD.desktop 2>/dev/null
rm -rf ~/Desktop/EmuDeckBinUpdate.desktop 2>/dev/null
rm -rf ~/Desktop/EmuDeckApp.desktop 2>/dev/null
rm -rf ~/Desktop/EmuDeckAppImage.desktop 2>/dev/null
rm -rf ~/Desktop/EmuDeckAppImage.desktop 2>/dev/null
rm -rf "$desktop/EmuDeckUninstall.desktop" 2>/dev/null
rm -rf "$desktop/EmuDeckCHD.desktop" 2>/dev/null
rm -rf "$desktop/EmuDeck.desktop" 2>/dev/null
rm -rf "$desktop/EmuDeckSD.desktop" 2>/dev/null
rm -rf "$desktop/EmuDeckBinUpdate.desktop" 2>/dev/null
rm -rf "$desktop/EmuDeckApp.desktop" 2>/dev/null
rm -rf "$desktop/EmuDeckAppImage.desktop" 2>/dev/null
rm -rf "$desktop/EmuDeckAppImage.desktop" "2>/dev/null
#New EmuDeck icon, same place so people won't get confused
createDesktopShortcut "$desktop/EmuDeck.desktop" \

View file

@ -0,0 +1,62 @@
#!/bin/bash
generateGameLists() {
ROMS_DIR="$romsPath/snes"
# Initialize an empty array in JSON format
printf "["
first_system=true
for system_dir in "$ROMS_DIR"*; do
if [[ -d "$system_dir" && -f "$system_dir/metadata.txt" ]]; then
# Ignore directories named "ps3"
if [[ "$system_dir" == *"/ps3" ]]; then
continue
fi
file_count=$(find "$system_dir" -type f | wc -l)
if [[ "$file_count" -le 2 ]]; then
continue # Skip this system_dir if there are 2 or fewer files
fi
collection=$(grep 'collection:' "$system_dir/metadata.txt" | cut -d ':' -f 2- | awk '{$1=$1};1')
shortname=$(grep 'shortname:' "$system_dir/metadata.txt" | cut -d ':' -f 2- | awk '{$1=$1};1')
launcher=$(grep 'launch:' "$system_dir/metadata.txt" | cut -d ':' -f 2- | awk '{$1=$1};1')
extensions=$(grep 'extensions:' "$system_dir/metadata.txt" | cut -d ':' -f 2- | tr ',' ' ' | awk '{$1=$1};1')
if $first_system; then
first_system=false
else
printf ","
fi
# Start system object
printf '{ "title": "%s", "id": "%s", "launcher": "%s", "games": [' "$collection" "$shortname" "$launcher"
# Use jq to create the JSON objects for each game and print them directly
first_game=true
find "$system_dir" -type f | while read -r file_path; do
filename=$(basename "$file_path")
extension="${filename##*.}"
name="${filename%.*}"
if [[ "$extensions" =~ "$extension" ]]; then
if $first_game; then
first_game=false
else
printf ","
fi
jq -n --arg name "$name" --arg filename "$file_path" '{"name": $name, "filename": $filename}'
fi
done
# End games array and system object
printf "] }"
fi
done
# End of JSON array
printf "]"
}

View file

@ -423,6 +423,7 @@ fi
#Always install
BINUP_install
FlatpakUP_install
CHD_install
#