summaryrefslogtreecommitdiff
path: root/reading-heap.scm
diff options
context:
space:
mode:
authorChristopher R. Nelson <christopher.nelson@languidnights.com>2023-06-18 20:08:03 -0400
committerChristopher R. Nelson <christopher.nelson@languidnights.com>2023-06-18 20:08:03 -0400
commitbe36a5111c30af9d4dcd6a74c5fa1c43763e598e (patch)
tree9b261f95d768f8c1c94674d166010f51c61716a0 /reading-heap.scm
Initial Import
Diffstat (limited to 'reading-heap.scm')
-rwxr-xr-xreading-heap.scm62
1 files changed, 62 insertions, 0 deletions
diff --git a/reading-heap.scm b/reading-heap.scm
new file mode 100755
index 0000000..6d821b2
--- /dev/null
+++ b/reading-heap.scm
@@ -0,0 +1,62 @@
+#!/usr/bin/env guile
+!#
+(define-module (reading-heap))
+
+(use-modules (srfi srfi-1)
+ (config)
+ (config api)
+ (config licenses)
+ (config parser sexp)
+ (reading-heap heap)
+ (reading-heap media)
+ (reading-heap zmq))
+
+(define config
+ (configuration
+ (name 'rh-server)
+ (synopsis "client for reading-heap")
+ (keywords
+ (list
+ (setting
+ (name 'media-library)
+ (synopsis "media library location")
+ (default (string-append (or (getenv "XDG_DATA_HOME")
+ (string-append (getenv "HOME")
+ "/.local/share"))
+ "/media-library")))
+ (switch
+ (name 'write)
+ (synopsis "write the default config")
+ (default #f)
+ (test boolean?)
+ (character #f))
+ (switch
+ (name 'serve)
+ (synopsis "server the media heap")
+ (default #f)
+ (test boolean?)
+ (character #t))
+ ))
+ (directory (list (in-home ".reading-heap/")
+ (path (given
+ (string-append (or (getenv "XDG_CONFIG_HOME")
+ (string-append (getenv "HOME")
+ "/.config"))
+ "/reading-heap/"))
+ (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))))
+
+(main (command-line))