adding untracked files
This commit is contained in:
19
controller/state/__init__.py
Normal file
19
controller/state/__init__.py
Normal file
@@ -0,0 +1,19 @@
|
||||
|
||||
|
||||
def sync():
|
||||
server = Server(API_BASE_URL, CONTROLLER_ID)
|
||||
local = File(STATE_FILE)
|
||||
server_state = server.get_state()
|
||||
|
||||
if local.present():
|
||||
local.load()
|
||||
else:
|
||||
local.data = server_state
|
||||
local.save()
|
||||
|
||||
local_state = local.data
|
||||
|
||||
changer = Changer(local_state, remote_state)
|
||||
current_state = changer.process_change()
|
||||
|
||||
server.post_state(current_state)
|
||||
Reference in New Issue
Block a user