Subject: [PATCH 13/13] gnu: Add spotify-downloader.

From: 45mg <[email-masked]>
Date: Wed, 5 Mar 2025 00:43:16 +0530

* gnu/packages/python-web.scm (spotify-downloader): New variable.

Change-Id: I5ab889b33a10beb14545030ee75bd38a1663cc28
---
 gnu/packages/python-web.scm | 85 +++++++++++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/gnu/packages/python-web.scm b/gnu/packages/python-web.scm
index 17edbad7a1..26803dc996 100644
--- a/gnu/packages/python-web.scm
+++ b/gnu/packages/python-web.scm
@@ -117,6 +117,7 @@ (define-module (gnu packages python-web)
   #:use-module (gnu packages libevent)
   #:use-module (gnu packages libffi)
   #:use-module (gnu packages linux)
+  #:use-module (gnu packages music)
   #:use-module (gnu packages node)
   #:use-module (gnu packages openstack)
   #:use-module (gnu packages pcre)
@@ -139,6 +140,7 @@ (define-module (gnu packages python-web)
   #:use-module (gnu packages time)
   #:use-module (gnu packages tls)
   #:use-module (gnu packages version-control)
+  #:use-module (gnu packages video)
   #:use-module (gnu packages web)
   #:use-module (gnu packages xml)
   #:use-module (gnu packages)
@@ -10808,6 +10810,89 @@ (define-public python-spotipy
 platform.")
     (license license:expat)))
 
+(define-public spotify-downloader
+  (package
+    (name "spotify-downloader")
+    (version "4.2.11")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/spotDL/spotify-downloader")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        "18lwimvld07ywzmzffg18j7dpllyk1335x786yhjzldlhx1akmhn")))
+    (build-system pyproject-build-system)
+    (propagated-inputs (list ffmpeg
+                             python-beautifulsoup4
+                             python-fastapi
+                             python-mutagen
+                             python-platformdirs
+                             python-pydantic-2
+                             python-pykakasi
+                             python-slugify
+                             python-pytube
+                             python-rapidfuzz
+                             python-requests-next
+                             python-rich
+                             python-soundcloud-v2
+                             python-spotipy
+                             python-syncedlyrics
+                             python-uvicorn
+                             python-websockets-14
+                             python-ytmusicapi
+                             yt-dlp))
+    (native-inputs (list nss-certs-for-test
+                         python-poetry-core
+                         python-pytest
+                         python-pytest-mock
+                         python-pytest-subprocess
+                         python-pytest-vcr
+                         python-setuptools
+                         python-wheel))
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         ;; XXX: We use later versions of uvicorn and fastapi, since it proved
+         ;; too difficult to package the older ones. Note that these packages
+         ;; are network-related, and we disable network-related tests...
+         (add-after 'unpack 'use-later-versions
+           (lambda _
+             (substitute* "pyproject.toml"
+               (("^fastapi = \"\\^0.103.0\"")
+                "fastapi = \"^0.115.0\"")
+               (("^uvicorn = \"\\^0.23.2\"")
+                "uvicorn = \"^0.34.0\""))))
+         (add-before 'check 'set-HOME
+           ;; Some tests need this
+           (lambda _ (setenv "HOME" "/tmp"))))
+       #:test-flags
+       ;; Disable network dependent tests.
+       (list "--ignore=tests/test_init.py"
+             "--ignore=tests/test_matching.py"
+             "--ignore=tests/providers/lyrics"
+             "--ignore=tests/types"
+             "--ignore=tests/utils/test_github.py"
+             "--ignore=tests/utils/test_m3u.py"
+             "--ignore=tests/utils/test_metadata.py"
+             "--ignore=tests/utils/test_search.py"
+             "-k"
+             ,(string-append "not test_convert"
+                             " and not test_download_ffmpeg"
+                             " and not test_download_song"
+                             " and not test_preload_song"
+                             " and not test_yt_get_results"
+                             " and not test_yt_search"
+                             " and not test_ytm_search"
+                             " and not test_ytm_get_results"))))
+    (home-page "https://github.com/spotDL/spotify-downloader")
+    (synopsis "Download Spotify songs from YouTube")
+    (description
+     "spotDL finds songs from Spotify on YouTube and downloads them - along
+with album art, lyrics and metadata.")
+    (license license:expat)))
+
 (define-public python-whatthepatch
   (package
     (name "python-whatthepatch")
-- 
2.48.1