mirror of
https://github.com/fiso64/slsk-batchdl.git
synced 2024-12-22 06:22:41 +00:00
.conf file support
This commit is contained in:
parent
d4f728ba20
commit
fa126ee33f
3 changed files with 21 additions and 4 deletions
|
@ -82,6 +82,13 @@ Download youtube playlist:
|
|||
```
|
||||
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.
|
||||
|
||||
Supports .conf files: Create a file named `slsk-batchdl.conf` in the same directory as the exe and write your arguments there, e.g:
|
||||
```
|
||||
--username "fakename"
|
||||
--password "fakepass"
|
||||
--pref-format "flac"
|
||||
```
|
||||
|
||||
## Notes:
|
||||
- YouTube playlist downloading is unreliable since there are no track name / artist tags
|
||||
- The CSV file must be saved with `,` as field delimiter and `"` as string delimiter, encoded with UTF8
|
||||
|
|
|
@ -4,7 +4,6 @@ using Soulseek;
|
|||
using Konsole;
|
||||
using System.Net.NetworkInformation;
|
||||
|
||||
|
||||
class Program
|
||||
{
|
||||
static SoulseekClient client = new SoulseekClient();
|
||||
|
@ -52,7 +51,7 @@ class Program
|
|||
Console.WriteLine(" --yt-parse Enable if you have a csv file of YouTube video titles and channel names; attempt to parse.");
|
||||
Console.WriteLine();
|
||||
Console.WriteLine(" -s --single <str> Search & download a specific track");
|
||||
Console.WriteLine(" -a --album <str> Search & download a specific album. DOES NOTHING");
|
||||
Console.WriteLine(" -a --album <str> Does nothing");
|
||||
Console.WriteLine();
|
||||
Console.WriteLine(" --pref-format <format> Preferred file format (default: mp3)");
|
||||
Console.WriteLine(" --pref-length-tol <tol> Preferred length tolerance (if length col provided) (default: 3)");
|
||||
|
@ -163,6 +162,16 @@ class Program
|
|||
MaxSampleRate = -1,
|
||||
};
|
||||
|
||||
string confPath = Path.Combine(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), "slsk-batchdl.conf");
|
||||
if (System.IO.File.Exists(confPath))
|
||||
{
|
||||
string confArgs = System.IO.File.ReadAllText(confPath);
|
||||
List<string> finalArgs = new List<string>();
|
||||
finalArgs.AddRange(ParseCommand(confArgs));
|
||||
finalArgs.AddRange(args);
|
||||
args = finalArgs.ToArray();
|
||||
}
|
||||
|
||||
for (int i = 0; i < args.Length; i++)
|
||||
{
|
||||
switch (args[i])
|
||||
|
@ -560,6 +569,8 @@ class Program
|
|||
if (reverse)
|
||||
tracks.Reverse();
|
||||
|
||||
if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password))
|
||||
throw new Exception("No soulseek username or password");
|
||||
await client.ConnectAsync(username, password);
|
||||
|
||||
object lockObj = new object();
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
{
|
||||
"profiles": {
|
||||
"slsk-batchdl": {
|
||||
"commandName": "Project",
|
||||
"commandLineArgs": "-s \"nanoray mimicloq\""
|
||||
"commandName": "Project"
|
||||
},
|
||||
"YouTube": {
|
||||
"commandName": "Project",
|
||||
|
|
Loading…
Reference in a new issue