aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--[-rwxr-xr-x]reading-heap.scm74
-rwxr-xr-xscripts/rh-client.in (renamed from scripts/rh-client.scm.in)0
-rwxr-xr-xscripts/rh-server.in72
-rw-r--r--tests/sample.json5
5 files changed, 73 insertions, 79 deletions
diff --git a/.gitignore b/.gitignore
index 0a123e7..ba1d131 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
+# hall-added files
*.eps
*.go
*.log
diff --git a/reading-heap.scm b/reading-heap.scm
index a7e3044..e69de29 100755..100644
--- a/reading-heap.scm
+++ b/reading-heap.scm
@@ -1,74 +0,0 @@
-#!/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"))
- (character #f))
- (setting
- (name 'service-socket)
- (synopsis "socket for communication with the service")
- (default (string-append "ipc://" (or (getenv "XDG_RUNTIME_DIR")
- "/tmp")
- "/reading-heap.sock"))
- (character #f))
- (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)
- (copyright '(2023))
- (version "0.1")
- (license agpl3+)
- (author "Christopher R. Nelson")))
-
-(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)
- (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
- (option-ref options 'media-library)
- (string-append (option-ref options 'media-library) "/archive/"))))))
-
-(main (command-line))
diff --git a/scripts/rh-client.scm.in b/scripts/rh-client.in
index 64dfde6..64dfde6 100755
--- a/scripts/rh-client.scm.in
+++ b/scripts/rh-client.in
diff --git a/scripts/rh-server.in b/scripts/rh-server.in
new file mode 100755
index 0000000..9749ec2
--- /dev/null
+++ b/scripts/rh-server.in
@@ -0,0 +1,72 @@
+#!/usr/bin/env guile
+!#
+(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"))
+ (character #f))
+ (setting
+ (name 'service-socket)
+ (synopsis "socket for communication with the service")
+ (default (string-append "ipc://" (or (getenv "XDG_RUNTIME_DIR")
+ "/tmp")
+ "/reading-heap.sock"))
+ (character #f))
+ (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)
+ (copyright '(2023))
+ (version "0.1")
+ (license agpl3+)
+ (author "Christopher R. Nelson")))
+
+(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)
+ (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
+ (option-ref options 'media-library)
+ (string-append (option-ref options 'media-library) "/archive/"))))))
+
+(main (command-line))
diff --git a/tests/sample.json b/tests/sample.json
deleted file mode 100644
index b2fbffe..0000000
--- a/tests/sample.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "title": "Foundation Trilogy",
- "author": "Isaac Asimov",
- "priority": 1
-}