使用 Soulseek.NET 建立的 Soulseek 自動下載器。接受 CSV 檔案以及 Spotify 和 YouTube 網址。
支援播放清單和專輯下載;根據使用者配置的文件條件和啟發法選擇最佳文件。
請參閱使用範例。
Usage: sldl <input> [OPTIONS]
<input> A url, search string, or path to a local CSV file.
Run --help "input" to view the accepted inputs.
Can also be passed with -i, --input <input>
--user <username> Soulseek username
--pass <password> Soulseek password
-p, --path <path> Download directory
--input-type <type> [csv|youtube|spotify|bandcamp|string|list]
--name-format <format> Name format for downloaded tracks. See --help name-format
-n, --number <maxtracks> Download the first n tracks of a playlist
-o, --offset <offset> Skip a specified number of tracks
-r, --reverse Download tracks in reverse order
-c, --config <path> Set config file location. Set to 'none' to ignore config
--profile <names> Configuration profile(s) to use. See --help ""config"".
--concurrent-downloads <num> Max concurrent downloads (default: 2)
--write-playlist Create an m3u playlist file in the output directory
--playlist-path <path> Override default path for m3u playlist file
--no-skip-existing Do not skip downloaded tracks
--no-write-index Do not create a file indexing all downloaded tracks
--index-path <path> Override default path for sldl index
--skip-check-cond Check file conditions when skipping existing files
--skip-check-pref-cond Check preferred conditions when skipping existing files
--skip-music-dir <path> Also skip downloading tracks found in a music library by
comparing filenames. Not 100% reliable.
--skip-not-found Skip searching for tracks that weren't found on Soulseek
during the last run.
--listen-port <port> Port for incoming connections (default: 49998)
--on-complete <command> Run a command whenever a file is downloaded.
Available placeholders: {path} (local save path), {title},
{artist},{album},{uri},{length},{failure-reason},{state}.
Prepend a state number to only run in specific cases:
1:, 2:, 3:, 4: for the Downloaded, Failed, Exists, and
NotFoundLastTime states respectively.
E.g: '1:<cmd>' will only run the command if the file is
downloaded successfully. Prepend 's:' to use the system
shell to execute the command.
--print <option> Print tracks or search results instead of downloading:
'tracks': Print all tracks to be downloaded
'tracks-full': Print extended information about all tracks
'results': Print search results satisfying file conditions
'results-full': Print search results including full paths.
--no-progress Disable progress bars/percentages, only simple printing
--debug Print extra debug info
--fast-search Begin downloading as soon as a file satisfying the preferred
conditions is found. Only for normal download mode.
--remove-ft Remove 'feat.' and everything after before searching
--no-remove-special-chars Do not remove special characters before searching
--remove-brackets Remove square brackets and their contents before searching
--regex <regex> Remove a regexp from all track titles and artist names.
Optionally specify a replacement regex after a semicolon.
Add 'T:', 'A:' or 'L:' at the start to only apply this to
the track title, artist, or album respectively.
--artist-maybe-wrong Performs an additional search without the artist name.
Useful for sources like SoundCloud where the "artist"
could just be an uploader. Note that when downloading a
YouTube playlist via url, this option is set automatically
on a per-track basis, so it is best kept off in that case.
-d, --desperate Tries harder to find the desired track by searching for the
artist/album/title only, then filtering. (slower search)
--fails-to-downrank <num> Number of fails to downrank a user's shares (default: 1)
--fails-to-ignore <num> Number of fails to ban/ignore a user's shares (default: 2)
--yt-dlp Use yt-dlp to download tracks that weren't found on
Soulseek. yt-dlp must be available from the command line.
--yt-dlp-argument <str> The command line arguments when running yt-dlp. Default:
"{id}" -f bestaudio/best -cix -o "{savepath}.%(ext)s"
Available vars are: {id}, {savedir}, {savepath} (w/o ext).
Note that -x causes yt-dlp to download webms in case ffmpeg
is unavailable.
--search-timeout <ms> Max search time in ms (default: 6000)
--max-stale-time <ms> Max download time without progress in ms (default: 50000)
--searches-per-time <num> Max searches per time interval. Higher values may cause
30-minute bans, see --help "search". (default: 34)
--searches-renew-time <sec> Controls how often available searches are replenished.
See --help "search". (default: 220)
--spotify-id <id> Spotify client ID
--spotify-secret <secret> Spotify client secret
--spotify-token <token> Spotify access token
--spotify-refresh <token> Spotify refresh token
--remove-from-source Remove downloaded tracks from source playlist
--youtube-key <key> Youtube data API key
--get-deleted Attempt to retrieve titles of deleted videos from wayback
machine. Requires yt-dlp.
--deleted-only Only retrieve & download deleted music.
--artist-col Artist column name
--title-col Track title column name
--album-col Album column name
--length-col Track length column name
--album-track-count-col Album track count column name (sets --album-track-count)
--yt-desc-col Youtube description column (improves --yt-parse)
--yt-id-col Youtube video id column (improves --yt-parse)
--time-format <format> Time format in Length column of the csv file (e.g h:m:s.ms
for durations like 1:04:35.123). Default: s
--yt-parse Enable if the CSV contains YouTube video titles and channel
names; attempt to parse them into title and artist names.
--remove-from-source Remove downloaded tracks from source CSV file
--format <formats> Accepted file format(s), comma-separated, without periods
--length-tol <sec> Length tolerance in seconds
--min-bitrate <rate> Minimum file bitrate
--max-bitrate <rate> Maximum file bitrate
--min-samplerate <rate> Minimum file sample rate
--max-samplerate <rate> Maximum file sample rate
--min-bitdepth <depth> Minimum bit depth
--max-bitdepth <depth> Maximum bit depth
--strict-title File name must contain title
--strict-artist File path must contain artist name
--strict-album File path must contain album name
--banned-users <list> Comma-separated list of users to ignore
--pref-format <formats> Preferred file format(s), comma-separated (default: mp3)
--pref-length-tol <sec> Preferred length tolerance in seconds (default: 3)
--pref-min-bitrate <rate> Preferred minimum bitrate (default: 200)
--pref-max-bitrate <rate> Preferred maximum bitrate (default: 2500)
--pref-min-samplerate <rate> Preferred minimum sample rate
--pref-max-samplerate <rate> Preferred maximum sample rate (default: 48000)
--pref-min-bitdepth <depth> Preferred minimum bit depth
--pref-max-bitdepth <depth> Preferred maximum bit depth
--pref-banned-users <list> Comma-separated list of users to downrank
--strict-conditions Skip files with missing properties instead of accepting by
default; if --min-bitrate is set, ignores any files with
unknown bitrate.
-a, --album Album download mode: Download a folder
-t, --interactive Interactive mode, allows to select the folder and images
--album-track-count <num> Specify the exact number of tracks in the album. Add a + or
- for inequalities, e.g '5+' for five or more tracks.
--album-art <option> Retrieve additional images after downloading the album:
'default': No additional images
'largest': Download from the folder with the largest image
'most': Download from the folder containing the most images
--album-art-only Only download album art for the provided album
--no-browse-folder Do not automatically browse user shares to get all files in
in the folder
--failed-album-path Path to move all album files to when one of the items from
the directory fails to download. Set to 'delete' to delete
the files instead. Set to 'disable' keep it where it is.
Default: {configured output dir}/failed
-g, --aggregate Aggregate download mode: Find and download all distinct
songs associated with the provided artist, album, or title.
--aggregate-length-tol <tol> Max length tolerance in seconds to consider two tracks or
albums equal. (Default: 3)
--min-shares-aggregate <num> Minimum number of shares of a track or album for it to be
downloaded in aggregate mode. (Default: 2)
--relax-filtering Slightly relax file filtering in aggregate mode to include
more results
也接受兩個和三個單字標誌的首字母縮略詞,例如 --twf。如果選項包含單字“max”,則 m 應為大寫。 「bitrate」、「sameplerate」和「bitdepth」都應被視為兩個單獨的單字,例如 --Mbr 代表 --max-bitrate。
可以透過將標誌設為 false 來明確停用它們,例如“--interactive false”
輸入類型通常是自動決定的。若要強制使用特定的輸入類型,請設定 --input-type [spotify|youtube|csv|string|bandcamp|list]。可使用以下輸入類型:
本機 CSV 檔案的路徑:使用包含要下載歌曲的曲目資訊的 csv 檔案。列的名稱應該是藝術家、標題、專輯、長度,儘管通常也會偵測到其他名稱。僅標題或專輯列是必需的,但額外的資訊可能會提高搜尋結果排名。沒有標題列文字的每一行都將被視為專輯下載。
播放清單 url:從 YouTube 播放清單下載歌曲。檢索播放清單的預設方法並不總是返回所有視頻,尤其是不可用的視頻。要取得所有影片標題,您可以透過提供帶有 --youtube-key 的金鑰來使用官方 API。在這裡獲取它 https://console.cloud.google.com。建立一個新項目,點擊“啟用Api”並蒐索“youtube data”,然後按照提示操作。
播放清單/專輯 URL 或「spotify-likes」:下載 Spotify 播放清單、專輯或您喜歡的歌曲。下載私人播放清單或喜歡的音樂時需要憑證。
在 https://developer.spotify.com/dashboard/applications 上建立一個 Spotify 應用程序,並使用重新導向 URL http://localhost:48721/callback。從建立的應用程式儀表板中取得應用程式 ID 和金鑰。
使用獲得的憑證和授權操作啟動 sldl 以觸發 Spotify 應用程式登入流程:
sldl spotify-likes --spotify-id 123456 --spotify-secret 123456 -n 1 --print-tracks
sldl 會嘗試自動開啟瀏覽器,但會回退到記錄登入流程 URL 以進行輸出。登入流程完成後,sldl 將輸出令牌和刷新令牌並完成目前命令的運行。
要跳過每次使用 sldl 時都需要登入流程,可以向 sldl 提供令牌和刷新令牌(提示:將此資訊儲存在設定檔中以使命令不那麼冗長):
sldl spotify-likes --spotify-id 123456 --spotify-secret 123456 --spotify-refresh 123456 --spotify-token 123456 -n 1 --pt
Spotify-token 訪問的有效期僅為 1 小時。 Spotify-refresh 將使 sldl 能夠在每次執行時更新存取權限(並且可以在不包含 spotify-token 的情況下使用)
bandcamp url:下載單曲、專輯或藝人的整張唱片目錄。提取藝人姓名、專輯名稱並設定 --album-track-count="n+",其中 n 是 bandcamp 頁面上可見曲目的數量。
要搜尋的曲目、專輯或藝術家的名稱:可以是任何典型的搜尋字串(例如您在 Soulseek 搜尋欄中輸入的內容),也可以是逗號分隔的屬性列表,例如 'title=歌曲名稱, Artist=藝術家姓名,長度=215'。
接受以下屬性:
title
artist
album
length (in seconds)
artist-maybe-wrong
album-track-count
輸入範例及其解釋:
Input String | Artist | Title | Album | Length
---------------------------------------------------------------------------------
'Foo Bar' (without any hyphens) | | Foo Bar | |
'Foo - Bar' | Foo | Bar | |
'Foo - Bar' (with --album enabled) | Foo | | Bar |
'Artist - Title, length=42' | Artist | Title | | 42
'artist=AR, title=T, album=AL' | AR | T | AL |
文字檔案的路徑,其中每行具有以下形式:
"some input" "conditions" "preferred conditions"
例如:
"artist=Artist, album=Album" "format=mp3; br > 128" "br >= 320"
其中“某些輸入”是上述任何輸入類型。如果欄位不包含空格,則可以省略引號。條件欄位加入在配置的條件之上,也可以省略。清單輸入必須使用 --input-type=list 手動啟動。
它也接受專輯下載的簡寫: a:"Artist - Album"
。注意, a:
必須出現在引號之外。
預設.為每個輸入條目下載一個檔案。
sldl 將搜尋專輯並下載整個資料夾,包括非音訊檔案。當輸入是指向 Spotify 或 bandcamp 專輯的連結、輸入字串或 csv 行沒有曲目標題或啟用 -a/--album 時啟動。
使用 -g/--aggregate,sldl 對輸入執行普通搜索,然後嘗試將結果分組為不同的歌曲,並從大多數用戶共享的歌曲開始下載每種歌曲。
請注意,--min-shares-aggregate 預設為 2,這表示僅由一個使用者共享的歌曲將被忽略。
當 --album 和 --aggregate 都啟用時啟動。 sldl 將對共享進行分組並下載每個不同專輯的一張,從最多用戶共享的專輯開始。建議將其與 --interactive 配對。
請注意,--min-shares-aggregate 預設為 2,這表示僅由一個使用者共享的相簿將被忽略。
搜尋查詢確定如下:
如果短時間內執行過多搜索,伺服器將禁止您 30 分鐘。該程式有一個搜尋限制器,可以透過 --searches-per-time 和 --searches-renew-time 進行調整(當達到限制時,下載狀態將為「等待」)。預設情況下,它配置為每 220 秒最多允許 34 次搜尋。預設值是透過實驗確定的,因此可能不正確。
以下選項將使搜尋速度更快,但可能會降低搜尋結果品質或導致不穩定:
不符合條件的文件將不會被下載。滿足優先條件的文件將被優先考慮;設定 --pref-format "flac,wav" 將使其下載無損文件(如果可用),並且僅在沒有其他文件的情況下下載有損文件。
沒有預設的必需條件。預設的首選條件是:
pref-format = mp3
pref-length-tol = 3
pref-min-bitrate = 200
pref-max-bitrate = 2500
pref-max-samplerate = 48000
pref-strict-title = true
pref-strict-album = true
pref-accept-no-length = false
因此,sldl 更喜歡位元率在 200 到 2500 kbps 之間的 mp3 文件,並且其長度與提供的長度相差不超過 3 秒。它還會優先選擇其路徑包含所提供的標題和專輯(忽略大小寫,並由邊界字元界定)並且具有非空長度的檔案。不建議更改最後三個首選條件。
請注意,滿足首選條件子集的文件仍優先於不滿足任何條件的文件,但某些條件優先於其他條件。例如,僅滿足嚴格標題(如果啟用)的檔案將始終優先於僅滿足格式條件的檔案。使用 --print "results-full" 運行以顯示排序邏輯。
條件也可以透過 --cond 和 --pref 以分號分隔的字串形式提供,例如 --cond "br >= 320; format = mp3,ogg; sr < 96000"。
選項 --strict-title、--strict-artist 和 --strict-album 將過濾檔案名稱中不包含標題/藝術家/專輯的任何檔案(忽略大小寫,以邊界字元為界)。
防止錯誤下載的另一種方法是將 --length-tol 設為 3 或更少,以使其忽略與輸入相差超過 3 秒的任何歌曲。然而,預設情況下,所有 4 個選項均已啟用為「首選」條件,這意味著無論如何,這些檔案只會作為最後的手段下載。因此,只有當您需要盡可能減少錯誤下載時,或者名稱只有一兩個字元的曲目或專輯等特殊情況時,才建議啟用它們。
根據對等方使用的客戶端,某些資訊可能無法使用。例如,標準的 Soulseek 客戶端不共享檔案位元率。如果(例如)設定了 --min-bitrate,則 sldl 仍將接受任何具有未知位元率的檔案。您可以透過啟用 --strict-conditions 將其配置為拒絕所有已檢查屬性為 null(未知)的檔案。
因此,如果也設定了 --min-bitrate,則使用者與預設客戶端共用的任何檔案都將被忽略。另請注意,由於位元速率和取樣率檢查,預設首選條件已經影響此選項的排名。
{} 中包含的變數將會被對應的檔案標記值取代。名稱格式支援子目錄以及條件表達式,例如 {tag1|tag2} - 如果 tag1 為 null,則使用 tag2。在 null 檢查中,括號中的字串文字將被忽略。
artist First artist (from the file tags)
sartist Source artist (as on CSV/Spotify/YouTube/etc)
artists Artists, joined with '&'
albumartist First album artist
albumartists Album artists, joined with '&'
title Track title
stitle Source track title
album Album name
salbum Source album name
year Track year or date
track Track number
disc Disc number
filename Soulseek filename without extension
foldername Soulseek folder name
extractor Name of the extractor used (CSV/Spotify/YouTube/etc)
default-folder Default sldl folder name (usually the playlist name)
sldl 將在以下位置尋找名為 sldl.conf 的檔案:
~/AppData/Roaming/sldl/sldl.conf
~/.config/sldl/sldl.conf
以及可執行檔的目錄中。
設定檔範例:
username = your-username
password = your-password
pref-format = flac
fast-search = true
以井號標籤 (#) 開頭的行將被忽略。路徑中的波形符號將擴展為使用者目錄。
支援的設定檔:
[lossless]
pref-format = flac,wav
若要啟動上述設定文件,請執行 --profile "lossless"。若要列出所有可用的設定文件,請執行 --profile "help"。
設定檔可以根據幾個簡單的條件自動啟動:
[no-stale]
profile-cond = interactive && download-mode == "album"
max-stale-time = 999999
# album downloads will never be automatically cancelled in interactive mode
[youtube]
profile-cond = input-type == "youtube"
path = ~/downloads/sldl-youtube
# download to another location for youtube
支援在 profile-cond 中使用以下運算子:&&、||、==、!=、!{bool}。
以下變數可用:
input-type ("youtube"|"csv"|"string"|"bandcamp"|"spotify")
download-mode ("normal"|"aggregate"|"album"|"album-aggregate")
interactive (bool)
從 csv 檔案下載曲目:
sldl test.csv
下載 Spotify 讚:
sldl spotify-likes
互動專輯下載:
sldl "Some Album" -a -t
依名稱下載特定歌曲,首選無損:
sldl "MC MENTAL @ HIS BEST, length=242" --pref-format "flac,wav"
下載 Spotify 播放清單中每首歌曲的專輯:
sldl https://spotify/playlist/id -a
檢索已刪除的影片名稱,然後從 YouTube 播放清單下載並回退到 yt-dlp:
sldl https://www.youtube.com/playlist/id --get-deleted --yt-dlp
印製不在您的音樂庫中的藝術家的所有歌曲:
sldl "artist=MC MENTAL" --aggregate --skip-music-dir "path/to/music" --print results-full
下載在 Soulseek 上找到的藝術家的所有專輯:
sldl "artist=MC MENTAL" -a -g -t
建立一個名為wishlist.txt
的文件,並新增一些項目,例如輸入類型:清單中詳細說明:
" Artist - My Favorite Song "
a: " Artist - Some Album, album-track-count=5 " " format=flac "
將設定檔加入sldl.conf
:
[wishlist]
input = ~/sldl/wishlist.txt
input-type = list
index-path = ~/sldl/wishlist-index.sldl
這將建立一個全域索引檔案wishlist-index.sldl
,每次執行 sldl 時都會掃描該檔案以跳過已下載的願望清單項目。如果您想要繼續搜尋直到下載符合首選條件的版本,也可以新增skip-check-pref-cond = true
(請注意,這要求檔案在下載後保留在相同位置)。
最後,使用下列選項設定 cron 作業(或 Windows 上的排程任務)以定期執行 sldl:
sldl --profile wishlist
chmod +x publish.sh && sh publish.sh
。對於intel mac,取消註解x64並註解publish.sh中的arm64部分。--no-progress
。 可以從此儲存庫建置用於運行sldl
的 docker 容器。該鏡像支援linux x86/ARM。
建置並啟動容器:
clone https://github.com/fiso64/slsk-batchdl
cd slsk-batchdl
docker compose up -d
exec
進入容器開始使用sldl
:
docker compose exec sldl sh
sldl --help
compose 堆疊相對於docker-compose.yml
所在位置安裝了兩個目錄,可用於檔案管理:
/config
(位於主機上的./config
將sldl.conf
配置放入此目錄中,然後使用sldl -c /config ...
在容器中使用您的配置/data
(位於主機上的./data
) - 用作下載目錄 IE sldl -p /data ...
如果您在Linux 主機上執行 Docker,則應指定擁有主機上配置和資料目錄的使用者的user:group
權限,以避免 docker 檔案權限問題。這些可以使用環境變數PUID和PGID來指定。
若要取得目前使用者的 UID 和 GID,請從終端機執行以下命令:
id -u
-- 列印 UIDid -g
-- 列印 GID將它們替換為docker-compose.yml
中對應的變數( PUID
PGID
)。
可以使用容器內建的 cron 按計畫執行一個或多個sldl
指令。
若要建立計劃,請在主機./config/crontabs/abc
上建立新文件,並將其與標準 crontab 語法一起使用。
確保在對 cron 檔案進行任何更改後重新啟動容器。
範例=>每週日凌晨 1 點運行sldl
,從指定的 Spotify 播放清單中搜尋遺失的曲目
# min hour day month weekday command
0 1 * * 0 sldl https://open.spotify.com/playlist/6sf1WR5grXGJ6dET -c /config -p /data --skip-existing --m3u-path /data/index.sldl"
crontab.guru 可用來幫助調度表達式。