mirror of
https://github.com/fiso64/slsk-batchdl.git
synced 2024-12-22 14:32:40 +00:00
commit
This commit is contained in:
parent
6e7b8d5d67
commit
f8c5ed23da
6 changed files with 50 additions and 40 deletions
19
README.md
19
README.md
|
@ -199,8 +199,8 @@ Usage: sldl <input> [OPTIONS]
|
|||
Aggregate Download
|
||||
-g, --aggregate Aggregate download mode: Find and download all distinct
|
||||
songs associated with the provided artist, album, or title.
|
||||
--min-users-aggregate <num> Minimum number of users sharing a track or album for it to
|
||||
be downloaded in aggregate mode. (Default: 2)
|
||||
--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
|
||||
```
|
||||
|
@ -288,15 +288,14 @@ Input String | Artist | Title | Album | Lengt
|
|||
string or csv row has no track title, or when -a/--album is enabled.
|
||||
|
||||
### Aggregate
|
||||
With -g/--aggregate, sldl will first perform an ordinary search for the input, then
|
||||
attempt to group the results into distinct songs and download one of each kind. A common use
|
||||
case is finding all remixes of a song or printing all songs by an artist that are not your
|
||||
music dir.
|
||||
With -g/--aggregate, sldl will first perform an ordinary search for the input, then attempt to
|
||||
group the results into distinct songs and download one of each kind. A common use case is
|
||||
finding all remixes of a song or printing all songs by an artist that are not your music dir.
|
||||
Two files are considered equal if their inferred track title and artist name are equal
|
||||
(ignoring case and some special characters), and their lengths are within --length-tol of each
|
||||
other.
|
||||
Note that this mode is not 100% reliable, which is why --min-users-aggregate is set to 2 by default,
|
||||
i.e. any song that is shared by only one peer will be ignored. Enable --relax-filtering to
|
||||
Note that this mode is not 100% reliable, which is why --min-shares-aggregate is set to 2 by
|
||||
default, i.e. any song that is shared only once will be ignored. Enable --relax-filtering to
|
||||
make the file filtering less aggressive.
|
||||
|
||||
### Album Aggregate
|
||||
|
@ -306,8 +305,8 @@ Input String | Artist | Title | Album | Lengt
|
|||
other (or within 3 seconds if length-tol is not configured). If both folders have exactly one
|
||||
audio file with similar lengths, also checks if the inferred title and artist name coincide.
|
||||
More reliable than normal aggregate due to much simpler grouping logic.
|
||||
Note that --min-users-aggregate is 2 by default, which means that folders shared by only one
|
||||
peer are ignored.
|
||||
Note that --min-shares-aggregate is 2 by default, which means that folders shared only once
|
||||
will be ignored.
|
||||
|
||||
|
||||
## Searching
|
||||
|
|
|
@ -80,7 +80,7 @@ static class Config
|
|||
public static int minAlbumTrackCount = -1;
|
||||
public static int maxAlbumTrackCount = -1;
|
||||
public static int fastSearchDelay = 300;
|
||||
public static int minUsersAggregate = 2;
|
||||
public static int minSharesAggregate = 2;
|
||||
public static int maxTracks = int.MaxValue;
|
||||
public static int offset = 0;
|
||||
public static int maxStaleTime = 50000;
|
||||
|
@ -625,9 +625,9 @@ static class Config
|
|||
case "--aggregate":
|
||||
setFlag(ref aggregate, ref i);
|
||||
break;
|
||||
case "--mua":
|
||||
case "--min-users-aggregate":
|
||||
minUsersAggregate = int.Parse(args[++i]);
|
||||
case "--msa":
|
||||
case "--min-shares-aggregate":
|
||||
minSharesAggregate = int.Parse(args[++i]);
|
||||
break;
|
||||
case "--rf":
|
||||
case "--relax":
|
||||
|
|
|
@ -25,6 +25,7 @@ namespace Data
|
|||
|
||||
public bool OutputsDirectory => Type != TrackType.Normal;
|
||||
public Soulseek.File? FirstDownload => Downloads?.FirstOrDefault().Value.Item2;
|
||||
public string? FirstUsername => Downloads?.FirstOrDefault().Value.Item1.Username;
|
||||
|
||||
public Track() { }
|
||||
|
||||
|
|
|
@ -172,8 +172,8 @@ public static class Help
|
|||
Aggregate Download
|
||||
-g, --aggregate Aggregate download mode: Find and download all distinct
|
||||
songs associated with the provided artist, album, or title.
|
||||
--min-users-aggregate <num> Minimum number of users sharing a track or album for it to
|
||||
be downloaded in aggregate mode. (Default: 2)
|
||||
--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
|
||||
|
||||
|
@ -265,9 +265,9 @@ public static class Help
|
|||
Two files are considered equal if their inferred track title and artist name are equal
|
||||
(ignoring case and some special characters), and their lengths are within --length-tol of each
|
||||
other.
|
||||
Note that this mode is not 100% reliable, which is why --min-users-aggregate is set to 2 by
|
||||
default, i.e. any song that is shared by only one peer will be ignored. Enable --relax-filtering
|
||||
to make the file filtering less aggressive.
|
||||
Note that this mode is not 100% reliable, which is why --min-shares-aggregate is set to 2 by
|
||||
default, i.e. any song that is shared only once will be ignored. Enable --relax-filtering to
|
||||
make the file filtering less aggressive.
|
||||
|
||||
Album Aggregate
|
||||
Activated when --album and --aggregate are enabled, in this mode sldl searches for the query
|
||||
|
@ -276,8 +276,8 @@ public static class Help
|
|||
other (or within 3 seconds if length-tol is not configured). If both folders have exactly one
|
||||
audio file with similar lengths, also checks if the inferred title and artist name coincide.
|
||||
More reliable than normal aggregate due to much simpler grouping logic.
|
||||
Note that --min-users-aggregate is 2 by default, which means that folders shared by only one
|
||||
peer are ignored.
|
||||
Note that --min-shares-aggregate is 2 by default, which means that folders shared only once
|
||||
will be ignored.
|
||||
";
|
||||
|
||||
const string searchHelp = @"
|
||||
|
|
|
@ -243,10 +243,10 @@ static partial class Program
|
|||
|
||||
if (tle.needSourceSearch)
|
||||
{
|
||||
Console.WriteLine($"{tle.source.Type} download: {tle.source.ToString(true)}, searching..");
|
||||
|
||||
await InitClientAndUpdateIfNeeded();
|
||||
|
||||
Console.WriteLine($"{tle.source.Type} download: {tle.source.ToString(true)}, searching..");
|
||||
|
||||
if (tle.source.Type == TrackType.Album)
|
||||
{
|
||||
tle.list = await GetAlbumDownloads(tle.source, responseData);
|
||||
|
@ -260,7 +260,10 @@ static partial class Program
|
|||
var res = await GetAggregateAlbums(tle.source, responseData);
|
||||
|
||||
foreach (var item in res)
|
||||
trackLists.AddEntry(new TrackListEntry(item, tle.source, false, true, true, false, false));
|
||||
{
|
||||
var newSource = new Track(tle.source) { Type = TrackType.Album };
|
||||
trackLists.AddEntry(new TrackListEntry(item, newSource, false, true, true, false, false));
|
||||
}
|
||||
}
|
||||
|
||||
if (Config.skipExisting && tle.needSkipExistingAfterSearch)
|
||||
|
@ -993,7 +996,8 @@ static partial class Program
|
|||
user = new string(Enumerable.Repeat(chars, 10).Select(s => s[r.Next(s.Length)]).ToArray());
|
||||
pass = new string(Enumerable.Repeat(chars, 10).Select(s => s[r.Next(s.Length)]).ToArray());
|
||||
}
|
||||
WriteLine($"Login {user}", debugOnly: true);
|
||||
|
||||
WriteLine($"Login {user}");
|
||||
|
||||
while (true)
|
||||
{
|
||||
|
|
|
@ -482,18 +482,24 @@ static partial class Program
|
|||
|
||||
var albums = await GetAlbumDownloads(track, responseData);
|
||||
|
||||
var sortedLengthLists = new List<(int[] lengths, List<Track> album)>();
|
||||
var sortedLengthLists = new List<(int[] lengths, List<Track> album, string username)>();
|
||||
|
||||
foreach (var album in albums)
|
||||
{
|
||||
if (album.Count == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var sortedLengths = album.Where(x => !x.IsNotAudio).Select(x => x.Length).OrderBy(x => x).ToArray();
|
||||
sortedLengthLists.Add((sortedLengths, album));
|
||||
string user = album[0].FirstUsername;
|
||||
sortedLengthLists.Add((sortedLengths, album, user));
|
||||
}
|
||||
|
||||
var lengthsList = new List<int[]>();
|
||||
var res = new List<List<List<Track>>>();
|
||||
|
||||
foreach ((var lengths, var album) in sortedLengthLists)
|
||||
foreach ((var lengths, var album, var user) in sortedLengthLists)
|
||||
{
|
||||
bool found = false;
|
||||
|
||||
|
@ -536,7 +542,7 @@ static partial class Program
|
|||
}
|
||||
}
|
||||
|
||||
res = res.Where(x => x.Count >= Config.minUsersAggregate).OrderByDescending(x => x.Count).ToList();
|
||||
res = res.Where(x => x.Count >= Config.minSharesAggregate).OrderByDescending(x => x.Count).ToList();
|
||||
|
||||
return res; // Note: The nested lists are still ordered according to OrderedResults
|
||||
}
|
||||
|
@ -611,7 +617,7 @@ static partial class Program
|
|||
IEnumerable<(SlResponse, SlFile)> fileResponses, int minShares = -1)
|
||||
{
|
||||
if (minShares == -1)
|
||||
minShares = Config.minUsersAggregate;
|
||||
minShares = Config.minSharesAggregate;
|
||||
|
||||
Track inferTrack((SearchResponse r, Soulseek.File f) x)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue