mirror of
https://github.com/fiso64/slsk-batchdl.git
synced 2024-12-22 14:32:40 +00:00
update help and readme
This commit is contained in:
parent
2952b89042
commit
ff7762cdce
3 changed files with 56 additions and 50 deletions
30
README.md
30
README.md
|
@ -125,10 +125,10 @@ Usage: sldl <input> [OPTIONS]
|
|||
```
|
||||
```
|
||||
Spotify
|
||||
--spotify-id <id> spotify client ID
|
||||
--spotify-secret <secret> spotify client secret
|
||||
--spotify-token <token> spotify access token
|
||||
--spotify-refresh <token> spotify refresh token
|
||||
--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
|
||||
```
|
||||
```
|
||||
|
@ -247,24 +247,28 @@ Tip: For playlists containing music videos, it may be better to remove all text
|
|||
A playlist/album url or 'spotify-likes': Download a spotify playlist, album, or your
|
||||
liked songs. Credentials are required when downloading a private playlist or liked music.
|
||||
|
||||
#### Using Credential/Application
|
||||
#### Using Credentials
|
||||
|
||||
Create a [Spotify application](https://developer.spotify.com/dashboard/applications) with a redirect url of `http://localhost:48721/callback`. Obtain an application **ID** and **Secret** from the created application dashboard.
|
||||
<details>
|
||||
<summary>Click to expand</summary>
|
||||
|
||||
Create a Spotify application at https://developer.spotify.com/dashboard/applications with a redirect url http://localhost:48721/callback. Obtain an application ID and secret from the created application dashboard.
|
||||
|
||||
Start sldl with the obtained credentials and an authorized action to trigger the Spotify app login flow:
|
||||
|
||||
```shell
|
||||
sldl spotify-likes --number 1 --spotify-id 123456 --spotify-secret 123456 ...
|
||||
```
|
||||
sldl will try to open a browser automatically but will fallback to logging the login flow URL to output. After login flow is complete sldl will output a **Token** and **Refresh Token** and finish running the current command.
|
||||
sldl spotify-likes --spotify-id 123456 --spotify-secret 123456 -n 1 --print-tracks
|
||||
```
|
||||
sldl will try to open a browser automatically but will fallback to logging the login flow URL to output. After login flow is complete sldl will output a token and refresh token and finish running the current command.
|
||||
|
||||
To skip requiring login flow every time `sldl` is used the **Token** and **Refresh Token** can be provided to sldl (hint: use `--config` and store this info in the config file to make commands less verbose):
|
||||
To skip requiring login flow every time sldl is used the token and refresh token can be provided to sldl (hint: store this info in the config file to make commands less verbose):
|
||||
|
||||
```shell
|
||||
sldl spotify-likes --number 1 --spotify-id 123456 --spotify-secret 123456 --spotify-refresh 123456 --spotify-token 123456 ...
|
||||
```
|
||||
sldl spotify-likes --spotify-id 123456 --spotify-secret 123456 --spotify-refresh 123456 --spotify-token 123456 -n 1 --pt
|
||||
```
|
||||
|
||||
`spotify-token` access is only valid for 1 hour. `spotify-refresh` will enable sldl to renew access every time it is run (and can be used without including `spotify-token`)
|
||||
spotify-token access is only valid for 1 hour. spotify-refresh will enable sldl to renew access every time it is run (and can be used without including spotify-token)
|
||||
</details>
|
||||
|
||||
### Bandcamp
|
||||
A bandcamp url: Download a single track, an album, or an artist's entire discography.
|
||||
|
|
|
@ -29,22 +29,10 @@ namespace Extractors
|
|||
bool needLogin = Config.input == "spotify-likes" || Config.removeTracksFromSource;
|
||||
var tle = new TrackListEntry();
|
||||
|
||||
static void readSpotifyCreds()
|
||||
{
|
||||
Console.Write("Spotify client ID:");
|
||||
Config.spotifyId = Console.ReadLine();
|
||||
Console.Write("Spotify client secret:");
|
||||
Config.spotifySecret = Console.ReadLine();
|
||||
Console.Write("Spotify token:");
|
||||
Config.spotifyToken = Console.ReadLine();
|
||||
Console.Write("Spotify refresh token:");
|
||||
Config.spotifyRefresh = Console.ReadLine();
|
||||
Console.WriteLine();
|
||||
}
|
||||
|
||||
if (needLogin && Config.spotifyToken.Length == 0 && (Config.spotifyId.Length == 0 || Config.spotifySecret.Length == 0))
|
||||
{
|
||||
readSpotifyCreds();
|
||||
Console.WriteLine("Error: Credentials are required when downloading liked music or removing from source playlists.");
|
||||
Environment.Exit(0);
|
||||
}
|
||||
|
||||
spotifyClient = new Spotify(Config.spotifyId, Config.spotifySecret, Config.spotifyToken, Config.spotifyRefresh);
|
||||
|
@ -73,7 +61,8 @@ namespace Extractors
|
|||
else if (Config.input.Contains("/artist/"))
|
||||
{
|
||||
Console.WriteLine("Loading spotify artist");
|
||||
throw new NotImplementedException("Spotify artist download currently not supported.");
|
||||
Console.WriteLine("Error: Spotify artist download currently not supported.");
|
||||
Environment.Exit(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -93,20 +82,9 @@ namespace Extractors
|
|||
}
|
||||
else if (!needLogin)
|
||||
{
|
||||
Console.WriteLine("Spotify playlist not found. It may be set to private. Login? [Y/n]");
|
||||
if (Console.ReadLine()?.ToLower().Trim() == "y")
|
||||
{
|
||||
readSpotifyCreds();
|
||||
spotifyClient = new Spotify(Config.spotifyId, Config.spotifySecret);
|
||||
await spotifyClient.Authorize(true, Config.removeTracksFromSource);
|
||||
Console.WriteLine("Loading Spotify playlist");
|
||||
(playlistName, playlistUri, tracks) = await spotifyClient.GetPlaylist(Config.input, max, off);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Spotify playlist not found (it may be set to private, but no credentials have been provided).");
|
||||
Environment.Exit(0);
|
||||
}
|
||||
}
|
||||
else throw;
|
||||
}
|
||||
|
||||
|
@ -279,9 +257,11 @@ namespace Extractors
|
|||
)
|
||||
);
|
||||
|
||||
Console.WriteLine("Spotify token: " + tokenResponse.AccessToken);
|
||||
Console.WriteLine("spotify-token=" + tokenResponse.AccessToken);
|
||||
_clientToken = tokenResponse.AccessToken;
|
||||
Console.WriteLine("Spotify refresh token: " + tokenResponse.RefreshToken);
|
||||
Console.WriteLine();
|
||||
Console.WriteLine("spotify-refresh=" + tokenResponse.RefreshToken);
|
||||
Console.WriteLine();
|
||||
_clientRefreshToken = tokenResponse.RefreshToken;
|
||||
|
||||
_client = new SpotifyClient(tokenResponse.AccessToken);
|
||||
|
|
|
@ -102,8 +102,10 @@ public static class Help
|
|||
See --help ""search"". (default: 220)
|
||||
|
||||
Spotify
|
||||
--spotify-id <id> spotify client ID
|
||||
--spotify-secret <secret> spotify client secret
|
||||
--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
|
||||
|
@ -219,6 +221,26 @@ public static class Help
|
|||
The id and secret can be obtained at https://developer.spotify.com/dashboard/applications.
|
||||
Create an app and add http://localhost:48721/callback as a redirect url in its settings.
|
||||
|
||||
Using Credentials
|
||||
Create a Spotify application at https://developer.spotify.com/dashboard/applications with a
|
||||
redirect url http://localhost:48721/callback. Obtain an application ID and secret from the
|
||||
created application dashboard.
|
||||
Start sldl with the obtained credentials and an authorized action to trigger the Spotify
|
||||
app login flow:
|
||||
|
||||
sldl spotify-likes --spotify-id 123456 --spotify-secret 123456 -n 1 --print-tracks
|
||||
|
||||
sldl will try to open a browser automatically but will fallback to logging the login flow
|
||||
URL to output. After login flow is complete sldl will output a token and refresh token and
|
||||
finish running the current command.
|
||||
To skip requiring login flow every time sldl is used the token and refresh token can be
|
||||
provided to sldl (hint: store this info in the config file to make commands less verbose):
|
||||
|
||||
sldl spotify-likes --spotify-id 123456 --spotify-secret 123456 --spotify-refresh 123456 --spotify-token 123456 -n 1 --pt
|
||||
|
||||
spotify-token access is only valid for 1 hour. spotify-refresh will enable sldl to renew
|
||||
access every time it is run (and can be used without including spotify-token).
|
||||
|
||||
Bandcamp
|
||||
A bandcamp url: Download a single track, an album, or an artist's entire discography.
|
||||
Extracts the artist name, album name and sets --album-track-count=""n+"", where n is the
|
||||
|
|
Loading…
Reference in a new issue