mirror of
https://github.com/fiso64/slsk-batchdl.git
synced 2024-12-22 14:32:40 +00:00
commit message
This commit is contained in:
parent
579e94d87e
commit
66e1b797be
4 changed files with 837 additions and 393 deletions
178
README.md
178
README.md
|
@ -1,68 +1,108 @@
|
|||
# slsk-batchdl
|
||||
|
||||
A batch downloader for Soulseek using Soulseek.NET. Accepts CSV files, Spotify & YouTube urls.
|
||||
A batch downloader for Soulseek using Soulseek.NET. Accepts CSV files and Spotify or YouTube urls.
|
||||
|
||||
- Download tracks from a csv file:
|
||||
```
|
||||
slsk-batchdl --csv test.csv --artist-col "Artist Name(s)" --track-col "Track Name" --length-col "Duration (ms)" --time-unit ms
|
||||
slsk-batchdl -i test.csv
|
||||
```
|
||||
You can omit the column names if they are named predictably (like in this example). Use `--print-tracks` before downloading to check if everything has been parsed correctly.
|
||||
Use `--print tracks` before downloading to check if everything has been parsed correctly. The names of the columns should be: Artist, Title, Album, Length. Only the title column is required, but any additional info improves search.
|
||||
|
||||
- Download spotify likes while skipping existing songs, and create an m3u file:
|
||||
- Download spotify likes while skipping existing songs and create an m3u file:
|
||||
```
|
||||
slsk-batchdl --spotify likes --m3u --skip-existing
|
||||
slsk-batchdl -i spotify-likes --m3u --skip-existing
|
||||
```
|
||||
You might need to provide an id and secret when using spotify (e.g when downloading a private playlist), which you can get here https://developer.spotify.com/dashboard/applications. Create an app, then select it and add `http://localhost:48721/callback` as a redirect url in the settings.
|
||||
|
||||
- Download the first 10 songs of a youtube playlist:
|
||||
```
|
||||
slsk-batchdl -n 10 --youtube "https://www.youtube.com/playlist?list=PLI_eFW8NAFzYAXZ5DrU6E6mQ_XfhaLBUX"
|
||||
slsk-batchdl -n 10 -i "https://www.youtube.com/playlist?list=PLI_eFW8NAFzYAXZ5DrU6E6mQ_XfhaLBUX"
|
||||
```
|
||||
To include unavailable videos, you will need to provide an api key with `--youtube-key`. Get it here https://console.cloud.google.com. Create a new project, click "Enable Api" and search for "youtube data", then follow the prompts.
|
||||
|
||||
- Search & download a specific song, preferring flac and wav files:
|
||||
- Search & download a specific song, preferring high quality:
|
||||
```
|
||||
slsk-batchdl "title=MC MENTAL @ HIS BEST,duration=242" --pref-format "flac,wav"
|
||||
slsk-batchdl -i "title=MC MENTAL @ HIS BEST,length=242" --pref-format "flac,wav"
|
||||
```
|
||||
|
||||
- Find music by an artist which isn't in your library:
|
||||
```
|
||||
slsk-batchdl -i "artist=MC MENTAL" -a --print tracks --skip-existing --music-dir "path\to\music"
|
||||
```
|
||||
|
||||
### Options:
|
||||
```
|
||||
Usage: slsk-batchdl [OPTIONS]
|
||||
Usage: slsk-batchdl -i <input> [OPTIONS]
|
||||
|
||||
-i --input <input> <input> is one of the following:
|
||||
|
||||
Spotify playlist url or "spotify-likes": Download a spotify
|
||||
playlist or your liked songs. --spotify-id and
|
||||
--spotify-secret may be required in addition.
|
||||
|
||||
Youtube playlist url: Download songs from a youtube playlist.
|
||||
Provide a --youtube-key to include unavailabe uploads.
|
||||
|
||||
Path to a local CSV file: Use a csv file containing track
|
||||
info to download. The names of the columns should be Artist,
|
||||
Title, Album, Length. Only the title column is required, but
|
||||
any extra info improves search results.
|
||||
|
||||
Search string for the track, album, or artist to search for:
|
||||
Can either be any typical search text like "{artist} - {title}"
|
||||
or a comma-separated list like
|
||||
"title=Song Name,artist=Artist Name,length=215". Allowed
|
||||
properties are; title, artist, album, length (in seconds).
|
||||
|
||||
Options:
|
||||
--user <username> Soulseek username
|
||||
--pass <password> Soulseek password
|
||||
|
||||
--spotify <url> Download a spotify playlist ("likes" for liked music)
|
||||
--spotify-id <id> Your spotify client id (required for private playlists)
|
||||
--spotify-secret <sec> Your spotify client secret (required for private playlists)
|
||||
--spotify Input is a spotify url (override automatic parsing)
|
||||
--spotify-id <id> spotify client ID (required for private playlists)
|
||||
--spotify-secret <secret> spotify client secret (required for private playlists)
|
||||
|
||||
--youtube <url> Get tracks from a YouTube playlist
|
||||
--youtube-key <key> Provide an API key to include unavailable uploads
|
||||
--youtube Input is a youtube url (override automatic parsing)
|
||||
--youtube-key <key> Youtube data API key
|
||||
|
||||
--csv <path> Use a csv file containing track info to download
|
||||
--artist-col <column> Artist or uploader column name
|
||||
--title-col <column> Title or track name column name
|
||||
--album-col <column> Track album column name (optional for more results)
|
||||
--length-col <column> Track duration column name (optional for better accuracy)
|
||||
--time-unit <unit> Time unit in track duration column, ms or s (default: s)
|
||||
--yt-desc-col <column> YT description column name (optional, use with --yt-parse)
|
||||
--yt-id-col <column> Youtube video ID column (optional, use with --yt-parse)
|
||||
--yt-parse Enable if you have a csv file of YouTube video titles and
|
||||
channel names; attempt to parse them into title and artist
|
||||
--csv Input is a path to a local CSV (override automatic parsing)
|
||||
--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 file contains YouTube video titles and
|
||||
channel names; attempt to parse them into proper title and
|
||||
artist. If the the csv contains an "ID", "URL", or
|
||||
"Description" column then they will be used for parsing too
|
||||
|
||||
-s --single <str> Search & download a specific track. <str> is a simple
|
||||
search string, or a comma-separated list of properties:
|
||||
"title=Song Name,artist=Artist Name,length=215"
|
||||
--string Input is a search string (override automatic parsing)
|
||||
-a --aggregate Instead of downloading a single track matching the search
|
||||
string, find and download all distinct songs associated with
|
||||
the provided artist, album, or track title. Search string must
|
||||
be a list of properties.
|
||||
--min-users-aggregate <num> Minimum number of users sharing a track before it is
|
||||
downloaded in aggregate mode. Setting it to 2 or more will
|
||||
significantly reduce false positives, but may introduce false
|
||||
negatives. Default: 1
|
||||
|
||||
-p --path <path> Place downloaded files in custom path
|
||||
-f --folder <name> Custom folder name (default: provided playlist name)
|
||||
-n --number <maxtracks> Download at most n tracks of a playlist
|
||||
-p --path <path> Download folder
|
||||
-f --folder <name> Subfolder name (default: playlist/csv name)
|
||||
-n --number <maxtracks> Download the first n tracks of a playlist
|
||||
-o --offset <offset> Skip a specified number of tracks
|
||||
--reverse Download tracks in reverse order
|
||||
--remove-from-playlist Remove downloaded tracks from playlist (spotify only)
|
||||
--remove-from-playlist Remove downloaded tracks from playlist (for spotify only)
|
||||
--name-format <format> Name format for downloaded tracks, e.g "{artist} - {title}"
|
||||
--m3u Create an m3u8 playlist file
|
||||
|
||||
--format <format> Accepted file format(s), comma-separated
|
||||
--length-tol <tol> Length tolerance in seconds (default: 3)
|
||||
--min-bitrate <rate> Minimum file bitrate
|
||||
--max-bitrate <rate> Maximum file bitrate
|
||||
--max-samplerate <rate> Maximum file sample rate
|
||||
--strict-title Only download if filename contains track title
|
||||
--strict-artist Only download if filepath contains track artist
|
||||
--banned-users <list> Comma-separated list of users to ignore
|
||||
--danger-words <list> Comma-separated list of words that must appear in either
|
||||
both search result and track title or in neither of the
|
||||
two. Case-insensitive. (default:"mix, edit, dj, cover")
|
||||
--pref-format <format> Preferred file format(s), comma-separated (default: mp3)
|
||||
--pref-length-tol <tol> Preferred length tolerance in seconds (default: 3)
|
||||
--pref-min-bitrate <rate> Preferred minimum bitrate (default: 200)
|
||||
|
@ -70,59 +110,54 @@ Options:
|
|||
--pref-max-samplerate <rate> Preferred maximum sample rate (default: 96000)
|
||||
--pref-strict-title Prefer download if filename contains track title
|
||||
--pref-strict-artist Prefer download if filepath contains track artist
|
||||
--pref-danger-words <list> Comma-separated list of words that must appear in either
|
||||
both search result and track title, or in neither of the
|
||||
two, case-insensitive (default:"mix, edit, dj, cover")
|
||||
--nec-format <format> Necessary file format(s), comma-separated
|
||||
--nec-length-tol <tol> Necessary length tolerance in seconds (default: 3)
|
||||
--nec-min-bitrate <rate> Necessary minimum bitrate
|
||||
--nec-max-bitrate <rate> Necessary maximum bitrate
|
||||
--nec-max-samplerate <rate> Necessary maximum sample rate
|
||||
--nec-strict-title Only download if filename contains track title
|
||||
--nec-strict-artist Only download if filepath contains track artist
|
||||
--nec-danger-words <list> Comma-separated list of words that must appear in either
|
||||
both search result and track title, or in neither of the
|
||||
two. Case-insensitive. (default:"mix, edit, dj, cover")
|
||||
--pref-banned-users <list> Comma-separated list of users to deprioritize
|
||||
--pref-danger-words <list> Comma-separated list of words that should appear in either
|
||||
both search result and track title or in neither of the
|
||||
two.
|
||||
|
||||
--skip-existing Skip if a track matching nec. conditions is found in the
|
||||
-s --skip-existing Skip if a track matching file conditions is found in the
|
||||
output folder or your music library (if provided)
|
||||
--skip-mode <mode> "name": Use only filenames to check if a track exists
|
||||
"name-precise": Use filenames and check nec-cond (default)
|
||||
"tag": Use tags (slower)
|
||||
"tag-precise": Use tags and check all nec. cond. (slower)
|
||||
--skip-mode <mode> name: Use only filenames to check if a track exists
|
||||
name-precise (default): Use filenames and check conditions
|
||||
tag: Use file tags (slower)
|
||||
tag-precise: Use file tags and check file conditions
|
||||
--music-dir <path> Specify to skip downloading tracks found in a music library
|
||||
Use with --skip-existing
|
||||
--skip-not-found Skip searching for tracks that weren't found on Soulseek
|
||||
last run
|
||||
during the last run.
|
||||
--remove-ft Remove "ft." or "feat." and everything after from the
|
||||
track names before searching.
|
||||
--album-search Also search for album name before filtering for track name.
|
||||
Sometimes helps to find more, but slower.
|
||||
--artist-search Also search for artist, before filtering for track name.
|
||||
Sometimes helps to find more, but slower.
|
||||
--no-artist-search Also perform a search without artist name if nothing was
|
||||
found. Only use if the source is imprecise
|
||||
and the provided "artist" is possibly wrong (yt, sc)
|
||||
--no-regex-search <reg> Also perform a search with a regex pattern removed from the
|
||||
titles and artist names
|
||||
--remove-brackets Remove text in square brackets from track names before
|
||||
searching.
|
||||
--no-artist-search Perform a search without artist name if nothing was
|
||||
found. Only use for sources such as youtube or soundcloud
|
||||
where the "artist" could just be an uploader.
|
||||
--artist-search Also try to find track by searching for the artist only
|
||||
--no-regex-search <reg> Also perform a search without a regex pattern
|
||||
--no-diacr-search Also perform a search without diacritics
|
||||
-d --desperate Equivalent to enabling all additional searches
|
||||
-d --desperate Equivalent to enabling all additional searches. Slower.
|
||||
--yt-dlp Use yt-dlp to download tracks that weren't found on
|
||||
Soulseek. yt-dlp must be available from the command line.
|
||||
|
||||
--search-timeout <ms> Maximal search time (ms, default: 6000)
|
||||
--max-stale-time <ms> Maximal download time with no progress (ms, default: 50000)
|
||||
--config <path> Specify config file location
|
||||
--search-timeout <ms> Max search time in ms (default: 6000)
|
||||
--max-stale-time <ms> Max download time without progress in ms (default: 50000)
|
||||
--concurrent-processes <num> Max concurrent searches & downloads (default: 2)
|
||||
--display <str> "single" (default): Show transfer state and percentage.
|
||||
"double": Also show a progress bar. "simple": simple
|
||||
--display <option> Changes how searches and downloads are displayed.
|
||||
single (default): Show transfer state and percentage.
|
||||
double: Also show a progress bar.
|
||||
simple: No download bar
|
||||
|
||||
--print-tracks Do not search, only print all tracks to be downloaded
|
||||
--print-results Do not download, print search results satisfying nec. cond.
|
||||
--print-results-full Do not download, print all search results with full path
|
||||
--print <option> Only print tracks or 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
|
||||
```
|
||||
Files satisfying `pref-` conditions will be preferred. Files not satisfying `nec-` conditions will not be downloaded. For example, `--nec-length-tol` is set to 3 by default, which means that files whose duration differs from the supplied duration by more than 3 seconds will not be downloaded. Increase it to download e.g a youtube playlist of music videos with intros/outros, or disable it entirely by setting it to 99999.
|
||||
Files not satisfying the conditions will not be downloaded. For example, `--length-tol` is set to 3 by default, meaning that files whose duration differs from the supplied duration by more than 3 seconds will not be downloaded (disable it by setting it to 99999).
|
||||
Files satisfying `pref-` conditions will be preferred. For example, setting `--pref-format "flac,wav"` will make it to download high quality files if they exist, while not preventing low quality files from being downloaded.
|
||||
|
||||
Supports .conf files: Create a file named `slsk-batchdl.conf` in the same directory as the exe and write your arguments there, e.g:
|
||||
Supports .conf files: Create a file named `slsk-batchdl.conf` in the same directory as the executable and write your arguments there, e.g:
|
||||
```
|
||||
--username "fakename"
|
||||
--password "fakepass"
|
||||
|
@ -130,6 +165,5 @@ Supports .conf files: Create a file named `slsk-batchdl.conf` in the same direct
|
|||
```
|
||||
|
||||
### Notes:
|
||||
- The CSV file must be saved with `,` as field delimiter and `"` as string delimiter, encoded with UTF8
|
||||
- `--display single` and especially `double` can cause the printed lines to be duplicated or overwritten on some configurations. Use `simple` if that's an issue. In my testing on Windows, the terminal app seems to be affected by this (unlike the old command prompt).
|
||||
- Why didn't I just use Python?
|
||||
- The CSV file must use `"` as string delimiter and be encoded with UTF8
|
||||
- `--display single` and especially `double` can cause the printed lines to be duplicated or overwritten on some configurations. Use `simple` if that's an issue.
|
||||
|
|
25
publish.bat
Normal file
25
publish.bat
Normal file
|
@ -0,0 +1,25 @@
|
|||
@echo off
|
||||
setlocal
|
||||
|
||||
if not exist slsk-batchdl\bin\zips mkdir slsk-batchdl\bin\zips
|
||||
|
||||
REM win-x86
|
||||
dotnet publish -c Release -r win-x86 -p:PublishSingleFile=true -p:DefineConstants=WINDOWS --self-contained false
|
||||
if exist slsk-batchdl\bin\Release\net6.0\win-x86\publish\*.pdb del /F /Q slsk-batchdl\bin\Release\net6.0\win-x86\publish\*.pdb
|
||||
if exist slsk-batchdl\bin\zips\slsk-batchdl_win-x86.zip del /F /Q slsk-batchdl\bin\zips\slsk-batchdl_win-x86.zip
|
||||
powershell.exe -nologo -noprofile -command "& { Add-Type -A 'System.IO.Compression.FileSystem'; [IO.Compression.ZipFile]::CreateFromDirectory('slsk-batchdl\bin\Release\net6.0\win-x86\publish', 'slsk-batchdl\bin\zips\slsk-batchdl_win-x86.zip'); }"
|
||||
|
||||
REM win-x86 self-contained
|
||||
dotnet publish -c Release -r win-x86 -p:PublishSingleFile=true -p:PublishTrimmed=true -p:DefineConstants=WINDOWS --self-contained true
|
||||
if exist slsk-batchdl\bin\Release\net6.0\win-x86\publish\*.pdb del /F /Q slsk-batchdl\bin\Release\net6.0\win-x86\publish\*.pdb
|
||||
if exist slsk-batchdl\bin\zips\slsk-batchdl_win-x86_self-contained.zip del /F /Q slsk-batchdl\bin\zips\slsk-batchdl_win-x86_self-contained.zip
|
||||
powershell.exe -nologo -noprofile -command "& { Add-Type -A 'System.IO.Compression.FileSystem'; [IO.Compression.ZipFile]::CreateFromDirectory('slsk-batchdl\bin\Release\net6.0\win-x86\publish', 'slsk-batchdl\bin\zips\slsk-batchdl_win-x86_self-contained.zip'); }"
|
||||
|
||||
REM linux-x64
|
||||
dotnet publish -c Release -r linux-x64 -p:PublishSingleFile=true -p:PublishTrimmed=true --self-contained true
|
||||
if exist slsk-batchdl\bin\Release\net6.0\linux-x64\publish\*.pdb del /F /Q slsk-batchdl\bin\Release\net6.0\linux-x64\publish\*.pdb
|
||||
if exist slsk-batchdl\bin\zips\slsk-batchdl_linux-x64.zip del /F /Q slsk-batchdl\bin\zips\slsk-batchdl_linux-x64.zip
|
||||
powershell.exe -nologo -noprofile -command "& { Add-Type -A 'System.IO.Compression.FileSystem'; [IO.Compression.ZipFile]::CreateFromDirectory('slsk-batchdl\bin\Release\net6.0\linux-x64\publish', 'slsk-batchdl\bin\zips\slsk-batchdl_linux-x64.zip'); }"
|
||||
|
||||
|
||||
endlocal
|
File diff suppressed because it is too large
Load diff
|
@ -8,13 +8,11 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<DefineConstants>$(DefineConstants)TRACE;</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<DefineConstants>$(DefineConstants);TRACE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'" />
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="Test.cs" />
|
||||
</ItemGroup>
|
||||
|
|
Loading…
Reference in a new issue