Initial commit
This commit is contained in:
commit
2e17001bd3
|
@ -0,0 +1 @@
|
||||||
|
synmpc
|
|
@ -0,0 +1,3 @@
|
||||||
|
# synmpc
|
||||||
|
|
||||||
|
Enques songs to MPD from Syndicate assertions. Uses the same `<xdg-open @uris [string ...]>` assertions as [xdg_open_ng](https://git.syndicate-lang.org/ehmry/xdg_open_ng).
|
|
@ -0,0 +1,12 @@
|
||||||
|
let ?root_ds = dataspace
|
||||||
|
<bind "syndicate" #x"" $root_ds>
|
||||||
|
|
||||||
|
<require-service <daemon synmpc>>
|
||||||
|
|
||||||
|
<daemon synmpc {
|
||||||
|
argv: ["/home/repo/syndicate/synmpc/src/synmpc" ""]
|
||||||
|
protocol: text/syndicate
|
||||||
|
clearEnv: #t
|
||||||
|
}>
|
||||||
|
|
||||||
|
? <service-object <daemon synmpc> ?cap> [ $cap [ <listen-on $root_ds> ] ]
|
|
@ -0,0 +1,25 @@
|
||||||
|
# SPDX-FileCopyrightText: ☭ 2022 Emery Hemingway
|
||||||
|
# SPDX-License-Identifier: Unlicense
|
||||||
|
|
||||||
|
import std/asyncdispatch
|
||||||
|
import preserves
|
||||||
|
import syndicate
|
||||||
|
import mpdclient
|
||||||
|
|
||||||
|
type
|
||||||
|
XdgOpen {.preservesRecord: "xdg-open".} = object
|
||||||
|
uris: seq[string]
|
||||||
|
ListenOn {.preservesRecord: "listen-on".} = ref object
|
||||||
|
dataspace: Preserve[Ref]
|
||||||
|
|
||||||
|
bootDataspace("main") do (root: Ref; turn: var Turn):
|
||||||
|
connectStdio(root, turn)
|
||||||
|
let mpd = newMPDClient()
|
||||||
|
|
||||||
|
onPublish(turn, root, ?ListenOn) do (a: Assertion):
|
||||||
|
stderr.writeLine "got listen-on ", a
|
||||||
|
let ds = unembed a
|
||||||
|
onMessage(turn, ds, ?XdgOpen) do (uris: seq[string]):
|
||||||
|
for uri in uris: mpd.add uri
|
||||||
|
|
||||||
|
runForever()
|
|
@ -0,0 +1,13 @@
|
||||||
|
# Package
|
||||||
|
|
||||||
|
version = "0.1.0"
|
||||||
|
author = "Emery Hemingway"
|
||||||
|
description = "Syndicate MPD client"
|
||||||
|
license = "Unlicense"
|
||||||
|
srcDir = "src"
|
||||||
|
bin = @["synmpc"]
|
||||||
|
|
||||||
|
|
||||||
|
# Dependencies
|
||||||
|
|
||||||
|
requires "nim >= 1.6.4", "syndicate >= 1.2.1", "mpdclient"
|
Loading…
Reference in New Issue