guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#51179] [PATCH v2] Re: bug#51179: [PATCH] gnu: Add yt-dlp.


From: Liliana Marie Prikler
Subject: [bug#51179] [PATCH v2] Re: bug#51179: [PATCH] gnu: Add yt-dlp.
Date: Wed, 13 Oct 2021 16:53:38 +0200
User-agent: Evolution 3.34.2

Hi Robin,

when pasting other stuff into a patch, one usually ought to do so after
the "---" line before the summary and the first diff.

Am Mittwoch, den 13.10.2021, 08:46 -0400 schrieb Robin Templeton:
> Liliana Marie Prikler <liliana.prikler@gmail.com> writes:
> 
> [...]
> > > +              (snippet
> > > +               '(begin
> > > +                  ;; Delete the pre-generated files, except for
> > > the man page
> > > +                  ;; which requires 'pandoc' to build.
> [...]
> > Is this the same as for youtube-dl?  If not, we might want to give
> > pandoc as native-input.  That will increase build times, but it
> > ought not to increase closure size.
> 
> This is analogous to youtube-dl's pandoc avoidance; IMHO youtube-dl
> ought to use pandoc as a native input, but I wanted to keep the
> packaging as close to youtube-dl's as possible.
Hence why I asked whether youtube-dl does the same.  Making that change
would probably be out of scope for now.

> [...]
> > > +                  (add-before 'build 'build-generated-files
> > > +                    (lambda _
> > > +                      ;; Avoid the make targets that require
> > > pandoc.
> > > +                      (invoke "make"
> > > +                              "PYTHON=python"
> > > +                              "yt-dlp"
> > > +                              ;;"youtube-dl.1"   ; needs pandoc
> > > +                              "completions")))
> > > +                  (add-before 'install 'fix-the-data-directories
> > > +                    (lambda* (#:key outputs #:allow-other-keys)
> > > +                      (let ((prefix (assoc-ref outputs "out")))
> > > +                        (substitute* "setup.py"
> > > +                          (("'etc/")
> > > +                           (string-append "'" prefix "/etc/"))
> > > +                          (("'share/")
> > > +                           (string-append "'" prefix
> > > "/share/")))
> > > +                        #t))))))
> > Horizontal space is at a premium and you can save some.
> 
> I'm not sure where exactly this should use fewer columns, but I
> squeezed the make invocation onto a single line.
You fixed it by accident, given that you're now required to use
substitute-keyword-arguments*, putting #:phases on an extra line as it
ought to be.

> v2 also adds three inputs needed for the program to run correctly
> (updated based on efraim's yt-dlp package, <https://bpa.st/FJDA>;; in
> that package, the extra libraries are propagated inputs, but adding
> them as regular inputs appears to be sufficient).
Can we somehow verify that this is indeed the case?  Normally we would
wrap PYTHONPATH in such a case.

> [...]
> > Otherwise LGTM, but haven't tested.
> 
> Thanks for the quick review! Patch v2 below. (I tested it on a few
> YouTube videos and it worked as expected, at least for simple "yt-dlp
> $URL"-type usage.)
> 
> --8<---------------cut here---------------start------------->8---
> 
> * gnu/packages/video.scm (yt-dlp): New variable.
> 
> Suggested-by: bdju <bdju@tilde.team>
> ---
>  gnu/packages/video.scm | 61
> ++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 61 insertions(+)
> 
> diff --git a/gnu/packages/video.scm b/gnu/packages/video.scm
> index fcac369f60..94f5e85e77 100644
> --- a/gnu/packages/video.scm
> +++ b/gnu/packages/video.scm
> @@ -142,6 +142,7 @@
>    #:use-module (gnu packages man)
>    #:use-module (gnu packages markup)
>    #:use-module (gnu packages maths)
> +  #:use-module (gnu packages music)
>    #:use-module (gnu packages mp3)
>    #:use-module (gnu packages ncurses)
>    #:use-module (gnu packages networking)
> @@ -2360,6 +2361,66 @@ YouTube.com and many more sites.")
>      (home-page "https://yt-dl.org";)
>      (license license:public-domain)))
>  
> +(define-public yt-dlp
> +  (package/inherit youtube-dl
> +    (name "yt-dlp")
> +    (version "2021.10.10")
> +    (source (origin
> +              (method url-fetch)
> +              (uri (string-append "https://github.com/yt-dlp/yt-dlp/
> "
> +                                  "releases/download/"
> +                                  version "/yt-dlp.tar.gz"))
> +              (sha256
> +               (base32
> +                "1ywld4qhvsik970gbac1h3kvxb74r7150m5axq9r5nffdw5sz3v
> d"))
> +              (snippet
> +               '(begin
> +                  ;; Delete the pre-generated files, except for the
> man page
> +                  ;; which requires 'pandoc' to build.
> +                  (for-each delete-file '("yt-dlp"
> +                                          ;;pandoc is needed to
> generate
> +                                          ;;"yt-dlp.1"
> +                                          "completions/bash/yt-dlp"
> +                                          "completions/fish/yt-
> dlp.fish"
> +                                          "completions/zsh/_yt-
> dlp"))
> +                  #t))))
> +    (arguments
> +     (substitute-keyword-arguments (package-arguments youtube-dl)
> +       ((#:phases phases)
> +        `(modify-phases ,phases
> +           ;; See the comment for the corresponding phase in
> youtube-dl.
> +           (replace 'default-to-the-ffmpeg-input
> +             (lambda _
> +               (substitute* "yt_dlp/postprocessor/ffmpeg.py"
> +                 (("\\.get\\('ffmpeg_location'\\)" match)
> +                  (format #f "~a or '~a'" match (which "ffmpeg"))))
> +               #t))
> +           (replace 'build-generated-files
> +             (lambda _
> +               ;; Avoid the yt-dlp.1 target, which requires pandoc.
> +               (invoke "make" "PYTHON=python" "yt-dlp"
> "completions")))
> +           (replace 'fix-the-data-directories
> +             (lambda* (#:key outputs #:allow-other-keys)
> +               (let ((prefix (assoc-ref outputs "out")))
> +                 (substitute* "setup.py"
> +                   (("'etc/")
> +                    (string-append "'" prefix "/etc/"))
> +                   (("'share/")
> +                    (string-append "'" prefix "/share/"))))
> +               #t))
> +           (delete 'install-completion)))))
Why do we not install completions?
> +    (inputs
> +     `(("python-mutagen" ,python-mutagen)
> +       ("python-pycryptodomex" ,python-pycryptodomex)
> +       ("python-websockets" ,python-websockets)
> +       ,@(package-inputs youtube-dl)))
> +    (description
> +     "yt-dlp is a small command-line program to download videos from
> +YouTube.com and many more sites.  It is a fork of youtube-dl with a
> +focus on adding new features while keeping up-to-date with the
> +original project.")
> +    (home-page "https://github.com/yt-dlp/yt-dlp";)))
> +
>  (define-public youtube-dl-gui
>    (package
>      (name "youtube-dl-gui")

Regards,
Liliana






reply via email to

[Prev in Thread] Current Thread [Next in Thread]