Skip to content

Commit

Permalink
Add support for MVR-xchange MVR_COMMIT
Browse files Browse the repository at this point in the history
  • Loading branch information
vanous committed Dec 27, 2023
1 parent 58633b6 commit 0ae3c0f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
27 changes: 16 additions & 11 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1210,26 +1210,31 @@ def createMVR_Commits(self, commits, station_uuid):
clients = bpy.context.window_manager.dmx.mvr_xchange.mvr_xchange_clients
for client in clients:
if client.station_uuid == station_uuid:
client.commits.clear()
#client.commits.clear()

for commit in commits:

skip = False
if "FileName" in commit:
filename = commit["FileName"]
else:
filename = commit["Comment"]
if not len(filename):
filename = commit["FileUUID"]

now = int(datetime.now().timestamp())
client.last_seen = now
new_commit = client.commits.add()
new_commit.station_uuid = station_uuid
new_commit.comment = commit["Comment"]
new_commit.commit_uuid = commit["FileUUID"]
new_commit.file_size = commit["FileSize"]
new_commit.file_name = filename
new_commit.timestamp = now
for existing_commit in client.commits:
if existing_commit.commit_uuid == commit["FileUUID"]:
skip = True
continue
if not skip:
now = int(datetime.now().timestamp())
client.last_seen = now
new_commit = client.commits.add()
new_commit.station_uuid = station_uuid
new_commit.comment = commit["Comment"]
new_commit.commit_uuid = commit["FileUUID"]
new_commit.file_size = commit["FileSize"]
new_commit.file_name = filename
new_commit.timestamp = now

def fetched_mvr_downloaded_file(self, commit):
clients = bpy.context.window_manager.dmx.mvr_xchange.mvr_xchange_clients
Expand Down
Empty file added assets/mvrs/.gitkeep
Empty file.
2 changes: 2 additions & 0 deletions mvrx_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ def callback(data):
uuid = data["StationUUID"]
if "Files" in data:
DMX_MVR_X_Protocol._instance._dmx.createMVR_Commits(data["Files"], uuid)
if "FileUUID" in data:
DMX_MVR_X_Protocol._instance._dmx.createMVR_Commits([data], uuid)

if "file_downloaded" in data:
DMX_MVR_X_Protocol._instance._dmx.fetched_mvr_downloaded_file(data["file_downloaded"])
Expand Down

0 comments on commit 0ae3c0f

Please sign in to comment.