diff options
author | Timo Wilken | 2023-02-19 17:46:33 +0100 |
---|---|---|
committer | Timo Wilken | 2023-02-19 17:46:33 +0100 |
commit | 9da75dc5c6547a9162e953175ad25f323c2a9750 (patch) | |
tree | 7948ab6696bab66e2bef03254beb4d5e3dbf2d1c /tw/services | |
parent | 32152898cbaebbe7d7a5f6b41be0ec8d76a08fdc (diff) |
Add get-iplayer service
Diffstat (limited to 'tw/services')
-rw-r--r-- | tw/services/media.scm | 33 |
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."))) |