Created
May 21, 2022 06:49
-
-
Save nullstalgia/30f5b03436bd516ecd2dcb52873e45c6 to your computer and use it in GitHub Desktop.
RetroDECK Upload/Download RClone scripts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Exclude mac folders and files | |
- .Trashes/** | |
- .Spotlight-V100/** | |
- *.DS_Store* | |
# Excluding states, as those are done by another command | |
- savestates/** | |
- *.state* | |
+ README.txt | |
# Main dir is /storage/roms | |
# COMMONS | |
+ *.sav | |
+ *.srm | |
+ *.auto | |
# LZDOOM | |
+ *.zds | |
# PPSSPP | |
+ gamedata/ppsspp/PSP/** | |
# MS-DOS | |
+ pc/*.zip | |
# POKEMINI | |
+ *.eep | |
# SCREENSHOTS | |
+ screenshots/** | |
# VARIOUS | |
+ *.ec | |
+ *.nv | |
+ *.hi | |
+ *.hs | |
+ *.fs | |
# exclude everything else | |
- bios/** | |
- * |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# CLOUD_SYNC_PATH is where files on the remote go. For S3 this includes the bucket name. | |
CLOUD_SYNC_PATH="/351backup/" | |
# CLOUD_SYNC_REMOTE must match the remote name in rclone.conf | |
CLOUD_SYNC_REMOTE="351remote" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
import os | |
import shutil | |
import configparser | |
retrodeck_folder = "/home/deck/retrodeck" | |
rclone_executable = "/home/deck/retrodeck/rclone/rclone" | |
sync_config_path=f"{retrodeck_folder}/rclone/cloud-sync.conf" | |
sync_config_def_path=f"{retrodeck_folder}/rclone/cloud-sync.conf.default" | |
rclone_config_path=f"{retrodeck_folder}/rclone/rclone.conf" | |
rclone_config_def_path=f"{retrodeck_folder}/rclone/rclone.conf.default" | |
rules_config_path=f"{retrodeck_folder}/rclone/cloud-sync-rules.conf" | |
rules_config_def_path=f"{retrodeck_folder}/rclone/cloud-sync-rules.conf.default" | |
# make sure we have some configs | |
if not os.path.exists(sync_config_path): | |
shutil.copyfile(sync_config_def_path, sync_config_path) | |
# https://stackoverflow.com/questions/2819696/parsing-properties-file-in-python/25493615#25493615 | |
with open(sync_config_path, 'r') as f: | |
config_string = '[dummy_section]\n' + f.read() | |
config = configparser.ConfigParser() | |
config.read_string(config_string) | |
sync_remote = config['dummy_section']['CLOUD_SYNC_REMOTE'].replace('"', "") | |
sync_path = config['dummy_section']['CLOUD_SYNC_PATH'].replace('"', "").rstrip("/") | |
if not os.path.exists(rclone_config_path): | |
#shutil.copyfile(rclone_config_def_path, rclone_config_path) | |
raise(FileNotFoundError) | |
if not os.path.exists(rules_config_path): | |
shutil.copyfile(rules_config_def_path, rules_config_path) | |
# sync states | |
print("Syncing savestates") | |
os.system(f"{rclone_executable} sync -P \"{sync_remote}\":\"{sync_path}/savestates\" {retrodeck_folder}/roms/ --include *.state* --log-file /tmp/cloud-sync.log") | |
print("Syncing saves, screenshots, and gamedata") | |
os.system(f"{rclone_executable} sync -P \"{sync_remote}\":\"{sync_path}/\" {retrodeck_folder}/roms/ --filter-from {rules_config_path} --log-file /tmp/cloud-sync.log") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
import os | |
import shutil | |
import configparser | |
retrodeck_folder = "/home/deck/retrodeck" | |
rclone_executable = "/home/deck/retrodeck/rclone/rclone" | |
sync_config_path=f"{retrodeck_folder}/rclone/cloud-sync.conf" | |
sync_config_def_path=f"{retrodeck_folder}/rclone/cloud-sync.conf.default" | |
rclone_config_path=f"{retrodeck_folder}/rclone/rclone.conf" | |
rclone_config_def_path=f"{retrodeck_folder}/rclone/rclone.conf.default" | |
rules_config_path=f"{retrodeck_folder}/rclone/cloud-sync-rules.conf" | |
rules_config_def_path=f"{retrodeck_folder}/rclone/cloud-sync-rules.conf.default" | |
# make sure we have some configs | |
if not os.path.exists(sync_config_path): | |
shutil.copyfile(sync_config_def_path, sync_config_path) | |
# https://stackoverflow.com/questions/2819696/parsing-properties-file-in-python/25493615#25493615 | |
with open(sync_config_path, 'r') as f: | |
config_string = '[dummy_section]\n' + f.read() | |
config = configparser.ConfigParser() | |
config.read_string(config_string) | |
sync_remote = config['dummy_section']['CLOUD_SYNC_REMOTE'].replace('"', "") | |
sync_path = config['dummy_section']['CLOUD_SYNC_PATH'].replace('"', "").rstrip("/") | |
if not os.path.exists(rclone_config_path): | |
#shutil.copyfile(rclone_config_def_path, rclone_config_path) | |
raise(FileNotFoundError) | |
if not os.path.exists(rules_config_path): | |
shutil.copyfile(rules_config_def_path, rules_config_path) | |
# sync states | |
print("Syncing savestates") | |
os.system(f"{rclone_executable} sync -P {retrodeck_folder}/roms/ \"{sync_remote}\":\"{sync_path}/savestates\" --include *.state* --log-file /tmp/cloud-sync.log") | |
print("Syncing saves, screenshots, and gamedata") | |
os.system(f"{rclone_executable} sync -P {retrodeck_folder}/roms/ \"{sync_remote}\":\"{sync_path}/\" --filter-from {rules_config_path} --log-file /tmp/cloud-sync.log") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment