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

set album concurrent-dls to 999 due to #56

This commit is contained in:
fiso64 2024-09-05 16:28:37 +02:00
parent b15bb01c89
commit 39c8863a23
7 changed files with 39 additions and 37 deletions

View file

@ -427,7 +427,7 @@ tag1 is null, use tag2. String literals enclosed in parentheses are ignored in t
- "{artist( - )title|filename}"
If artist and title are not null, name it 'Artist - Title', otherwise use the original
filename.
- "{albumartist(/)album(/)track(. )title|(missing-tags/)filename}"
- "{albumartist(/)album(/)track(. )title|(missing-tags/)foldername(/)filename}"
Sort files into artist/album folders if all tags are present, otherwise put them in
the 'missing-tags' folder.
@ -582,7 +582,7 @@ sldl "artist=MC MENTAL" --aggregate --album --interactive
Create a file named `wishlist.txt`, and add some items as detailed in [Input types: List](#list):
```bash
echo "title=My Favorite Song, artist=Artist" >> wishlist.txt
echo "album=Album" "format=mp3" >> wishlist.txt
echo "album=Album, album-track-count=5" "format=mp3" >> wishlist.txt
```
Add a profile to your `sldl.conf`:
```
@ -603,7 +603,7 @@ sldl --profile wishlist
## Notes
- For macOS builds you can use publish.sh to build the app. Download dotnet from https://dotnet.microsoft.com/en-us/download/dotnet/6.0, then run `chmod +x publish.sh && sh publish.sh`. For intel macs, uncomment the x64 and comment the arm64 section in publish.sh.
- `--display single` and especially `double` can cause the printed lines to be duplicated or overwritten on some configurations. Use `simple` if that's an issue.
- `--display single` and especially `double` can cause the printed lines to be duplicated or overwritten on some configurations (new windows terminal, git bash). Use another terminal or `--display-mode simple` in case of issues.
## Docker

View file

@ -109,7 +109,7 @@ public class DownloadWrapper
{
public string savePath;
public string displayText = "";
public int downloadRotatingBarState = 0;
public int barState = 0;
public Soulseek.File file;
public Transfer? transfer;
public SearchResponse response;
@ -145,8 +145,6 @@ public class DownloadWrapper
public void UpdateText()
{
downloadRotatingBarState++;
downloadRotatingBarState %= bars.Length;
float? percentage = bytesTransferred / (float)file.Size;
queued = (transfer?.State & TransferStates.Queued) != 0;
string bar;
@ -156,7 +154,7 @@ public class DownloadWrapper
if (stalled)
{
state = "Stalled";
bar = "";
bar = " ";
}
else if (transfer != null)
{
@ -166,9 +164,13 @@ public class DownloadWrapper
state = "Queued (R)";
else
state = "Queued (L)";
bar = " ";
}
else if ((transfer.State & TransferStates.Initializing) != 0)
{
state = "Initialize";
bar = " ";
}
else if ((transfer.State & TransferStates.Completed) != 0)
{
var flag = transfer.State & (TransferStates.Succeeded | TransferStates.Cancelled
@ -178,20 +180,28 @@ public class DownloadWrapper
if (flag == TransferStates.Succeeded)
success = true;
bar = "";
}
else
{
state = transfer.State.ToString();
if ((transfer.State & TransferStates.InProgress) != 0)
{
downloading = true;
barState = (barState + 1) % bars.Length;
bar = bars[barState] + " ";
}
else
{
bar = " ";
}
}
bar = success ? "" : bars[downloadRotatingBarState] + " ";
}
else
{
state = "NullState";
bar = "";
bar = " ";
}
string txt = $"{bar}{state}:".PadRight(14) + $" {displayText}";

View file

@ -240,18 +240,20 @@ public class FileManager
case "filename":
res = Utils.GetFileNameWithoutExtSlsk(slfile?.Filename ?? ""); break;
case "foldername":
if (remoteCommonDir == null || slfile == null)
if (string.IsNullOrEmpty(remoteCommonDir) || slfile == null)
{
res = Utils.GetBaseNameSlsk(Utils.GetDirectoryNameSlsk(slfile?.Filename ?? ""));
return true;
if (!string.IsNullOrEmpty(remoteCommonDir))
res = Path.GetFileName(Utils.NormalizedPath(remoteCommonDir));
else
res = Path.GetDirectoryName(Utils.NormalizedPath(slfile.Filename));
}
else
{
string d = Path.GetDirectoryName(Utils.NormalizedPath(slfile.Filename));
string r = Path.GetFileName(remoteCommonDir);
res = Path.Join(r, Path.GetRelativePath(remoteCommonDir, d));
return true;
}
return true;
case "extractor":
res = Config.I.inputType.ToString(); break;
case "default-folder":

View file

@ -401,7 +401,7 @@ public static class Help
""{artist( - )title|filename}""
If artist and title are not null, name it 'Artist - Title', otherwise use the original
filename.
""{albumartist(/)album(/)track(. )title|(missing-tags/)filename}""
""{albumartist(/)album(/)track(. )title|(missing-tags/)foldername(/)filename}""
Sort files into artist/album folders if all tags are present, otherwise put them in
the 'missing-tags' folder.

View file

@ -298,7 +298,7 @@ public static class Printing
if (lastIndex != -1)
{
int secondLastIndex = gcp.LastIndexOf('\\', lastIndex - 1);
gcp = secondLastIndex == -1 ? gcp[(lastIndex + 1)..] : gcp[(secondLastIndex + 1)..];
gcp = secondLastIndex == -1 ? gcp : gcp[(secondLastIndex + 1)..];
}
return (gcp, res);

View file

@ -501,7 +501,7 @@ static partial class Program
PrintAlbum(tracks);
}
var semaphore = new SemaphoreSlim(Config.I.concurrentProcesses);
var semaphore = new SemaphoreSlim(999); // Needs to be uncapped due to a bug that causes album downloads to fail after some time
using var cts = new CancellationTokenSource();
try

View file

@ -15,25 +15,6 @@ using SlFile = Soulseek.File;
using SlDictionary = System.Collections.Concurrent.ConcurrentDictionary<string, (Soulseek.SearchResponse, Soulseek.File)>;
using System.Diagnostics;
class TimerReporter
{
private Stopwatch stopwatch;
public TimerReporter()
{
stopwatch = new Stopwatch();
stopwatch.Start();
}
public void Report(string message = "")
{
Console.WriteLine($"Time elapsed: {stopwatch.ElapsedMilliseconds} ms. {message}");
stopwatch.Restart();
}
}
static class Search
{
public static RateLimitedSemaphore? searchSemaphore;
@ -604,7 +585,16 @@ static class Search
int newFiles = 0;
try
{
var allFiles = await GetAllFilesInFolder(response.Username, folder, cancellationToken);
List<(string dir, SlFile file)> allFiles;
try
{
allFiles = await GetAllFilesInFolder(response.Username, folder, cancellationToken);
}
catch (Exception e)
{
Console.WriteLine($"Error: Error getting all files in directory '{folder}: {e}'");
return 0;
}
if (allFiles.Count > tracks.Count)
{