unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Ian Eure <ian@retrospec.tv>
To: 67120@debbugs.gnu.org
Cc: "Ian Eure" <ian@retrospec.tv>
Subject: [bug#67120] [PATCH v6 5/5] gnu: Add home-jellyfin-mpv-shim-service-type.
Date: Sun, 25 Feb 2024 14:20:34 -0800	[thread overview]
Message-ID: <6cb1e94800f6f8d57b574794549af0c693b89534.1708899540.git.ian@retrospec.tv> (raw)
In-Reply-To: <cover.1708899540.git.ian@retrospec.tv>

* gnu/home/services/media.scm (home-jellyfin-mpv-shim-service-type): New variable.
* doc/guix.texi (Jellyfin Services): New section.
* doc/guix.texi (Kodi Services): Add subheading.

Change-Id: I037ab0602214fdaa1b032be51ff98ecf6b7ee16c
---
 doc/guix.texi               | 19 +++++++++++++++++
 gnu/home/services/media.scm | 42 +++++++++++++++++++++++++++++++++++++
 2 files changed, 61 insertions(+)

diff --git a/doc/guix.texi b/doc/guix.texi
index 671cdab6f8..f4d64f9df7 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -46103,6 +46103,8 @@ Media Home Services
 @subsection Media Home Services
 
 @cindex kodi
+@subsubheading Kodi Services
+
 The @uref{https://kodi.tv, Kodi media center} can be run as a daemon on
 a media server.  With the @code{(gnu home services kodi)} service, you
 can configure Kodi to run upon login.
@@ -46135,6 +46137,23 @@ Media Home Services
 @end table
 @end deftp
 
+@cindex jellyfin
+@subsubheading Jellyfin Services
+
+The @code{home-jellyfin-mpv-shim-service-type} in the @code{(gnu home services media)} module runs a cast client for the @uref{https://jellyfin.org/, Jellyfin} media system.
+
+To enable, add this to your home services:
+
+@lisp
+(service home-jellyfin-mpv-shim-service-type #f)
+@end lisp
+
+The service only starts if @code{jellyfin-mpv-shim} has been configured with a remote server and credentials.  This must be done manually, by launching @code{jellyfin-mpv-shim}.  After configuring the server, the service will start automatically when you log in.
+
+@defvar home-jellyfin-mpv-shim-service-type
+The type of the Jellyfin MPV Shim service.
+@end defvar
+
 @node Networking Home Services
 @subsection Networking Home Services
 
diff --git a/gnu/home/services/media.scm b/gnu/home/services/media.scm
index c6454dfe15..a7fcf75b06 100644
--- a/gnu/home/services/media.scm
+++ b/gnu/home/services/media.scm
@@ -19,8 +19,10 @@
 (define-module (gnu home services media)
   #:use-module (srfi srfi-26)
   #:use-module (gnu home services)
+  #:use-module (gnu home services desktop)
   #:use-module (gnu home services shepherd)
   #:use-module (gnu packages kodi)
+  #:use-module (gnu packages video)
   #:use-module (gnu services configuration)
   #:use-module (gnu services shepherd)
   #:use-module (guix records)
@@ -66,3 +68,43 @@ (define home-kodi-service-type
    (description
     "Install and configure the Kodi media center so that it runs as a Shepherd
 service.")))
+
+(define (jellyfin-mpv-shim-shepherd-service _ignore)
+  (list (shepherd-service
+         (documentation "Jellyfin MPV Shim.")
+         (provision '(jellyfin-mpv-shim jellyfin-client))
+
+         ;; Depend on 'x11-display', which sets 'DISPLAY' if an X11 server is
+         ;; available, and fails to start otherwise.
+         (requirement '(x11-display))
+
+         (modules '((srfi srfi-1)
+                    (srfi srfi-26)
+                    (srfi srfi-98)))
+         (start #~(lambda _
+                    ;; Only start if a server has been configured.
+                    (if (file-exists?
+                         (string-append
+                          (get-environment-variable "XDG_CONFIG_HOME")
+                          "/jellyfin-mpv-shim/cred.json"))
+                        (fork+exec-command
+                         (list #$(file-append jellyfin-mpv-shim "/bin/jellyfin-mpv-shim"))
+
+                         ;; Inherit the 'DISPLAY' variable set by 'x11-display'.
+                         #:environment-variables
+                         (cons (string-append "DISPLAY=" (getenv "DISPLAY"))
+                               (remove (cut string-prefix? "DISPLAY=" <>)
+                                       (default-environment-variables))))
+                        #f)))
+         (stop #~(make-kill-destructor)))))
+
+(define-public home-jellyfin-mpv-shim-service-type
+  (service-type
+   (name 'home-jellyfin-mpv-shim)
+   (extensions (list (service-extension home-shepherd-service-type
+                                        jellyfin-mpv-shim-shepherd-service)
+                     ;; Ensure 'home-x11-service-type' is instantiated so we
+                     ;; can depend on the Shepherd 'x11-display' service.
+                     (service-extension home-x11-service-type
+                                        (const #t))))
+   (description "Run Jellyfin MPV Shim.")))
-- 
2.41.0





  parent reply	other threads:[~2024-02-25 22:21 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-12  4:13 [bug#67120] [PATCH 0/4] Add jellyfin-mpv-player and deps Ian Eure
2023-11-12  4:16 ` [bug#67120] [PATCH 1/4] gnu: Add python-mpv-jsonipc Ian Eure
2023-11-12  4:16 ` [bug#67120] [PATCH 2/4] gnu: Add python-jellyfin-apiclient Ian Eure
2023-11-12  4:16 ` [bug#67120] [PATCH 3/4] gnu: Add python-pystray Ian Eure
2023-11-12  4:16 ` [bug#67120] [PATCH 4/4] gnu: Add jellyfin-mpv-shim Ian Eure
2023-11-12 17:23 ` [bug#67120] [PATCH v2 1/4] gnu: Add python-mpv-jsonipc Ian Eure
2023-11-12 17:23   ` [bug#67120] [PATCH v2 2/4] gnu: Add python-jellyfin-apiclient Ian Eure
2023-11-12 17:23   ` [bug#67120] [PATCH v2 3/4] gnu: Add python-pystray Ian Eure
2023-11-12 17:23   ` [bug#67120] [PATCH v2 4/4] gnu: Add jellyfin-mpv-shim Ian Eure
2023-11-30  1:54 ` [bug#67120] [PATCH v2 0/4] Add jellyfin-mpv-shim and deps Ian Eure
2023-11-30  1:54   ` [bug#67120] [PATCH v2 1/4] gnu: Add python-mpv-jsonipc Ian Eure
2023-11-30  1:54   ` [bug#67120] [PATCH v2 2/4] gnu: Add python-jellyfin-apiclient Ian Eure
2023-11-30  1:54   ` [bug#67120] [PATCH v2 3/4] gnu: Add python-pystray Ian Eure
2023-11-30  1:54   ` [bug#67120] [PATCH v2 4/4] gnu: Add jellyfin-mpv-shim Ian Eure
2024-02-17 17:20 ` [bug#67120] [PATCH v3 0/4] Add jellyfin-mpv-shim and deps Ian Eure
2024-02-17 17:20   ` [bug#67120] [PATCH v3 1/4] gnu: Add python-mpv-jsonipc Ian Eure
2024-02-17 17:20   ` [bug#67120] [PATCH v3 2/4] gnu: Add python-jellyfin-apiclient Ian Eure
2024-02-17 17:20   ` [bug#67120] [PATCH v3 3/4] gnu: Add python-pystray Ian Eure
2024-02-17 17:20   ` [bug#67120] [PATCH v3 4/4] gnu: Add jellyfin-mpv-shim Ian Eure
2024-02-17 17:49 ` [bug#67120] [PATCH v4 0/4] Add jellyfin-mpv-player and deps Ian Eure
2024-02-17 17:49   ` [bug#67120] [PATCH v4 1/4] gnu: Add python-mpv-jsonipc Ian Eure
2024-02-17 17:49   ` [bug#67120] [PATCH v4 2/4] gnu: Add python-jellyfin-apiclient Ian Eure
2024-02-17 17:49   ` [bug#67120] [PATCH v4 3/4] gnu: Add python-pystray Ian Eure
2024-02-17 17:49   ` [bug#67120] [PATCH v4 4/4] gnu: Add jellyfin-mpv-shim Ian Eure
2024-02-17 19:02 ` [bug#67120] [PATCH v5 0/5] Add jellyfin-mpv-player and deps Ian Eure
2024-02-17 19:02   ` [bug#67120] [PATCH v5 1/5] gnu: Add python-mpv-jsonipc Ian Eure
2024-02-17 19:02   ` [bug#67120] [PATCH v5 2/5] gnu: Add python-jellyfin-apiclient Ian Eure
2024-02-17 19:02   ` [bug#67120] [PATCH v5 3/5] gnu: Add python-pystray Ian Eure
2024-02-17 19:02   ` [bug#67120] [PATCH v5 4/5] gnu: Add jellyfin-mpv-shim Ian Eure
2024-02-17 19:02   ` [bug#67120] [PATCH v5 5/5] gnu: Add home-jellyfin-mpv-shim-service-type Ian Eure
2024-02-21 20:42 ` [bug#67120] [PATCH 0/4] Add jellyfin-mpv-player and deps Sharlatan Hellseher
2024-02-25 22:03   ` Ian Eure
2024-03-10  5:15     ` Ian Eure
2024-02-25 22:20 ` [bug#67120] [PATCH v6 0/5] " Ian Eure
2024-02-25 22:20   ` [bug#67120] [PATCH v6 1/5] gnu: Add python-mpv-jsonipc Ian Eure
2024-02-25 22:20   ` [bug#67120] [PATCH v6 2/5] gnu: Add python-jellyfin-apiclient Ian Eure
2024-02-25 22:20   ` [bug#67120] [PATCH v6 3/5] gnu: Add python-pystray Ian Eure
2024-02-25 22:20   ` [bug#67120] [PATCH v6 4/5] gnu: Add jellyfin-mpv-shim Ian Eure
2024-02-25 22:20   ` Ian Eure [this message]
2024-03-07 19:32 ` [bug#67120] Progress Andreas Enge
2024-03-08 11:57 ` Andreas Enge
2024-03-08 12:10 ` [bug#67120] Done Andreas Enge

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6cb1e94800f6f8d57b574794549af0c693b89534.1708899540.git.ian@retrospec.tv \
    --to=ian@retrospec.tv \
    --cc=67120@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).