~ruther/guix-local

7227c101b31a3f976e335c3ba85012773ee079e4 — Nicolas Graves 10 months ago 5627559
gnu: Add python-yewtube.

* gnu/packages/video.scm (python-yewtube): New variable.

Change-Id: I4c3d7a40ae09db8649cfc009413731c039435c00
Signed-off-by: Sharlatan Hellseher <sharlatanus@gmail.com>
1 files changed, 63 insertions(+), 0 deletions(-)

M gnu/packages/video.scm
M gnu/packages/video.scm => gnu/packages/video.scm +63 -0
@@ 6685,6 6685,69 @@ and press \"Record\".  Peek is optimized for generating animated GIFs, but you
can also directly record to WebM or MP4 if you prefer.")
    (license license:gpl3+)))

(define-public python-yewtube
  (package
    (name "python-yewtube")
    (version "2.12.1")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
              (url "https://github.com/mps-youtube/yewtube")
              (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32 "1bvn1zcycsq2gnvs10hn82ic8zp9q4s9gmmi6flahg3wavpnspzr"))))
    (build-system pyproject-build-system)
    (arguments
     (list
      #:phases
      #~(modify-phases %standard-phases
          (add-after 'unpack 'relax-requirements
            (lambda _
              (substitute* "mps_youtube/__init__.py"
                (("from pip\\._vendor import pkg_resources.*")
                 "")
                (("__version__ =.*")
                 (format #f "__version__ = ~s~%"
                         #$(package-version this-package))))
              (substitute* "requirements.txt"
                (("httpx.*")
                 "httpx\n"))))
          (add-before 'check 'configure-tests
            (lambda _
              (setenv "HOME" (getcwd))))
          ;; XXX: This can happen when some side-effects happens at
          ;; initialization. See https://codeberg.org/guix/guix/issues/1089
          (add-before 'sanity-check 'patch-script
            (lambda _
              (substitute* (string-append #$output "/bin/.yt-real")
                (("import mps_youtube as mod")
                 "from mps_youtube.main import main")
                (("sys\\.exit \\(mod\\.main\\.main \\(\\)\\)")
                 "sys.exit(main())"))))
          (replace 'sanity-check
            (lambda _
              (invoke (string-append #$output "/bin/yt") "-h"))))))
    (native-inputs
     (list python-dbus
           python-pygobject
           python-pytest
           python-setuptools-next
           python-wheel))
    (propagated-inputs
     (list python-pylast
           python-pyperclip
           python-requests
           python-youtube-search
           yt-dlp))
    (home-page "https://github.com/mps-youtube/yewtube")
    (synopsis "Terminal based YouTube player and downloader")
    (description
     "This package provides a terminal based @code{YouTube} player and
downloader.  It does not require a Youtube API key.")
    (license license:gpl3+)))

(define-public python-youtube-search
  (package
    (name "python-youtube-search")