summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tw/services/media.scm33
-rw-r--r--tw/system/lud.scm5
2 files changed, 37 insertions, 1 deletions
diff --git a/tw/services/media.scm b/tw/services/media.scm
index 22a720fb..cb463bb1 100644
--- a/tw/services/media.scm
+++ b/tw/services/media.scm
@@ -8,7 +8,9 @@
#:use-module (guix gexp)
#:use-module (guix packages)
#:export (yt-dlp-service-type
- yt-dlp-configuration))
+ yt-dlp-configuration
+ get-iplayer-service-type
+ get-iplayer-configuration))
(define (package-or-false? value)
(or (package? value) (eq? #f value)))
@@ -59,3 +61,32 @@ run the download script. By default, picks a random time between 04:00 and
(list (service-extension mcron-service-type yt-dlp-cronjob)))
(description
"Trigger yt-dlp on a schedule to download videos from YouTube.")))
+
+
+
+(define-configuration/no-serialization get-iplayer-configuration
+ (config-directory string "The directory in which to look for configuration files.")
+ (get-iplayer (package get-iplayer) "The get-iplayer package to use.")
+ (schedule (string-or-gexp (random-minute 1)) "The mcron schedule on which to
+run the download script. By default, picks a random time between 01:00 and
+02:00 every night.")
+ (user (string "root") "The Unix user name to run the script as."))
+
+(define (get-iplayer-cronjob config)
+ (list
+ #~(job #$(get-iplayer-configuration-schedule config)
+ #$(program-file
+ "get-iplayer-command"
+ #~(execl #$(file-append (get-iplayer-configuration-get-iplayer config)
+ "/bin/get_iplayer")
+ "get_iplayer" "--pvr" "--profile-dir"
+ #$(get-iplayer-configuration-config-directory config)))
+ #:user #$(get-iplayer-configuration-user config))))
+
+(define get-iplayer-service-type
+ (service-type
+ (name 'get-iplayer)
+ (extensions
+ (list (service-extension mcron-service-type get-iplayer-cronjob)))
+ (description
+ "Trigger get_iplayer on a schedule to download radio shows from the BBC.")))
diff --git a/tw/system/lud.scm b/tw/system/lud.scm
index c2f124b2..79b4d9d2 100644
--- a/tw/system/lud.scm
+++ b/tw/system/lud.scm
@@ -119,6 +119,11 @@ SSLSessionCacheTimeout 1200
(media-directory "/var/data/syncthing/Videos")
(user "syncthing")))
+ (service get-iplayer-service-type
+ (get-iplayer-configuration
+ (config-directory "/var/data/syncthing/Audiobooks/.get_iplayer")
+ (user "syncthing")))
+
;; certbot for Synapse + Apache/Nextcloud
;; This also installs a nginx server on port 80, redirecting to port 443.
(service certbot-service-type