From 2a1a3fe200e06dd9eade4b806829d8e5200fd7cd Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Thu, 18 May 2023 12:41:37 +0100 Subject: [PATCH] Adjust to Syndicate-nim changes --- mpv.config-example.pr | 32 ++++++++++++++++++-------------- src/json_translator.nim | 2 +- src/msg.nim | 10 +++++----- syndicate_utils.nimble | 4 ++-- 4 files changed, 26 insertions(+), 22 deletions(-) diff --git a/mpv.config-example.pr b/mpv.config-example.pr index e11ed82..e19f5c7 100644 --- a/mpv.config-example.pr +++ b/mpv.config-example.pr @@ -1,4 +1,5 @@ let ?socketPath = "/run/user/1000/mpv.sock" + let ?mpvSpace = dataspace $mpvSpace [ ; announce the dataspace when the translator is connected @@ -8,16 +9,17 @@ $mpvSpace [ ; translate to an MPV command ?? [ + $log ! }> ! ] + ; log anything that comes back from MPV + ; ?? [ $log ! ] + ; clear the playlist on idle so it doesn't grow indefinitely ?? [ ! ] - - ; log anything that comes back from MPV - ?? [ $log ! ] ] ; need the translator and the translator needs the daemon @@ -32,17 +34,7 @@ $mpvSpace [ ] ; assert and retract the daemon as the daemon is built (this is a testing artifact) -? [ - +? [ ] + +; start mpv regardless + diff --git a/src/json_translator.nim b/src/json_translator.nim index b8a97c2..3d2368c 100644 --- a/src/json_translator.nim +++ b/src/json_translator.nim @@ -1,7 +1,7 @@ # SPDX-FileCopyrightText: ☭ Emery Hemingway # SPDX-License-Identifier: Unlicense -import std/[asyncdispatch, json, os, osproc, strutils] +import std/[json, os, osproc] import preserves # , preserves/jsonhooks, import syndicate diff --git a/src/msg.nim b/src/msg.nim index 21524e1..b7bd7c4 100644 --- a/src/msg.nim +++ b/src/msg.nim @@ -4,15 +4,15 @@ import std/[asyncdispatch, sequtils, os] import preserves, syndicate, syndicate/capabilities -proc unixSocketPath: string = - result = getEnv("SYNDICATE_SOCK") - if result == "": - result = getEnv("XDG_RUNTIME_DIR", "/run/user/1000") / "dataspace" +proc unixSocketPath: Unix = + result.path = getEnv("SYNDICATE_SOCK") + if result.path == "": + result.path = getEnv("XDG_RUNTIME_DIR", "/run/user/1000") / "dataspace" proc main = let label = getAppFilename().extractFilename bootDataspace(label) do (root: Ref; turn: var Turn): - connectUnix(turn, unixSocketPath(), capabilities.mint()) do (turn: var Turn; ds: Ref): + connect(turn, unixSocketPath(), capabilities.mint().toPreserve(Ref)) do (turn: var Turn; ds: Ref): message(turn, ds, initRecord(label, map(commandLineParams(), parsePreserves))) for i in 0..3: poll(20) diff --git a/syndicate_utils.nimble b/syndicate_utils.nimble index 01d8028..63a50f1 100644 --- a/syndicate_utils.nimble +++ b/syndicate_utils.nimble @@ -1,6 +1,6 @@ # Package -version = "20230517" +version = "20230518" author = "Emery Hemingway" description = "Utilites for Syndicated Actors and Synit" license = "unlicense" @@ -10,4 +10,4 @@ bin = @["json_socket_translator", "json_translator", "msg"] # Dependencies -requires "nim >= 1.6.6", "syndicate >= 20230517" +requires "nim >= 1.6.6", "syndicate >= 20230518"