-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpersistence.py
40 lines (28 loc) · 883 Bytes
/
persistence.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import json
def save_drives(drives):
with open('drives.json', 'w') as file:
json.dump(drives, file)
def load_drives():
try:
with open('drives.json', 'r') as file:
return json.load(file)
except FileNotFoundError:
return []
def save_jobs(jobs):
with open('jobs.json', 'w') as file:
json.dump(jobs, file)
def load_jobs():
try:
with open('jobs.json', 'r') as file:
return json.load(file)
except FileNotFoundError:
return []
def save_rclone_config(rcloneConfig):
with open('rclone_config.json', 'w') as file:
json.dump(rcloneConfig, file)
def load_rclone_config():
try:
with open('rclone_config.json', 'r') as file:
return json.load(file)
except FileNotFoundError:
return {'rclone_path': ''}