diff --git a/README.md b/README.md index fae0086..64fcb64 100644 --- a/README.md +++ b/README.md @@ -164,6 +164,9 @@ Usage: sldl [OPTIONS] --max-samplerate Maximum file sample rate --min-bitdepth Minimum bit depth --max-bitdepth Maximum bit depth + --strict-title File name must contain title + --strict-artist File path must contain artist name + --strict-album File path must contain album name --banned-users Comma-separated list of users to ignore --pref-format Preferred file format(s), comma-separated (default: mp3) diff --git a/slsk-batchdl/FileManager.cs b/slsk-batchdl/FileManager.cs index 0dc6897..83d8159 100644 --- a/slsk-batchdl/FileManager.cs +++ b/slsk-batchdl/FileManager.cs @@ -38,8 +38,9 @@ public class FileManager if (tle.source.Type == TrackType.Album && !string.IsNullOrEmpty(remoteCommonDir)) { string dirname = Path.GetFileName(remoteCommonDir); - string relpath = Path.GetRelativePath(remoteCommonDir, Utils.NormalizedPath(sourceFname)); - parent = Path.Join(parent, dirname, Path.GetDirectoryName(relpath)); + string normFname = Utils.NormalizedPath(sourceFname); + string relpath = normFname.StartsWith(remoteCommonDir) ? Path.GetRelativePath(remoteCommonDir, normFname) : ""; + parent = Path.Join(parent, dirname, Path.GetDirectoryName(relpath) ?? ""); } return Path.Join(parent, name); diff --git a/slsk-batchdl/Help.cs b/slsk-batchdl/Help.cs index 16ebcb2..76efac5 100644 --- a/slsk-batchdl/Help.cs +++ b/slsk-batchdl/Help.cs @@ -1,7 +1,7 @@  // undocumented options // --login, --random-login, --no-modify-share-count, --unknown-error-retries -// --invalid-replace-str, --cond, --pref, --strict-title, --strict-artist, --strict-album +// --invalid-replace-str, --cond, --pref // --fast-search-delay, --fast-search-min-up-speed // --min-album-track-count, --max-album-track-count, --extract-max-track-count, --extract-min-track-count @@ -136,6 +136,9 @@ public static class Help --max-samplerate Maximum file sample rate --min-bitdepth Minimum bit depth --max-bitdepth Maximum bit depth + --strict-title File name must contain title + --strict-artist File path must contain artist name + --strict-album File path must contain album name --banned-users Comma-separated list of users to ignore --pref-format Preferred file format(s), comma-separated (default: mp3) diff --git a/slsk-batchdl/Program.cs b/slsk-batchdl/Program.cs index 7b3c9ce..34adc65 100644 --- a/slsk-batchdl/Program.cs +++ b/slsk-batchdl/Program.cs @@ -540,7 +540,7 @@ static partial class Program if (Config.I.albumArtOnly || succeeded && Config.I.albumArtOption != AlbumArtOption.Default) { Console.WriteLine($"\nDownloading additional images:"); - additionalImages = await DownloadImages(tle.list, Config.I.albumArtOption, tracks, organizer); + additionalImages = await DownloadImages(tle, tle.list, Config.I.albumArtOption, tracks); tracks?.AddRange(additionalImages); } @@ -616,8 +616,9 @@ static partial class Program } - static async Task> DownloadImages(List> downloads, AlbumArtOption option, List? chosenAlbum, FileManager fileManager) + static async Task> DownloadImages(TrackListEntry tle, List> downloads, AlbumArtOption option, List? chosenAlbum) { + var fileManager = new FileManager(tle); var downloadedImages = new List(); long mSize = 0; int mCount = 0; @@ -710,10 +711,7 @@ static partial class Program PrintAlbum(tracks); } - if (fileManager.remoteCommonDir == null) - { - fileManager.SetRemoteCommonDir(Utils.GreatestCommonDirectorySlsk(tracks.Select(t => t.FirstDownload.Filename))); - } + fileManager.SetRemoteCommonDir(Utils.GreatestCommonDirectorySlsk(tracks.Select(t => t.FirstDownload.Filename))); bool allSucceeded = true; var semaphore = new SemaphoreSlim(1); diff --git a/slsk-batchdl/slsk-batchdl.csproj b/slsk-batchdl/slsk-batchdl.csproj index 8c1b2e2..7efdf46 100644 --- a/slsk-batchdl/slsk-batchdl.csproj +++ b/slsk-batchdl/slsk-batchdl.csproj @@ -27,7 +27,7 @@ - +