From 07ec322185b94ab1bad3f81e05c7e8e330ca744f Mon Sep 17 00:00:00 2001 From: fiso64 Date: Fri, 24 Mar 2023 23:59:27 +0100 Subject: [PATCH] Add project files. --- slsk-batchdl.sln | 25 + slsk-batchdl/Program.cs | 950 +++++++++++++++++++++++++++++++ slsk-batchdl/slsk-batchdl.csproj | 15 + 3 files changed, 990 insertions(+) create mode 100644 slsk-batchdl.sln create mode 100644 slsk-batchdl/Program.cs create mode 100644 slsk-batchdl/slsk-batchdl.csproj diff --git a/slsk-batchdl.sln b/slsk-batchdl.sln new file mode 100644 index 0000000..f5ee6ab --- /dev/null +++ b/slsk-batchdl.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.4.33110.190 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "slsk-batchdl", "slsk-batchdl\slsk-batchdl.csproj", "{5AC3AC78-7D2D-413D-B075-9F6EED0D5B51}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {5AC3AC78-7D2D-413D-B075-9F6EED0D5B51}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5AC3AC78-7D2D-413D-B075-9F6EED0D5B51}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5AC3AC78-7D2D-413D-B075-9F6EED0D5B51}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5AC3AC78-7D2D-413D-B075-9F6EED0D5B51}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {0825949A-4DBB-41B9-B586-4E0DA6D54757} + EndGlobalSection +EndGlobal diff --git a/slsk-batchdl/Program.cs b/slsk-batchdl/Program.cs new file mode 100644 index 0000000..22eda32 --- /dev/null +++ b/slsk-batchdl/Program.cs @@ -0,0 +1,950 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel.Design.Serialization; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Net.WebSockets; +using System.Runtime.CompilerServices; +using System.Text.RegularExpressions; +using System.Threading; +using System.Threading.Tasks; +using System.Xml.Linq; +using Soulseek; +using TagLib.Matroska; +using static System.Formats.Asn1.AsnWriter; +using static System.Net.WebRequestMethods; + +class Program +{ + static SoulseekClient client = new SoulseekClient(); + static Dictionary searches = new Dictionary(); + static Dictionary downloads = new Dictionary(); + static List tracks = new List(); + static string outputFolder = ""; + static string failsFilePath = ""; + static string m3uFilePath = ""; + static string musicDir = ""; + static int downloadMaxStaleTime = 0; +#if DEBUG + static int displayUpdateDelay = 1000; +#else + static int displayUpdateDelay = 500; +#endif + + static void PrintHelp() + { + Console.WriteLine("Usage: slsk-batchdl.exe [OPTIONS]"); + Console.WriteLine("Options:"); + Console.WriteLine(" --output-folder Downloaded files will be placed here"); + Console.WriteLine(" --tracks-csv The csv file containing track information (in case it's not in the output folder)"); + Console.WriteLine(" --username Soulseek username"); + Console.WriteLine(" --password Soulseek password"); + Console.WriteLine(" --artist-col Specify if the csv file contains an artist name column"); + Console.WriteLine(" --track-col Specify if if the csv file contains an track name column"); + Console.WriteLine(" --full-title-col Specify only if there are no separate artist and track name columns are not in the csv"); + Console.WriteLine(" --uploader-col Specify when using full title col if there is also an uploader col in the csv (fallback in case artist name cannot be extracted from title)"); + Console.WriteLine(" --length-col Specify the name of the track duration column, if exists"); + Console.WriteLine(" --time-unit Time unit for the track duration column, ms or s"); + Console.WriteLine(" --skip-existing Skip if a track matching the conditions is found in the output folder or your music library (if provided)"); + //Console.WriteLine(" --music-dir Specify to also skip downloading tracks which are in your library, use with --skip-existing (currently too slow / unusable)"); + Console.WriteLine(" --skip-if-pref-failed Skip if preferred versions of a track exist but failed to download. If no pref. versions were found, download as normal."); + Console.WriteLine(" --create-m3u Create an m3u playlist file in the output dir."); + Console.WriteLine(" --search-timeout Maximal search time"); + Console.WriteLine(" --download-max-stale-time