aboutsummaryrefslogtreecommitdiffstats
path: root/oni/home/services/mpd.scm
diff options
context:
space:
mode:
Diffstat (limited to 'oni/home/services/mpd.scm')
-rw-r--r--oni/home/services/mpd.scm49
1 files changed, 47 insertions, 2 deletions
diff --git a/oni/home/services/mpd.scm b/oni/home/services/mpd.scm
index c3c272c..0fcd411 100644
--- a/oni/home/services/mpd.scm
+++ b/oni/home/services/mpd.scm
@@ -10,7 +10,8 @@
#:use-module (oop goops)
#:use-module (ice-9 string-fun)
#:use-module ((oni packages mpd)
- #:select (mpd-notify))
+ #:select (mpd-notify
+ mpdscrobble))
#:export (home-mpd-service-type
home-mpd-configuration
@@ -20,7 +21,10 @@
home-mpc-update-configuration
home-mpd-notify-service-type
- home-mpd-notify-configuration))
+ home-mpd-notify-configuration
+
+ home-mpdscrobble-service-type
+ home-mpdscrobble-configuration))
(define (serialize-boolean field value)
"")
@@ -204,3 +208,44 @@
(compose identity)
(default-value (home-mpd-notify-configuration))
(description "Install and configure mpd notifications.")))
+
+(define-configuration home-mpdscrobble-configuration
+ (package
+ (package mpdscrobble)
+ "Pakcage to use for setting mpdscrobble")
+ (auto-start?
+ (boolean #t)
+ "Should mpdscrobble be started automatically?"))
+
+(define (add-mpdscrobble-packages config)
+ (list (home-mpdscrobble-configuration-package config)))
+
+(define (home-mpdscrobble-shepherd-service config)
+ (list
+ (shepherd-service
+ (documentation "Scrobble songs to last.fm and/or maloja")
+ (provision '(mpdscrobble))
+ (requirement '(mpd))
+ (auto-start? (home-mpdscrobble-configuration-auto-start? config))
+ (start
+ #~(make-forkexec-constructor
+ (list #$(file-append (home-mpdscrobble-configuration-package config) "/bin/mpdscrobble"))
+ #:log-file (format #f "~a/.local/var/log/mpdscrobble.log" (getenv "HOME"))))
+ (stop #~(make-kill-destructor))
+ (respawn? #t)
+ (respawn-delay 1)
+ (respawn-limit 60))))
+
+(define home-mpdscrobble-service-type
+ (service-type
+ (name 'home-mpdscrobble)
+ (extensions
+ (list (service-extension
+ home-profile-service-type
+ add-mpdscrobble-packages)
+ (service-extension
+ home-shepherd-service-type
+ home-mpdscrobble-shepherd-service)))
+ (compose identity)
+ (default-value (home-mpdscrobble-configuration))
+ (description "Install and configure mpdscrobble.")))