CLOUDSYNC: added arguments

This commit is contained in:
Xargon 2022-05-21 22:08:38 +09:00
parent e32c59442f
commit e7cc303abd
2 changed files with 38 additions and 6 deletions

View file

@ -1410,7 +1410,7 @@
<name>tools</name> <name>tools</name>
<fullname>RetroDECK Tools</fullname> <fullname>RetroDECK Tools</fullname>
<path>/var/config/retrodeck/tools</path> <path>/var/config/retrodeck/tools</path>
<extension>.sh .SH .py .PY</extension> <extension>.sh .SH</extension>
<command>bash %ROM%</command> <command>bash %ROM%</command>
<platform>tools</platform> <platform>tools</platform>
<theme>tools</theme> <theme>tools</theme>

View file

@ -1,5 +1,7 @@
#!/usr/bin/python3 #!/usr/bin/python3
# Original Script by https://gist.github.com/nullstalgia
import os import os
import shutil import shutil
import configparser import configparser
@ -38,9 +40,39 @@ if not os.path.exists(rclone_config_path):
if not os.path.exists(rules_config_path): if not os.path.exists(rules_config_path):
shutil.copyfile(rules_config_def_path, rules_config_path) shutil.copyfile(rules_config_def_path, rules_config_path)
# sync states # parse the args and see if we want to upload or download
#print("Syncing savestates") for opt, arg in opts:
#os.system(f"rclone bisync -v --workdir /var/cache/rclone/bisync {retrodeck_folder}/roms/ \"{sync_remote}\":\"{sync_path}/savestates\" --include *.state* --log-file {retrodeck_folder}/.logs/cloud-sync.log") if opt == ("-h", "--help"):
print (f "Usage:\n\
flatpak run [FLATPAK-RUN-OPTION] net.retrodeck-retrodeck [ARGUMENTS]\n\
\n\
Arguments:\n\
-h, --help Print this help\n\
--reset Starts the initial RetroDECK installer (backup your data first!)\n\
--reset-ra Resets RetroArch's config to the default values\n\
--reset-sa Reset standalone emulator configs to the default values\n\
--reset-tools Recreate the tools section\n\
\n\
https://retrodeck.net")
sys.exit()
elif opt in ("-u", "--upload"):
print("Syncing saves, screenshots, and gamedata") # upload states
os.system(f"rclone bisync -v --workdir /var/cache/rclone/bisync {retrodeck_folder}/roms/ \"{sync_remote}\":\"{sync_path}/\" --filters-file {rules_config_path} --log-file {retrodeck_folder}/.logs/cloud-sync.log") #print("Syncing savestates")
#os.system(f"rclone sync -P {retrodeck_folder}/roms/ \"{sync_remote}\":\"{sync_path}/savestates\" --include *.state* --log-file {retrodeck_folder}/.logs/cloud-sync.log")
# upload saves
os.system(f'zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --title "RetroDECK" --text=Uploading saves, screenshots, and gamedata.\n\nPress ok to continue and wait for the completion message.')
os.system(f"rclone sync -P {retrodeck_folder}/roms/ \"{sync_remote}\":\"{sync_path}/\" --filter-from {rules_config_path} --log-file {retrodeck_folder}/.logs/cloud-sync.log")
os.system(f'zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --title "RetroDECK" --text=Done!\n\nYou can check the logfiles in {retrodeck_folder}/.logs/cloud-sync.log')
elif opt in ("-d", "--download"):
# download states
#print("Syncing savestates")
#os.system(f"rclone sync -P \"{sync_remote}\":\"{sync_path}/savestates\" {retrodeck_folder}/roms/ --include *.state* --log-file {retrodeck_folder}/.logs/cloud-sync.log")
# download saves
os.system(f'zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --title "RetroDECK" --text=Downloading saves, screenshots, and gamedata.\n\nPress ok to continue and wait for the completion message.')
os.system(f"rclone sync -P \"{sync_remote}\":\"{sync_path}/\" {retrodeck_folder}/roms/ --filter-from {rules_config_path} --log-file {retrodeck_folder}/.logs/cloud-sync.log")
os.system(f'zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --title "RetroDECK" --text=Done!\n\nYou can check the logfiles in {retrodeck_folder}/.logs/cloud-sync.log')