CLOUDSYNC: added arguments - fix2

This commit is contained in:
Xargon 2022-05-21 22:20:18 +09:00
parent 9a9c901d6e
commit 3688d5fe25

View file

@ -5,6 +5,8 @@
import os import os
import shutil import shutil
import configparser import configparser
import sys
import getopt
retrodeck_folder = os.path.expanduser('~')+"/retrodeck" retrodeck_folder = os.path.expanduser('~')+"/retrodeck"
@ -41,6 +43,11 @@ 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)
# parse the args and see if we want to upload or download # parse the args and see if we want to upload or download
try:
opts, args = getopt.getopt("h:u:d:",["--upload","--download"])
except getopt.GetoptError:
print ("Unknown argument, run with -h or --help for a list of supported arguments.")
sys.exit(2)
for opt, arg in opts: for opt, arg in opts:
if opt == ("-h", "--help"): if opt == ("-h", "--help"):
print (f"Usage:\n\ print (f"Usage:\n\
@ -48,10 +55,8 @@ flatpak run [FLATPAK-RUN-OPTION] net.retrodeck-retrodeck [ARGUMENTS]\n\
\n\ \n\
Arguments:\n\ Arguments:\n\
-h, --help Print this help\n\ -h, --help Print this help\n\
--reset Starts the initial RetroDECK installer (backup your data first!)\n\ -u, --upload Upload your saves and screenshots on the cloud\n\
--reset-ra Resets RetroArch's config to the default values\n\ -d ,--download Download your saves and screenshots from the cloud\n\
--reset-sa Reset standalone emulator configs to the default values\n\
--reset-tools Recreate the tools section\n\
\n\ \n\
https://retrodeck.net") https://retrodeck.net")
sys.exit() sys.exit()
@ -62,7 +67,7 @@ https://retrodeck.net")
#os.system(f"rclone sync -P {retrodeck_folder}/roms/ \"{sync_remote}\":\"{sync_path}/savestates\" --include *.state* --log-file {retrodeck_folder}/.logs/cloud-sync.log") #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 # 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'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.\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"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') 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')
@ -73,6 +78,8 @@ https://retrodeck.net")
#os.system(f"rclone sync -P \"{sync_remote}\":\"{sync_path}/savestates\" {retrodeck_folder}/roms/ --include *.state* --log-file {retrodeck_folder}/.logs/cloud-sync.log") #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 # 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'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.\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"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') 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')
#TODO: remove gamedata