Subject: [bug#67120] [PATCH v4 4/4] gnu: Add jellyfin-mpv-shim.

From: Ian Eure <[email-masked]>
Date: Sat, 17 Feb 2024 09:49:38 -0800

* gnu/packages/video.scm (jellyfin-mpv-shim): New variable.

Change-Id: Ie030dee36b1c2afc796f082fdebf909cbddd59da
---
 gnu/packages/video.scm | 44 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)

diff --git a/gnu/packages/video.scm b/gnu/packages/video.scm
index 894543d3cc..442500e24d 100644
--- a/gnu/packages/video.scm
+++ b/gnu/packages/video.scm
@@ -2751,6 +2751,50 @@ (define-public smplayer
 the last played position, etc.")
     (license license:gpl2+)))
 
+(define-public jellyfin-mpv-shim
+  (package
+    (name "jellyfin-mpv-shim")
+    (version "2.6.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "jellyfin-mpv-shim" version))
+       (sha256
+        (base32 "1cy2sfv84k5nw8bqy4aa7v0hdawp7gk5s7wq850xizqk0sz7cipp"))))
+    (build-system python-build-system)
+    (arguments
+     (list
+      #:tests? #f ;There are no tests, but this tries to run the GUI.
+      #:phases #~(modify-phases %standard-phases
+                   (delete 'sanity-check) ;This tries to run the GUI.
+                   (add-after 'install 'install-desktop-file
+                     (lambda* (#:key outputs #:allow-other-keys)
+                       (let* ((out (assoc-ref outputs "out"))
+                              (apps (string-append out "/share/applications"))
+                              (desktop-base "jellyfin_mpv_shim/integration/")
+                              (package-id
+                               "com.github.iwalton3.jellyfin-mpv-shim"))
+                         (for-each (lambda (size)
+                                     (install-file (format #f
+                                                    "~ajellyfin-~a.png"
+                                                    desktop-base size) apps))
+                                   '(256 128 64 48 32 16))
+                         (install-file (string-append desktop-base package-id
+                                                      ".appdata.xml") apps)
+                         (install-file (string-append desktop-base package-id
+                                                      ".desktop") apps) #t))))))
+    (native-inputs (list xorg-server-for-tests))
+    (propagated-inputs (list `(,python "tk")
+                             python-jellyfin-apiclient
+                             python-mpv
+                             python-mpv-jsonipc
+                             python-pystray
+                             python-requests))
+    (home-page "https://github.com/jellyfin/jellyfin-mpv-shim")
+    (synopsis "Cast media from Jellyfin Mobile and Web apps to MPV")
+    (description "Cast media from Jellyfin Mobile and Web apps to MPV.")
+    (license license:gpl2)))
+
 (define-public gallery-dl
   (package
     (name "gallery-dl")
-- 
2.41.0