mirror of
https://github.com/Febbweiss/rclone_script.git
synced 2026-03-04 22:25:36 +00:00
Implemented function to build local save file filters
This commit is contained in:
13
emulator_settings.xml
Normal file
13
emulator_settings.xml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<emulators>
|
||||||
|
<emulator>
|
||||||
|
<name>ppsspp</name>
|
||||||
|
<saveFilePath>/opt/retropie/configs/psp/PSP/SAVEDATA</saveFilePath>
|
||||||
|
<saveStatePath>/opt/retropie/configs/psp/PSP/PPSSPP_STATE</saveStatePath>
|
||||||
|
<saveFileExtensions>
|
||||||
|
<ext>SYS</ext>
|
||||||
|
<ext>PNG</ext>
|
||||||
|
<ext>SFO</ext>
|
||||||
|
</saveFileExtensions>
|
||||||
|
</emulator>
|
||||||
|
</emulators>
|
||||||
@@ -14,6 +14,9 @@ config=~/scripts/rclone_script/rclone_script.ini
|
|||||||
source ${config}
|
source ${config}
|
||||||
logLevel=2
|
logLevel=2
|
||||||
|
|
||||||
|
# include emulator specific settings
|
||||||
|
emu_settings=~/scripts/rclone_script/emulator_settings.xml
|
||||||
|
|
||||||
|
|
||||||
# parameters
|
# parameters
|
||||||
direction="$1"
|
direction="$1"
|
||||||
@@ -139,6 +142,41 @@ function prepareFilter ()
|
|||||||
filter="${filter//\]/\\]}"
|
filter="${filter//\]/\\]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Builds a filter compatible with Find
|
||||||
|
function prepareLocalFilter ()
|
||||||
|
{
|
||||||
|
# Create an array of save file extensions
|
||||||
|
read -a exts <<< $(xmlstarlet sel -t -m "emulators/emulator[name='${emulator}']/saveFileExtensions" -v . "${emu_settings}")
|
||||||
|
|
||||||
|
# If any custom save file extensions are defined
|
||||||
|
if [ ${#exts[@]} -gt 0 ]
|
||||||
|
then
|
||||||
|
# Build the filter for the extensions
|
||||||
|
log 3 "Custom save extentions defined for emulator: ${emulator}"
|
||||||
|
localFilter="\( -iname '*.${exts[0]}'"
|
||||||
|
for ext in ${exts[@]:1}; do
|
||||||
|
localFilter="${localFilter} -o -iname '*.${ext}'"
|
||||||
|
done
|
||||||
|
localFilter="${localFilter} \)"
|
||||||
|
else
|
||||||
|
# Otherwise, default to "<ROM_name>.*"
|
||||||
|
localFilter="${romfilebase//\[/\\[}"
|
||||||
|
localFilter="${localFilter//\]/\\]}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
log 3 "Local save file filter: ${localFilter}"
|
||||||
|
}
|
||||||
|
|
||||||
|
function prepareRemoteFilter ()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function getSavePathForEmulator ()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
function getTypeOfRemote ()
|
function getTypeOfRemote ()
|
||||||
{
|
{
|
||||||
# list all remotes and their type
|
# list all remotes and their type
|
||||||
@@ -350,6 +388,7 @@ log 3 "romfileext: ${romfileext}"
|
|||||||
if [ "${direction}" == "up" ] && [ "${system}" != "kodi" ]
|
if [ "${direction}" == "up" ] && [ "${system}" != "kodi" ]
|
||||||
then
|
then
|
||||||
getROMFileName
|
getROMFileName
|
||||||
|
prepareLocalFilter
|
||||||
prepareFilter
|
prepareFilter
|
||||||
getTypeOfRemote
|
getTypeOfRemote
|
||||||
uploadSaves
|
uploadSaves
|
||||||
|
|||||||
Reference in New Issue
Block a user