mirror of
https://github.com/fiso64/slsk-batchdl.git
synced 2024-12-22 06:22:41 +00:00
implement select individual files in interactive mode
This commit is contained in:
parent
82df27d40a
commit
7689745d48
2 changed files with 17 additions and 4 deletions
|
@ -906,7 +906,7 @@ static partial class Program
|
|||
WriteLine($" [Up/p] | [Down/n] | [Enter] | [q] {retrieveAll1}| [Esc/s]", ConsoleColor.Green);
|
||||
WriteLine($" Prev | Next | Accept | Accept & Quit Interactive {retrieveAll2}| Skip", ConsoleColor.Green);
|
||||
Console.WriteLine();
|
||||
WriteLine($" d:1,2,3 to download individual files", ConsoleColor.Green);
|
||||
WriteLine($" d:1,2,3 or d:start:end to download individual files", ConsoleColor.Green);
|
||||
Console.WriteLine();
|
||||
}
|
||||
|
||||
|
@ -970,8 +970,21 @@ static partial class Program
|
|||
if (options.Length == 0)
|
||||
return (aidx, tracks, true);
|
||||
try
|
||||
{
|
||||
var indices = options.Split(',').Select(int.Parse).ToArray();
|
||||
{
|
||||
var indices = options.Split(',')
|
||||
.SelectMany(option =>
|
||||
{
|
||||
if (option.Contains(':'))
|
||||
{
|
||||
var parts = option.Split(':');
|
||||
int start = string.IsNullOrEmpty(parts[0]) ? 1 : int.Parse(parts[0]);
|
||||
int end = string.IsNullOrEmpty(parts[1]) ? tracks.Count : int.Parse(parts[1]);
|
||||
return Enumerable.Range(start, end - start + 1);
|
||||
}
|
||||
return new[] { int.Parse(option) };
|
||||
})
|
||||
.Distinct()
|
||||
.ToArray();
|
||||
return (aidx, indices.Select(i => tracks[i - 1]).ToList(), false);
|
||||
}
|
||||
catch
|
||||
|
|
|
@ -66,7 +66,7 @@ public static class Printing
|
|||
if (indices)
|
||||
{
|
||||
Console.ForegroundColor = ConsoleColor.DarkGray;
|
||||
Console.Write($"[{i + 1:D2}]");
|
||||
Console.Write($" [{i + 1:D2}]");
|
||||
Console.ResetColor();
|
||||
}
|
||||
if (ancestor.Length == 0)
|
||||
|
|
Loading…
Reference in a new issue