[PATCH] gnu: Separate youtube-viewer-cli from youtube-viewer

OpenSubmitted by swedebugia.
Details
2 participants
  • Eric Bavier
  • swedebugia
Owner
unassigned
Severity
normal
S
S
swedebugia wrote on 6 Jan 2019 22:29
(address . guix-patches@gnu.org)
7aba2ddd3f21b0034c2d4c59d46383b8@riseup.net
--
Cheers
Swedebugia
From 354d66b2eba83f5e0ed1d7f55f6055d0be3f962e Mon Sep 17 00:00:00 2001
From: swedebugia <swedebugia@riseup.net>
Date: Sun, 6 Jan 2019 22:10:20 +0100
Subject: [PATCH 1/2] gnu: Separate youtube-viewer-cli from youtube-viewer.

* gnu/packages/video.scm (youtube-viewer-cli): New variable.
---
gnu/packages/video.scm | 62 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 62 insertions(+)

Toggle diff (75 lines)
diff --git a/gnu/packages/video.scm b/gnu/packages/video.scm
index dfcfc121a..c6bd9063c 100644
--- a/gnu/packages/video.scm
+++ b/gnu/packages/video.scm
@@ -1521,6 +1521,68 @@ Both command-line and GTK2 interface are available.")
     (home-page "https://github.com/trizen/youtube-viewer")
     (license license:perl-license)))
 
+(define-public youtube-viewer-cli
+  (package
+    (name "youtube-viewer-cli")
+    (version "3.4.1")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/trizen/youtube-viewer.git")
+                    (commit version)))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "0axgb95lx81psgrb2a5rfdd8gl4mhsrzf41jas6l58d1xkaj54ri"))))
+    (build-system perl-build-system)
+    (native-inputs
+     `(("perl-module-build" ,perl-module-build)))
+    ;; FIXME: Add optional dependencies once available:
+    ;; perl-lwp-useragent-cached
+    (inputs
+     `(("perl-data-dump" ,perl-data-dump)
+       ("perl-file-sharedir" ,perl-file-sharedir)
+       ("perl-json" ,perl-json)
+       ("perl-libwww" ,perl-libwww)
+       ("perl-lwp-protocol-https" ,perl-lwp-protocol-https)
+       ;; The LWP::UserAgent::Cache module is recommended
+       ("perl-mozilla-ca" ,perl-mozilla-ca)
+       ;; ("perl-term-readline-gnu" ,perl-term-readline-gnu) not in guix yet
+       ("perl-unicode-linebreak" ,perl-unicode-linebreak)))
+    (arguments
+     `(#:modules ((guix build perl-build-system)
+                  (guix build utils)
+                  (srfi srfi-26))
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'install 'wrap-program
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (bin-dir (string-append out "/bin/"))
+                    (site-dir (string-append out "/lib/perl5/site_perl/"))
+                    (lib-path (getenv "PERL5LIB")))
+               (for-each (cut wrap-program <>
+                              `("PERL5LIB" ":" prefix (,lib-path ,site-dir)))
+                         (find-files bin-dir))
+               #t)))
+         (add-after 'wrap-program 'rename
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                   (bin-dir (string-append out "/bin/")))
+               (chdir bin-dir)
+               (rename-file "youtube-viewer"
+                            "youtube-viewer-cli")))))))
+    (synopsis
+     "CLI application for searching and streaming videos from YouTube")
+    (description
+     "Youtube-viewer-cli searches and plays YouTube videos from the command line.
+It comes with various search options; it can search for videos, playlists
+and/or channels.  The videos are streamed directly in a selected video player
+at the best resolution (customizable) and with closed-captions (if available).
+GTK2 interface is available in @package{youtube-viewer-gtk}.")
+    (home-page "https://github.com/trizen/youtube-viewer")
+    (license license:perl-license)))
+
 (define-public libbluray
   (package
     (name "libbluray")
-- 
2.19.2
From cc52eb5b8010d2bd9d9387e8a763948ac95d0d0b Mon Sep 17 00:00:00 2001
From: swedebugia <swedebugia@riseup.net>
Date: Sun, 6 Jan 2019 22:23:29 +0100
Subject: [PATCH 2/2] gnu: youtube-viewer: Rename to youtube-viewer-gtk

* gnu/packages/video.scm (youtube-viewer):
[name] Rename it.
[arguments] Add phase to rename the binary.
---
gnu/packages/video.scm | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)

Toggle diff (35 lines)
diff --git a/gnu/packages/video.scm b/gnu/packages/video.scm
index c6bd9063c..76ad48d19 100644
--- a/gnu/packages/video.scm
+++ b/gnu/packages/video.scm
@@ -1466,9 +1466,9 @@ audio, images) from the Web.  It can use either mpv or vlc for playback.")
     (home-page "https://you-get.org/")
     (license license:expat)))
 
