1
0
Fork 0
mirror of https://github.com/fiso64/slsk-batchdl.git synced 2024-12-22 06:22:41 +00:00

fix album conditions

This commit is contained in:
fiso64 2024-09-02 22:43:28 +02:00
parent 5b4df5faff
commit b15bb01c89
4 changed files with 47 additions and 39 deletions

View file

@ -355,7 +355,7 @@ The search query is determined as follows:
"Waiting"). By default it is configured to allow up to 34 searches every 220 seconds.
The default values were determined through experimentation, so they may be incorrect.
### Quality vs Speed
### Speeding things up
The following options will make it go faster, but may decrease search result quality or cause
instability:
- --fast-search skips waiting until the search completes and downloads as soon as a file
@ -363,18 +363,7 @@ The search query is determined as follows:
- --concurrent-downloads - set it to 4 or more
- --max-stale-time is set to 50 seconds by default, so it will wait a long time before giving
up on a file
- --searches-per-time increase at the risk of bans.
### Quality vs Quantity
The options --strict-title, --strict-artist and --strict-album will filter any file that
does not contain the title/artist/album in the filename (ignoring case, bounded by boundary
chars).
Another way to prevent false downloads is to set --length-tol to 3 or less to make it ignore
any songs that differ from the input by more than 3 seconds. However, all 4 options are already
enabled as 'preferred' conditions by default, meaning that such files will only be downloaded
as a last resort anyways. Hence it is only recommended to enable them if you need to minimize
false downloads as much as possible.
- --searches-per-time - increase at the risk of bans.
## File conditions
@ -402,6 +391,20 @@ that don't satisfy any condition, but some conditions have precedence over other
a file that only satisfies strict-title (if enabled) will always be preferred over a file that
only satisfies the format condition. Run with --print "results-full" to reveal the sorting logic.
Conditions can also be supplied as a semicolon-delimited string with --cond and --pref, e.g
--cond "br >= 320; format = mp3,ogg; sr < 96000".
### Filtering irrelevant results
The options --strict-title, --strict-artist and --strict-album will filter any file that
does not contain the title/artist/album in the filename (ignoring case, bounded by boundary
chars).
Another way to prevent false downloads is to set --length-tol to 3 or less to make it ignore
any songs that differ from the input by more than 3 seconds. However, all 4 options are already
enabled as 'preferred' conditions by default, meaning that such files will only be downloaded
as a last resort anyways. Hence it is only recommended to enable them if you need to minimize
false downloads as much as possible, or for special cases like tracks or albums whose name
is just one or a two characters.
### Important note
Some info may be unavailable depending on the client used by the peer. For example, the standard
Soulseek client does not share the file bitrate. If (e.g) --min-bitrate is set, then sldl will
@ -411,10 +414,6 @@ only satisfies the format condition. Run with --print "results-full" to reveal t
client will be ignored. Also note that the default preferred conditions will already affect
ranking with this option due to the bitrate and samplerate checks.
Conditions can also be supplied as a semicolon-delimited string with --cond and --pref, e.g
--cond "br >= 320; format = mp3,ogg; sr < 96000".
## Name format
Variables enclosed in {} will be replaced by the corresponding file tag value.

View file

@ -34,8 +34,11 @@ public class FileConditions
AcceptNoLength = other.AcceptNoLength;
StrictArtist = other.StrictArtist;
StrictTitle = other.StrictTitle;
StrictAlbum = other.StrictAlbum;
MinBitDepth = other.MinBitDepth;
MaxBitDepth = other.MaxBitDepth;
AcceptMissingProps = other.AcceptMissingProps;
StrictStringDiacrRemove = other.StrictStringDiacrRemove;
Formats = other.Formats.ToArray();
BannedUsers = other.BannedUsers.ToArray();
}
@ -203,7 +206,7 @@ public class FileConditions
if (!StrictAlbum || alname.Length == 0)
return true;
return StrictString(Utils.GetDirectoryNameSlsk(fname), alname, StrictStringDiacrRemove, ignoreCase: true);
return StrictString(Utils.GetDirectoryNameSlsk(fname), alname, StrictStringDiacrRemove, ignoreCase: true, boundarySkipWs: true);
}
public static string StrictStringPreprocess(string str, bool diacrRemove = true)

