Toggle cloud saving feature
-
Hi.
What would be the easiest way to toggle off and on the cloud saving feature with my Pi 4?
I lost internet the other day and was locked out of being able to play anything.
I have a Ports folder in Emulation Station, so perhaps I could place a simple executable script in there.
Here are the three files that are used for cloud saving.
/home/pi/scripts/rclone.sh
#!/bin/bash # syncs files via rclone # usage: rclone.sh "up" "system" "/path/to/rom.ext" ########################## # start of configuration # ########################## # path to RCLONE rclonePath="/home/pi/rclone-v1.56.0-linux-arm/rclone" # local base directory for your saves localPath="/home/pi/RetroPie/saves" # remote directory for your saves, has to be configured via "rclone config" first remotePath="remote:" # set path to log file logfile="/home/pi/log.txt" ######################## # end of configuration # ######################## # get parameters direction="$1" system="" rom="$3" # get name of ROM without extension romfilepath="${rom%/*}" romfilename="${rom##*/}" romfilebase="${romfilename%%.*}" romfileext="${romfilename#*.}" # escape special characters in ROM name filter="${romfilebase//\[/\\[}" filter="${filter//\]/\\]}" # begin entry in logfile echo "---------------" >> ${logfile} # check if local path exists, create if necessary if [ ! -d "${localPath}/${system}" ] then echo "$(date +%FT%T%z): creating local path \"${localPath}/${system}\"" >> ${logfile} mkdir "${localPath}/${system}" fi # prepare command for RCLONE if [ "$direction" == "up" ] then # upload to remote cmd="$rclonePath copy ${localPath}/${system} $remotePath/${system} --include \"${filter}.*\" --log-level \"INFO\" --log-file ${logfile}" elif [ "$direction" == "down" ] then # download from remote cmd="$rclonePath copy $remotePath/${system} $localPath/${system} --include \"${filter}.*\" --log-level \"INFO\" --log-file ${logfile}" else # error echo "$(date +%FT%T%z): error with first parameter --> \"$1\" is not allowed" >> ${logfile} exit 1 fi # start RCLONE to sync echo "$(date +%FT%T%z): started sync for ${rom}" >> ${logfile} echo "$(date +%FT%T%z): starting ${direction}load..." >> ${logfile} echo "$(date +%FT%T%z): command = $cmd" >> ${logfile} eval $cmd # end entry in logfile echo "$(date +%FT%T%z): finished sync for ${rom}" >> ${logfile} exit 0
/opt/retropie/configs/all/runcommand-onstart.sh
#!/bin/bash # call script to download via RCLONE with direction, system and ROM file /home/pi/scripts/rclone.sh "down" "$1" "$3"
/opt/retropie/configs/all/runcommand-onend.sh
#!/bin/bash # call script to upload via RCLONE with direction, system and ROM file /home/pi/scripts/rclone.sh "up" "$1" "$3"
-
I live in a very remote area so my internet tends to drop far too often.
Really hoping someone can help me figure a way to turn off cloud saving when my internet goes down.
Thanks ahead.
-
Why not just comment out the entries in
runcommand-onstart.sh
andruncommand-onend.sh
, so the script doesn't run ? -
Okay.
Can you give me the format command for this so I can write a simple script?
I need to copy a file and then change it's name in the same folder, correct?
So for example:
With internet
online-onstart.sh would change to runcommand-onstart.shonline-onend.sh would change to runcommand-onend.sh
Without internet
offline-onstart.sh would change to runcommand-onstart.shoffline-onend.sh would change to runcommand-onend.sh
Does that make sense?
I would like something from the Ports folder in Emulation Station so I can click on either Online or Offline Status.
Sorry, I'm so horrible at understanding Linux.
-
Here's an example, assuming you have the
online/offline-onstart/onend
scripts created and saved in the/opt/retropie/configs/all
folder.- Create a script that will toggle the online saving features, called
Enable Online.sh
:
#!/usr/bin/env bash cp /opt/retropie/configs/all/online-onstart.sh /opt/retropie/configs/all/runcommand-onstart.sh cp /opt/retropie/configs/all/online-onend.sh /opt/retropie/configs/all/runcommand-onend.sh
- Create a similar script to disable the online saving, called
Disable Online.sh
#!/usr/bin/env bash cp /opt/retropie/configs/all/offline-onstart.sh /opt/retropie/configs/all/runcommand-onstart.sh cp /opt/retropie/configs/all/offline-onend.sh /opt/retropie/configs/all/runcommand-onend.sh
- Copy the 2 scripts in
$HOME/RetroPie/retropiemenu
and then restart EmulationStation. There should be 2 new entries under the RetroPie system with for the 2 scripts, which you can execute when needed (i.e. for online play or offline play).
The names of the scripts doesn't matter as long as you remember their purpose, you can name them as you like.
- Create a script that will toggle the online saving features, called
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.