-(define-public youtube-viewer
+(define-public youtube-viewer-gtk
   (package
-    (name "youtube-viewer")
+    (name "youtube-viewer-gtk")
     (version "3.5.0")
     (source (origin
               (method git-fetch)
@@ -1509,7 +1509,15 @@ audio, images) from the Web.  It can use either mpv or vlc for playback.")
                (for-each (cut wrap-program <>
                               `("PERL5LIB" ":" prefix (,lib-path ,site-dir)))
                          (find-files bin-dir))
-               #t))))))
+               #t)))
+                  (add-after 'wrap-program 'rename
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                   (bin-dir (string-append out "/bin/")))
+               (chdir bin-dir)
+               (rename-file "gtk-youtube-viewer"
+                            "youtube-viewer-gtk")
+               #t))))))))
     (synopsis
      "Lightweight application for searching and streaming videos from YouTube")
     (description
-- 
2.19.2
S
S
swedebugia wrote on 6 Jan 2019 22:43
(address . 34000@debbugs.gnu.org)(name . Guix-patches)(address . guix-patches-bounces+swedebugia=riseup.net@gnu.org)
35d89c27bb458aff9b13339b765f2d3f@riseup.net
On 2019-01-06 21:29, swedebugia@riseup.net wrote:
Toggle quote (2 lines)
>

This is updated to fix a parens error.

--
Cheers
Swedebugia
From 354d66b2eba83f5e0ed1d7f55f6055d0be3f962e Mon Sep 17 00:00:00 2001
From: swedebugia <swedebugia@riseup.net>
Date: Sun, 6 Jan 2019 22:10:20 +0100
Subject: [PATCH 1/2] gnu: Separate youtube-viewer-cli from youtube-viewer.

* gnu/packages/video.scm (youtube-viewer-cli): New variable.
---
gnu/packages/video.scm | 62 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 62 insertions(+)

Toggle diff (75 lines)
diff --git a/gnu/packages/video.scm b/gnu/packages/video.scm
index dfcfc121a..c6bd9063c 100644
--- a/gnu/packages/video.scm
+++ b/gnu/packages/video.scm
@@ -1521,6 +1521,68 @@ Both command-line and GTK2 interface are available.")
     (home-page "https://github.com/trizen/youtube-viewer")
     (license license:perl-license)))
 
+(define-public youtube-viewer-cli
+  (package
+    (name "youtube-viewer-cli")
+    (version "3.4.1")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/trizen/youtube-viewer.git")
+                    (commit version)))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "0axgb95lx81psgrb2a5rfdd8gl4mhsrzf41jas6l58d1xkaj54ri"))))
+    (build-system perl-build-system)
+    (native-inputs
+     `(("perl-module-build" ,perl-module-build)))
+    ;; FIXME: Add optional dependencies once available:
+    ;; perl-lwp-useragent-cached
+    (inputs
+     `(("perl-data-dump" ,perl-data-dump)
+       ("perl-file-sharedir" ,perl-file-sharedir)
+       ("perl-json" ,perl-json)
+       ("perl-libwww" ,perl-libwww)
+       ("perl-lwp-protocol-https" ,perl-lwp-protocol-https)
+       ;; The LWP::UserAgent::Cache module is recommended
+       ("perl-mozilla-ca" ,perl-mozilla-ca)
+       ;; ("perl-term-readline-gnu" ,perl-term-readline-gnu) not in guix yet
+       ("perl-unicode-linebreak" ,perl-unicode-linebreak)))
+    (arguments
+     `(#:modules ((guix build perl-build-system)
+                  (guix build utils)
+                  (srfi srfi-26))
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'install 'wrap-program
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (bin-dir (string-append out "/bin/"))
+                    (site-dir (string-append out "/lib/perl5/site_perl/"))
+                    (lib-path (getenv "PERL5LIB")))
+               (for-each (cut wrap-program <>
+                              `("PERL5LIB" ":" prefix (,lib-path ,site-dir)))
+                         (find-files bin-dir))
+               #t)))
+         (add-after 'wrap-program 'rename
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                   (bin-dir (string-append out "/bin/")))
+               (chdir bin-dir)
+               (rename-file "youtube-viewer"
+                            "youtube-viewer-cli")))))))
+    (synopsis
+     "CLI application for searching and streaming videos from YouTube")
+    (description
+     "Youtube-viewer-cli searches and plays YouTube videos from the command line.
+It comes with various search options; it can search for videos, playlists
+and/or channels.  The videos are streamed directly in a selected video player
+at the best resolution (customizable) and with closed-captions (if available).
+GTK2 interface is available in @package{youtube-viewer-gtk}.")
+    (home-page "https://github.com/trizen/youtube-viewer")
+    (license license:perl-license)))
+
 (define-public libbluray
   (package
     (name "libbluray")
-- 
2.19.2
From f9003e6c285e7b1c64ead7c6d876ba95d00dd1c2 Mon Sep 17 00:00:00 2001
From: swedebugia <swedebugia@riseup.net>
Date: Sun, 6 Jan 2019 22:23:29 +0100
Subject: [PATCH 2/2] gnu: youtube-viewer: Rename to youtube-viewer-gtk

* gnu/packages/video.scm (youtube-viewer):
[name] Rename it.
[arguments] Add phase to rename the binary.
---
gnu/packages/video.scm | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)

Toggle diff (33 lines)
diff --git a/gnu/packages/video.scm b/gnu/packages/video.scm
index c6bd9063c..128152371 100644
--- a/gnu/packages/video.scm
+++ b/gnu/packages/video.scm
@@ -1466,9 +1466,9 @@ audio, images) from the Web.  It can use either mpv or vlc for playback.")
     (home-page "https://you-get.org/")
     (license license:expat)))
 
-(define-public youtube-viewer
+(define-public youtube-viewer-gtk
   (package
-    (name "youtube-viewer")
+    (name "youtube-viewer-gtk")
     (version "3.5.0")
     (source (origin
               (method git-fetch)
@@ -1509,6 +1509,14 @@ audio, images) from the Web.  It can use either mpv or vlc for playback.")
                (for-each (cut wrap-program <>
                               `("PERL5LIB" ":" prefix (,lib-path ,site-dir)))
                          (find-files bin-dir))
+               #t)))
+                  (add-after 'wrap-program 'rename
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                   (bin-dir (string-append out "/bin/")))
+               (chdir bin-dir)
+               (rename-file "gtk-youtube-viewer"
+                            "youtube-viewer-gtk")
                #t))))))
     (synopsis
      "Lightweight application for searching and streaming videos from YouTube")
-- 
2.19.2
E
E
Eric Bavier wrote on 7 Jan 2019 16:16
(address . swedebugia@riseup.net)(address . 34000@debbugs.gnu.org)
20190107091628.13b679ee@centurylink.net
On Sun, 06 Jan 2019 13:29:19 -0800
swedebugia@riseup.net wrote:

Toggle quote (4 lines)
> * gnu/packages/video.scm (youtube-viewer-cli): New variable.
> ---
> gnu/packages/video.scm | 62 ++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 62 insertions(+)
...
Toggle quote (6 lines)
> Subject: [PATCH 2/2] gnu: youtube-viewer: Rename to youtube-viewer-gtk
>
> * gnu/packages/video.scm (youtube-viewer):
> [name] Rename it.
> [arguments] Add phase to rename the binary.

I think renaming binaries is too much of a divergence from upstream.
This can only cause confusion to users coming to Guix from another
distro that use the upstream binary names, and is unlikely to be
adopted upstream:


If the desire is to create a slimmer cli-only package, would creating
another output not work?

`~Eric
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEoMXjUi7471xkzbfw/XPKxxnTJWYFAlwzbUwACgkQ/XPKxxnT
JWZPOw//V2YQ3PXf18c7K4/b3zzwji2+JQYEPmAxMGy9JEKEWQyBFswC3m7UlXzB
dLi0BrCOeBSIUgjwn8Pn3ZWx1LW52EwWM7ODvtB6dgEEHlo9MIxP5HWIiEVD1G/P
Wp9+UDK2PfjNZW63D0zX0eOJPE+fJ9WGh6ppThd4fX6v/pF7R35e1C2kyvTY1rqA
8ovzRg+J2/5fD6s2eSSsdwtYR6J9GQH72SzNAUSqFgaaYs/BA0mXW6v63r+QoWm9
xJWsksmF6z3XOCo5E2HRjXTsBRz6C0J85MyTqQfrbiYeUvrbW7q8RcfjG6GAEODk
ZtE4di6npsMIwdZ/es6dJu5NaaJL/V6Ko9PxL1Ev77FFH7Nf6EiQilQgS3RfOQcz
hDNnn+R8SuqnsxeT3oM/oecDkhE+8DMqn6PE+UlyeVLfgpR/171DgGNm+Y47BJ2h
VkPIRSGLAtbz63E01KLJJoeZSVN4+RBPO16/B7Grlsb+xAQ2h2GTuKVQaaviiWTx
j2MA6EOSr2RTZPY7cf6AHntBqYe9R0psPd3D610wy/ioX8eMH6C7QcTIT/GNL2V4
aRj6emSlRiYh+K8ocdc4ZHuyW0LppKSzopDm+qJeApoq0MDCZ3gqFTkCrKoBpI2U
Ny7tvsp6dXGg3p5gCdelfjcD3xsqAcEw2ECiRZZspiGrB/jlitk=
=wETR
-----END PGP SIGNATURE-----


?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send email to 34000@debbugs.gnu.org