View file

@ -324,25 +324,16 @@ public static class Help
""Waiting""). By default it is configured to allow up to 34 searches every 220 seconds.
The default values were determined through experimentation, so they may be incorrect.
Quality vs Speed
Speeding things up
The following options will make it go faster, but may decrease search result quality or cause
instability:
--fast-search skips waiting until the search completes and downloads as soon as a file
matching the preferred conditions is found
--concurrent-downloads - set it to 4 or more
--max-stale-time is set to 50 seconds by default, so it will wait a long time before giving
up on a file
--searches-per-time increase at the risk of bans.
Quality vs Quantity
The options --strict-title, --strict-artist and --strict-album will filter any file that
does not contain the title/artist/album in the filename (ignoring case, bounded by boundary
chars).
Another way to prevent false downloads is to set --length-tol to 3 or less to make it ignore
any songs that differ from the input by more than 3 seconds. However, all 4 options are already
enabled as 'preferred' conditions by default, meaning that such files will only be downloaded
as a last resort anyways. Hence it is only recommended to enable them if you need to minimize
false downloads as much as possible.
--searches-per-time - increase at the risk of bans.
";
const string fileConditionsHelp = @"
@ -372,6 +363,20 @@ public static class Help
a file that only satisfies strict-title (if enabled) will always be preferred over a file that
only satisfies the format condition. Run with --print ""results-full"" to reveal the sorting logic.
Conditions can also be supplied as a semicolon-delimited string with --cond and --pref, e.g
--cond ""br >= 320; format = mp3,ogg; sr < 96000"".
Filtering irrelevant results
The options --strict-title, --strict-artist and --strict-album will filter any file that
does not contain the title/artist/album in the filename (ignoring case, bounded by boundary
chars).
Another way to prevent false downloads is to set --length-tol to 3 or less to make it ignore
any songs that differ from the input by more than 3 seconds. However, all 4 options are already
enabled as 'preferred' conditions by default, meaning that such files will only be downloaded
as a last resort anyways. Hence it is only recommended to enable them if you need to minimize
false downloads as much as possible, or for special cases like tracks or albums whose name
is just one or a two characters.
Important note
Some info may be unavailable depending on the client used by the peer. For example, the standard
Soulseek client does not share the file bitrate. If (e.g) --min-bitrate is set, then sldl will
@ -380,9 +385,6 @@ public static class Help
As a consequence, if --min-bitrate is also set then any files shared by users with the default
client will be ignored. Also note that the default preferred conditions will already affect
ranking with this option due to the bitrate and samplerate checks.
Conditions can also be supplied as a semicolon-delimited string with --cond and --pref, e.g
--cond ""br >= 320; format = mp3,ogg; sr < 96000"".
";
const string nameFormatHelp = @"

View file

@ -295,6 +295,10 @@ static class Search
responseFilter: (response) =>
{
return response.UploadSpeed > 0 && nec.BannedUsersSatisfies(response);
},
fileFilter: (file) =>
{
return !Utils.IsMusicFile(file.Filename) || nec.FileSatisfies(file, track, null);
}
);
void handler(SlResponse r)
@ -304,14 +308,14 @@ static class Search
if (r.Files.Count > 0)
{
foreach (var file in r.Files)
results.TryAdd(r.Username + "\\" + file.Filename, (r, file));
results.TryAdd(r.Username + '\\' + file.Filename, (r, file));
}
}
using var cts = new CancellationTokenSource();
await RunSearches(track, results, getSearchOptions, handler, cts.Token);
string fullPath((SearchResponse r, Soulseek.File f) x) { return x.r.Username + "\\" + x.f.Filename; }
string fullPath((SearchResponse r, Soulseek.File f) x) { return x.r.Username + '\\' + x.f.Filename; }
var orderedResults = OrderedResults(results, track, false, false, albumMode: true);