mpvd

Control mpv using the MPD protocol

git clone https://git.8pit.net/mpvd.git

 1#!/usr/bin/env hy
 2
 3(import sys socket signal)
 4
 5(when (< (len sys.argv) 2)
 6  (print (.format "USAGE: {} HOST PORT"
 7           (get sys.argv 0))
 8         :file sys.stderr)
 9  (sys.exit 1))
10
11(signal.signal signal.SIGALRM
12  (fn [signal frame] (sys.exit 1)))
13(signal.alarm 30)
14
15(setv addr (, (get sys.argv 1) (get sys.argv 2)))
16(while True
17  (try
18    (.close (socket.create_connection addr))
19    (except [OSError] (continue))
20    (else (sys.exit 0))))