services: mpd: Add an 'update' action to trigger a database update.

* gnu/services/audio.scm (mpd-shepherd-service): Register a new update action.
* doc/guix.texi (Audio Services): Document it.
This commit is contained in:
Maxim Cournoyer 2023-04-25 17:28:21 -04:00
parent 6a57bf9612
commit e1070ee160
No known key found for this signature in database
GPG Key ID: 1260E46482E63562
2 changed files with 21 additions and 0 deletions

View File

@ -34251,6 +34251,16 @@ The following example shows how one might run @code{mpd} as user
(port "6666")))
@end lisp
Most MPD clients will trigger a database update upon connecting, but you
can also use the @code{update} action do to so:
@example
herd update mpd
@end example
All the MPD configuration fields are documented below, and a more
complex example follows.
@defvar mpd-service-type
The service type for @command{mpd}
@end defvar

View File

@ -620,6 +620,17 @@ appended to the configuration.")
(format #t
"Issued SIGHUP to Service MPD (PID ~a)."
pid))
(format #t "Service MPD is not running.")))))
(shepherd-action
(name 'update)
(documentation "Request MPD to update its music database.")
(procedure
#~(lambda (pid)
(if pid
(begin
(invoke #$(file-append mpd-mpc "/bin/mpc") "update")
(format #t "Database update requested for service \
MPD (PID ~a)." pid))
(format #t "Service MPD is not running.")))))))))))
(define (mpd-accounts config)