diff mbox series

[bug#70078] gnu: Add stremio.

Message ID PAXP251MB0348952161EACC6CA681DA88F33A2@PAXP251MB0348.EURP251.PROD.OUTLOOK.COM
State New
Headers show
Series [bug#70078] gnu: Add stremio. | expand

Commit Message

Sergio Pastor PĂ©rez March 29, 2024, 4:25 p.m. UTC
* gnu/packages/video.scm (stremio): New variable.

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


base-commit: 8ed9ce9d0070b854f0aadc6626e624ba2156c112
diff mbox series

Patch

diff --git a/gnu/packages/video.scm b/gnu/packages/video.scm
index 94334e0c97..e0da7a4874 100644
--- a/gnu/packages/video.scm
+++ b/gnu/packages/video.scm
@@ -169,6 +169,7 @@  (define-module (gnu packages video)
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages nettle)
   #:use-module (gnu packages networking)
+  #:use-module (gnu packages node)
   #:use-module (gnu packages ocr)
   #:use-module (gnu packages pcre)
   #:use-module (gnu packages pciutils)
@@ -3751,6 +3752,110 @@  (define-public streamlink
 from sites like Twitch.tv and pipes them into a video player of choice.")
     (license license:bsd-2)))
 
+(define-public stremio
+  (define server-js
+    (let ((version "4.20.8"))
+      (origin
+        (method url-fetch)
+        (uri (string-append "https://dl.strem.io/server/v" version
+                            "/desktop/server.js"))
+        (file-name (string-append "server-js-" version))
+        (sha256 (base32 "0xmlbx6aib5h78ya369pnpxyn05b12l05i8v2kymijbmaw7j04vi")))))
+  (package
+    (name "stremio")
+    (version "4.4.168")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/Stremio/stremio-shell")
+             (commit (string-append "v" version))
+             (recursive? #t)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "14x9i8qvm19sijh7hqppbk8s14dvv7dqlck7x3s8n9i4xn4ncgd7"))))
+    (build-system qt-build-system)
+    (native-inputs (list librsvg))
+    (inputs (list qtbase-5
+                  qtdeclarative-5
+                  qtwebchannel-5
+                  qtwebengine-5
+                  qtquickcontrols-5
+                  openssl
+                  mpv
+                  node))
+    (arguments
+     (list
+      #:tests? #f
+      #:phases #~(modify-phases %standard-phases
+                   (add-after 'unpack 'setup-server
+                     (lambda _
+                       (copy-file #$server-js "server.js")))
+                   (add-after 'unpack 'fix-paths
+                     (lambda* (#:key inputs #:allow-other-keys)
+                       (substitute* "main.qml"
+                         (("var node_executable =.*$")
+                          (string-append "var node_executable =\""
+                                         (search-input-file inputs "bin/node")
+                                         "\"\n"))
+                         (("applicationDirPath \\+\"/server\\.js\"")
+                          (string-append "\""
+                                         #$server-js "\"")))
+                       (substitute* "smartcode-stremio.desktop"
+                         (("Exec=stremio")
+                          (string-append "Exec="
+                                         #$output "/bin/stremio")))))
+                   (replace 'configure
+                     (lambda _
+                       (invoke "qmake")))
+                   (replace 'build
+                     (lambda _
+                       (invoke "make" "-f" "release.makefile"
+                               (string-append "PREFIX="
+                                              #$output))))
+                   (replace 'install
+                     (lambda _
+                       (invoke "make" "-f" "release.makefile" "install"
+                               (string-append "PREFIX="
+                                              #$output))
+                       ;; Setup bin dir.
+                       (with-directory-excursion #$output
+                         (install-file "opt/stremio/stremio" "bin")
+                         (install-file "opt/stremio/smartcode-stremio.desktop"
+                          "share/applications")
+                         ;; Setup icon dir.
+                         (for-each (lambda (size)
+                                     (let ((dir (string-append #$output
+                                                 "/share/icons/hicolor/"
+                                                 size
+                                                 "x"
+                                                 size
+                                                 "/apps")))
+                                       (mkdir-p dir)
+                                       (copy-file (string-append
+                                                   "opt/stremio/icons/smartcode-stremio_"
+                                                   size ".png")
+                                                  (string-append dir
+                                                   "/smartcode-stremio.png"))
+                                       (copy-file (string-append
+                                                   "opt/stremio/icons/smartcode-stremio-tray_"
+                                                   size ".png")
+                                                  (string-append dir
+                                                   "/smartcode-stremio-tray.png"))))
+                                   '("16" "22" "24" "32" "64" "128"))
+                         ;; Remove unnecessary opt dir.
+                         (delete-file-recursively "opt")))))))
+    (home-page "https://www.stremio.com")
+    (synopsis "Modern media center that gives you the freedom to watch
+everything you want")
+    (description
+     "Stremio offers a secure, modern and seamless entertainment experience.
+With its easy-to-use interface and diverse content library, including 4K HDR
+support, users can enjoy their favorite movies and TV shows across all their
+devices.  And with its commitment to security, Stremio is the ultimate choice
+for a worry-free, high-quality streaming experience.")
+    (license license:expat)))
+
 (define-public twitchy
   (let ((commit "9beb36d80b16662414129693e74fa3a2fd97554e")) ; 3.4 has no tag
     (package