summaryrefslogtreecommitdiff
path: root/tw/services
diff options
context:
space:
mode:
authorTimo Wilken2023-02-19 17:46:33 +0100
committerTimo Wilken2023-02-19 17:46:33 +0100
commit9da75dc5c6547a9162e953175ad25f323c2a9750 (patch)
tree7948ab6696bab66e2bef03254beb4d5e3dbf2d1c /tw/services
parent32152898cbaebbe7d7a5f6b41be0ec8d76a08fdc (diff)
Add get-iplayer service
Diffstat (limited to 'tw/services')
-rw-r--r--tw/services/media.scm33
1 files changed, 32 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.")))