mirror of
https://github.com/dragoonDorise/EmuDeck.git
synced 2024-06-02 19:47:51 -04:00
Compare commits
17 commits
ed5eb65bbe
...
92421ea669
Author | SHA1 | Date | |
---|---|---|---|
92421ea669 | |||
73f38af040 | |||
b3af3ae4d4 | |||
b027aaafe3 | |||
cc58433b05 | |||
d9d3a826e4 | |||
e78606b819 | |||
3085288717 | |||
e79b1aff03 | |||
7c61546295 | |||
7810440101 | |||
007275f6c7 | |||
48e07bfc1f | |||
c49a0eb284 | |||
69a5c9a98e | |||
acb1e0da95 | |||
e6ba4aad8d |
|
@ -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"
|
||||
}
|
||||
|
|
19
functions/ToolScripts/emuDeckFlatpakUP.sh
Normal file
19
functions/ToolScripts/emuDeckFlatpakUP.sh
Normal 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"
|
||||
}
|
140
functions/ToolScripts/emuDeckM3U.sh
Normal file
140
functions/ToolScripts/emuDeckM3U.sh
Normal 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
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -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" \
|
||||
|
|
62
functions/generateGameLists.sh
Normal file
62
functions/generateGameLists.sh
Normal 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 "]"
|
||||
}
|
Loading…
Reference in a new issue