From 53dae7f8be8eed5f2a2608fb2aa6332e7fddaa60 Mon Sep 17 00:00:00 2001 From: "Christopher R. Nelson" Date: Sun, 18 Jun 2023 20:51:45 -0400 Subject: feat: improve usage of config files --- reading-heap.scm | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'reading-heap.scm') diff --git a/reading-heap.scm b/reading-heap.scm index 6d821b2..846cc51 100755 --- a/reading-heap.scm +++ b/reading-heap.scm @@ -24,6 +24,12 @@ (string-append (getenv "HOME") "/.local/share")) "/media-library"))) + (setting + (name 'service-socket) + (synopsis "socket for communication with the service") + (default (string-append "ipc://" (or (getenv "XDG_RUNTIME_DIR") + "/tmp") + "/reading-heap.sock"))) (switch (name 'write) (synopsis "write the default config") @@ -46,17 +52,15 @@ (eager? #t)))) (parser sexp-parser))) -(define-public media (filetree->media-list "/home/christopher/src/reading-heap/tests")) -(define-public priorities (map media-priority media)) -(define-public heap (fold heap-insert 'E priorities media)) - -;; (rh-receive heap) - (define (main cmd-line) (let ((options (getopt-config-auto cmd-line config))) (when (option-ref options 'write) (options-write options)) (when (option-ref options 'serve) - (rh-receive heap)))) + (let* ((media (filetree->media-list (option-ref options 'media-library))) + (priorities (map media-priority media)) + (heap (fold heap-insert 'E priorities media))) + (server-setup (option-ref options 'service-socket)) + (rh-receive heap))))) (main (command-line)) -- cgit v1.2.3