Adjust to Syndicate-nim changes
This commit is contained in:
parent
8c322d1efd
commit
2a1a3fe200
|
@ -1,4 +1,5 @@
|
||||||
let ?socketPath = "/run/user/1000/mpv.sock"
|
let ?socketPath = "/run/user/1000/mpv.sock"
|
||||||
|
|
||||||
let ?mpvSpace = dataspace
|
let ?mpvSpace = dataspace
|
||||||
$mpvSpace [
|
$mpvSpace [
|
||||||
; announce the dataspace when the translator is connected
|
; announce the dataspace when the translator is connected
|
||||||
|
@ -8,16 +9,17 @@ $mpvSpace [
|
||||||
|
|
||||||
; translate <play-file …> to an MPV command
|
; translate <play-file …> to an MPV command
|
||||||
?? <play-file ?file> [
|
?? <play-file ?file> [
|
||||||
|
$log ! <log "-" { line: <play-file $file> }>
|
||||||
! <send-json { "command": ["loadfile" $file "append-play"] }>
|
! <send-json { "command": ["loadfile" $file "append-play"] }>
|
||||||
]
|
]
|
||||||
|
|
||||||
|
; log anything that comes back from MPV
|
||||||
|
; ?? <recv-json ?js> [ $log ! <log "-" { mpv: $js }> ]
|
||||||
|
|
||||||
; clear the playlist on idle so it doesn't grow indefinitely
|
; clear the playlist on idle so it doesn't grow indefinitely
|
||||||
?? <recv-json {"event": "idle"}> [
|
?? <recv-json {"event": "idle"}> [
|
||||||
! <send-json { "command": ["playlist-clear"] }>
|
! <send-json { "command": ["playlist-clear"] }>
|
||||||
]
|
]
|
||||||
|
|
||||||
; log anything that comes back from MPV
|
|
||||||
?? <recv-json ?js> [ $log ! <log "-" { mpv: $js }> ]
|
|
||||||
]
|
]
|
||||||
|
|
||||||
; need the translator and the translator needs the daemon
|
; 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)
|
; assert and retract the daemon as the daemon is built (this is a testing artifact)
|
||||||
? <built "json_socket_translator" ?path ?sum> [
|
? <built json_socket_translator ?path ?sum> [
|
||||||
<daemon mpv-server {
|
|
||||||
argv: [
|
|
||||||
"/run/current-system/sw/bin/mpv"
|
|
||||||
"--really-quiet"
|
|
||||||
"--idle=yes"
|
|
||||||
"--no-audio-display"
|
|
||||||
"--input-ipc-server=/run/user/1000/mpv.sock"
|
|
||||||
]
|
|
||||||
protocol: none
|
|
||||||
}>
|
|
||||||
|
|
||||||
<daemon mpv-translator {
|
<daemon mpv-translator {
|
||||||
argv: [$path]
|
argv: [$path]
|
||||||
|
@ -50,3 +42,15 @@ $mpvSpace [
|
||||||
env: {BUILD_SUM: $sum}
|
env: {BUILD_SUM: $sum}
|
||||||
}>
|
}>
|
||||||
]
|
]
|
||||||
|
|
||||||
|
; start mpv regardless
|
||||||
|
<daemon mpv-server {
|
||||||
|
argv: [
|
||||||
|
"/run/current-system/sw/bin/mpv"
|
||||||
|
"--really-quiet"
|
||||||
|
"--idle=yes"
|
||||||
|
"--no-audio-display"
|
||||||
|
"--input-ipc-server=/run/user/1000/mpv.sock"
|
||||||
|
]
|
||||||
|
protocol: none
|
||||||
|
}>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# SPDX-FileCopyrightText: ☭ Emery Hemingway
|
# SPDX-FileCopyrightText: ☭ Emery Hemingway
|
||||||
# SPDX-License-Identifier: Unlicense
|
# SPDX-License-Identifier: Unlicense
|
||||||
|
|
||||||
import std/[asyncdispatch, json, os, osproc, strutils]
|
import std/[json, os, osproc]
|
||||||
import preserves # , preserves/jsonhooks,
|
import preserves # , preserves/jsonhooks,
|
||||||
import syndicate
|
import syndicate
|
||||||
|
|
||||||
|
|
10
src/msg.nim
10
src/msg.nim
|
@ -4,15 +4,15 @@
|
||||||
import std/[asyncdispatch, sequtils, os]
|
import std/[asyncdispatch, sequtils, os]
|
||||||
import preserves, syndicate, syndicate/capabilities
|
import preserves, syndicate, syndicate/capabilities
|
||||||
|
|
||||||
proc unixSocketPath: string =
|
proc unixSocketPath: Unix =
|
||||||
result = getEnv("SYNDICATE_SOCK")
|
result.path = getEnv("SYNDICATE_SOCK")
|
||||||
if result == "":
|
if result.path == "":
|
||||||
result = getEnv("XDG_RUNTIME_DIR", "/run/user/1000") / "dataspace"
|
result.path = getEnv("XDG_RUNTIME_DIR", "/run/user/1000") / "dataspace"
|
||||||
|
|
||||||
proc main =
|
proc main =
|
||||||
let label = getAppFilename().extractFilename
|
let label = getAppFilename().extractFilename
|
||||||
bootDataspace(label) do (root: Ref; turn: var Turn):
|
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)))
|
message(turn, ds, initRecord(label, map(commandLineParams(), parsePreserves)))
|
||||||
|
|
||||||
for i in 0..3: poll(20)
|
for i in 0..3: poll(20)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Package
|
# Package
|
||||||
|
|
||||||
version = "20230517"
|
version = "20230518"
|
||||||
author = "Emery Hemingway"
|
author = "Emery Hemingway"
|
||||||
description = "Utilites for Syndicated Actors and Synit"
|
description = "Utilites for Syndicated Actors and Synit"
|
||||||
license = "unlicense"
|
license = "unlicense"
|
||||||
|
@ -10,4 +10,4 @@ bin = @["json_socket_translator", "json_translator", "msg"]
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
|
|
||||||
requires "nim >= 1.6.6", "syndicate >= 20230517"
|
requires "nim >= 1.6.6", "syndicate >= 20230518"
|
||||||
|
|
Loading…
Reference in New Issue