diff --git a/OF DL.Core/Helpers/VersionHelper.cs b/OF DL.Core/Helpers/VersionHelper.cs index 2b3903b..17e01a1 100644 --- a/OF DL.Core/Helpers/VersionHelper.cs +++ b/OF DL.Core/Helpers/VersionHelper.cs @@ -1,5 +1,5 @@ using Newtonsoft.Json; -using OF_DL.Models; +using OF_DL.Models.OfdlApi; using Serilog; namespace OF_DL.Helpers; diff --git a/OF DL.Core/Models/CDRMProjectRequest.cs b/OF DL.Core/Models/CDRMProjectRequest.cs deleted file mode 100644 index 07ae8fe..0000000 --- a/OF DL.Core/Models/CDRMProjectRequest.cs +++ /dev/null @@ -1,17 +0,0 @@ -using Newtonsoft.Json; - -namespace OF_DL.Models; - -// ReSharper disable once InconsistentNaming -public class CDRMProjectRequest -{ - [JsonProperty("pssh")] public string Pssh { get; set; } = ""; - - [JsonProperty("licurl")] public string LicenseUrl { get; set; } = ""; - - [JsonProperty("headers")] public string Headers { get; set; } = ""; - - [JsonProperty("cookies")] public string Cookies { get; set; } = ""; - - [JsonProperty("data")] public string Data { get; set; } = ""; -} diff --git a/OF DL.Core/Models/Config.cs b/OF DL.Core/Models/Config/Config.cs similarity index 97% rename from OF DL.Core/Models/Config.cs rename to OF DL.Core/Models/Config/Config.cs index 7e83618..a655711 100644 --- a/OF DL.Core/Models/Config.cs +++ b/OF DL.Core/Models/Config/Config.cs @@ -3,7 +3,7 @@ using Newtonsoft.Json.Converters; using OF_DL.Enumerations; using Serilog; -namespace OF_DL.Models; +namespace OF_DL.Models.Config; public class Config : IFileNameFormatConfig { @@ -147,4 +147,9 @@ public class Config : IFileNameFormatConfig return combinedFilenameFormatConfig; } + + private class ShortDateConverter : IsoDateTimeConverter + { + public ShortDateConverter() => DateTimeFormat = "yyyy-MM-dd"; + } } diff --git a/OF DL.Core/Models/CreatorConfig.cs b/OF DL.Core/Models/Config/CreatorConfig.cs similarity index 90% rename from OF DL.Core/Models/CreatorConfig.cs rename to OF DL.Core/Models/Config/CreatorConfig.cs index 6c7ad40..89ba399 100644 --- a/OF DL.Core/Models/CreatorConfig.cs +++ b/OF DL.Core/Models/Config/CreatorConfig.cs @@ -1,4 +1,4 @@ -namespace OF_DL.Models; +namespace OF_DL.Models.Config; public class CreatorConfig : IFileNameFormatConfig { diff --git a/OF DL.Core/Models/FileNameFormatConfig.cs b/OF DL.Core/Models/Config/FileNameFormatConfig.cs similarity index 90% rename from OF DL.Core/Models/FileNameFormatConfig.cs rename to OF DL.Core/Models/Config/FileNameFormatConfig.cs index 2b1b0b2..2a14123 100644 --- a/OF DL.Core/Models/FileNameFormatConfig.cs +++ b/OF DL.Core/Models/Config/FileNameFormatConfig.cs @@ -1,4 +1,4 @@ -namespace OF_DL.Models; +namespace OF_DL.Models.Config; public class FileNameFormatConfig : IFileNameFormatConfig { diff --git a/OF DL.Core/Models/IFileNameFormatConfig.cs b/OF DL.Core/Models/Config/IFileNameFormatConfig.cs similarity index 88% rename from OF DL.Core/Models/IFileNameFormatConfig.cs rename to OF DL.Core/Models/Config/IFileNameFormatConfig.cs index 7622eee..5800f88 100644 --- a/OF DL.Core/Models/IFileNameFormatConfig.cs +++ b/OF DL.Core/Models/Config/IFileNameFormatConfig.cs @@ -1,4 +1,4 @@ -namespace OF_DL.Models; +namespace OF_DL.Models.Config; public interface IFileNameFormatConfig { diff --git a/OF DL.Core/Models/ToggleableConfigAttribute.cs b/OF DL.Core/Models/Config/ToggleableConfigAttribute.cs similarity index 76% rename from OF DL.Core/Models/ToggleableConfigAttribute.cs rename to OF DL.Core/Models/Config/ToggleableConfigAttribute.cs index c0e6c83..4adeba0 100644 --- a/OF DL.Core/Models/ToggleableConfigAttribute.cs +++ b/OF DL.Core/Models/Config/ToggleableConfigAttribute.cs @@ -1,4 +1,4 @@ -namespace OF_DL.Models; +namespace OF_DL.Models.Config; [AttributeUsage(AttributeTargets.Property)] internal class ToggleableConfigAttribute : Attribute; diff --git a/OF DL.Core/Models/CreatorDownloadResult.cs b/OF DL.Core/Models/Downloads/CreatorDownloadResult.cs similarity index 94% rename from OF DL.Core/Models/CreatorDownloadResult.cs rename to OF DL.Core/Models/Downloads/CreatorDownloadResult.cs index 16de4cb..d686e1b 100644 --- a/OF DL.Core/Models/CreatorDownloadResult.cs +++ b/OF DL.Core/Models/Downloads/CreatorDownloadResult.cs @@ -1,4 +1,4 @@ -namespace OF_DL.Models; +namespace OF_DL.Models.Downloads; public class CreatorDownloadResult { diff --git a/OF DL.Core/Models/DownloadResult.cs b/OF DL.Core/Models/Downloads/DownloadResult.cs similarity index 96% rename from OF DL.Core/Models/DownloadResult.cs rename to OF DL.Core/Models/Downloads/DownloadResult.cs index 1f2a6bc..a38b314 100644 --- a/OF DL.Core/Models/DownloadResult.cs +++ b/OF DL.Core/Models/Downloads/DownloadResult.cs @@ -1,4 +1,4 @@ -namespace OF_DL.Models; +namespace OF_DL.Models.Downloads; /// /// Represents the result of a download operation. diff --git a/OF DL.Core/Models/DynamicRules.cs b/OF DL.Core/Models/OfdlApi/DynamicRules.cs similarity index 95% rename from OF DL.Core/Models/DynamicRules.cs rename to OF DL.Core/Models/OfdlApi/DynamicRules.cs index 412547a..ccdd635 100644 --- a/OF DL.Core/Models/DynamicRules.cs +++ b/OF DL.Core/Models/OfdlApi/DynamicRules.cs @@ -1,6 +1,6 @@ using Newtonsoft.Json; -namespace OF_DL.Models; +namespace OF_DL.Models.OfdlApi; public class DynamicRules { diff --git a/OF DL.Core/Models/LatestReleaseApiResponse.cs b/OF DL.Core/Models/OfdlApi/LatestReleaseApiResponse.cs similarity index 83% rename from OF DL.Core/Models/LatestReleaseApiResponse.cs rename to OF DL.Core/Models/OfdlApi/LatestReleaseApiResponse.cs index 3cf66ee..4197a89 100644 --- a/OF DL.Core/Models/LatestReleaseApiResponse.cs +++ b/OF DL.Core/Models/OfdlApi/LatestReleaseApiResponse.cs @@ -1,6 +1,6 @@ using Newtonsoft.Json; -namespace OF_DL.Models; +namespace OF_DL.Models.OfdlApi; public class LatestReleaseApiResponse { diff --git a/OF DL.Core/Models/OFDLRequest.cs b/OF DL.Core/Models/OfdlApi/OFDLRequest.cs similarity index 72% rename from OF DL.Core/Models/OFDLRequest.cs rename to OF DL.Core/Models/OfdlApi/OFDLRequest.cs index 52fef56..0f943e2 100644 --- a/OF DL.Core/Models/OFDLRequest.cs +++ b/OF DL.Core/Models/OfdlApi/OFDLRequest.cs @@ -1,9 +1,8 @@ using Newtonsoft.Json; -namespace OF_DL.Models; +namespace OF_DL.Models.OfdlApi; -// ReSharper disable once InconsistentNaming -public class OFDLRequest +public class OfdlRequest { [JsonProperty("pssh")] public string Pssh { get; set; } = ""; diff --git a/OF DL.Core/Models/ShortDateConverter.cs b/OF DL.Core/Models/ShortDateConverter.cs deleted file mode 100644 index 7a9f62c..0000000 --- a/OF DL.Core/Models/ShortDateConverter.cs +++ /dev/null @@ -1,8 +0,0 @@ -using Newtonsoft.Json.Converters; - -namespace OF_DL.Models; - -public class ShortDateConverter : IsoDateTimeConverter -{ - public ShortDateConverter() => DateTimeFormat = "yyyy-MM-dd"; -} diff --git a/OF DL.Core/Services/ApiService.cs b/OF DL.Core/Services/ApiService.cs index c460b17..89b6eab 100644 --- a/OF DL.Core/Services/ApiService.cs +++ b/OF DL.Core/Services/ApiService.cs @@ -28,6 +28,7 @@ using StreamEntities = OF_DL.Models.Entities.Streams; using SubscriptionEntities = OF_DL.Models.Entities.Subscriptions; using UserEntities = OF_DL.Models.Entities.Users; using OF_DL.Models.Mappers; +using OF_DL.Models.OfdlApi; using OF_DL.Widevine; using Serilog; using static OF_DL.Utils.HttpUtil; @@ -3147,7 +3148,7 @@ public class ApiService(IAuthService authService, IConfigService configService, HttpClient client = new(); int attempt = 0; - OFDLRequest ofdlRequest = new() + OfdlRequest ofdlRequest = new() { Pssh = pssh, LicenseUrl = licenceUrl, Headers = JsonConvert.SerializeObject(drmHeaders) }; diff --git a/OF DL.Core/Services/ConfigService.cs b/OF DL.Core/Services/ConfigService.cs index 9c43b0a..d34b3d3 100644 --- a/OF DL.Core/Services/ConfigService.cs +++ b/OF DL.Core/Services/ConfigService.cs @@ -1,13 +1,12 @@ using System.Reflection; using System.Text; using Akka.Configuration; -using Akka.Configuration.Hocon; using Newtonsoft.Json; -using OF_DL.Models; using OF_DL.Enumerations; +using OF_DL.Models.Config; using OF_DL.Utils; using Serilog; -using Config = OF_DL.Models.Config; +using Config = OF_DL.Models.Config.Config; namespace OF_DL.Services; diff --git a/OF DL.Core/Services/DownloadOrchestrationService.cs b/OF DL.Core/Services/DownloadOrchestrationService.cs index cc8902c..288d7c4 100644 --- a/OF DL.Core/Services/DownloadOrchestrationService.cs +++ b/OF DL.Core/Services/DownloadOrchestrationService.cs @@ -1,6 +1,7 @@ using Newtonsoft.Json.Linq; using OF_DL.Enumerations; -using OF_DL.Models; +using OF_DL.Models.Config; +using OF_DL.Models.Downloads; using Serilog; using PostEntities = OF_DL.Models.Entities.Posts; using PurchasedEntities = OF_DL.Models.Entities.Purchased; diff --git a/OF DL.Core/Services/DownloadService.cs b/OF DL.Core/Services/DownloadService.cs index b9cc5ac..eaee01f 100644 --- a/OF DL.Core/Services/DownloadService.cs +++ b/OF DL.Core/Services/DownloadService.cs @@ -5,6 +5,7 @@ using FFmpeg.NET; using FFmpeg.NET.Events; using OF_DL.Models; using OF_DL.Enumerations; +using OF_DL.Models.Downloads; using ArchivedEntities = OF_DL.Models.Entities.Archived; using MessageEntities = OF_DL.Models.Entities.Messages; using PostEntities = OF_DL.Models.Entities.Posts; diff --git a/OF DL.Core/Services/IConfigService.cs b/OF DL.Core/Services/IConfigService.cs index 6a31ba3..088e3fd 100644 --- a/OF DL.Core/Services/IConfigService.cs +++ b/OF DL.Core/Services/IConfigService.cs @@ -1,4 +1,4 @@ -using OF_DL.Models; +using OF_DL.Models.Config; namespace OF_DL.Services; diff --git a/OF DL.Core/Services/IDownloadEventHandler.cs b/OF DL.Core/Services/IDownloadEventHandler.cs index d40788c..602f6c2 100644 --- a/OF DL.Core/Services/IDownloadEventHandler.cs +++ b/OF DL.Core/Services/IDownloadEventHandler.cs @@ -1,4 +1,4 @@ -using OF_DL.Models; +using OF_DL.Models.Downloads; namespace OF_DL.Services; diff --git a/OF DL.Core/Services/IDownloadOrchestrationService.cs b/OF DL.Core/Services/IDownloadOrchestrationService.cs index 44e48c6..f471bfd 100644 --- a/OF DL.Core/Services/IDownloadOrchestrationService.cs +++ b/OF DL.Core/Services/IDownloadOrchestrationService.cs @@ -1,5 +1,4 @@ -using OF_DL.Models; -using UserEntities = OF_DL.Models.Entities.Users; +using OF_DL.Models.Downloads; namespace OF_DL.Services; diff --git a/OF DL.Core/Services/IDownloadService.cs b/OF DL.Core/Services/IDownloadService.cs index 5f95a14..b474f60 100644 --- a/OF DL.Core/Services/IDownloadService.cs +++ b/OF DL.Core/Services/IDownloadService.cs @@ -1,4 +1,4 @@ -using OF_DL.Models; +using OF_DL.Models.Downloads; using ArchivedEntities = OF_DL.Models.Entities.Archived; using MessageEntities = OF_DL.Models.Entities.Messages; using PostEntities = OF_DL.Models.Entities.Posts; diff --git a/OF DL.Core/Services/StartupService.cs b/OF DL.Core/Services/StartupService.cs index 6c0cfad..6769345 100644 --- a/OF DL.Core/Services/StartupService.cs +++ b/OF DL.Core/Services/StartupService.cs @@ -4,6 +4,7 @@ using System.Runtime.InteropServices; using Newtonsoft.Json; using OF_DL.Helpers; using OF_DL.Models; +using OF_DL.Models.OfdlApi; using Serilog; using WidevineConstants = OF_DL.Widevine.Constants; diff --git a/OF DL/CLI/SpectreDownloadEventHandler.cs b/OF DL/CLI/SpectreDownloadEventHandler.cs index a34cd8a..8758324 100644 --- a/OF DL/CLI/SpectreDownloadEventHandler.cs +++ b/OF DL/CLI/SpectreDownloadEventHandler.cs @@ -1,4 +1,4 @@ -using OF_DL.Models; +using OF_DL.Models.Downloads; using OF_DL.Services; using Spectre.Console; @@ -43,26 +43,18 @@ public class SpectreDownloadEventHandler : IDownloadEventHandler return result; } - public void OnContentFound(string contentType, int mediaCount, int objectCount) - { + public void OnContentFound(string contentType, int mediaCount, int objectCount) => AnsiConsole.Markup($"[red]Found {mediaCount} Media from {objectCount} {Markup.Escape(contentType)}\n[/]"); - } - public void OnNoContentFound(string contentType) - { + public void OnNoContentFound(string contentType) => AnsiConsole.Markup($"[red]Found 0 {Markup.Escape(contentType)}\n[/]"); - } - public void OnDownloadComplete(string contentType, DownloadResult result) - { + public void OnDownloadComplete(string contentType, DownloadResult result) => AnsiConsole.Markup( $"[red]{Markup.Escape(contentType)} Already Downloaded: {result.ExistingDownloads} New {Markup.Escape(contentType)} Downloaded: {result.NewDownloads}[/]\n"); - } - public void OnUserStarting(string username) - { + public void OnUserStarting(string username) => AnsiConsole.Markup($"[red]\nScraping Data for {Markup.Escape(username)}\n[/]"); - } public void OnUserComplete(string username, CreatorDownloadResult result) { @@ -90,15 +82,10 @@ public class SpectreDownloadEventHandler : IDownloadEventHandler AnsiConsole.Markup("\n"); } - public void OnScrapeComplete(TimeSpan elapsed) - { + public void OnScrapeComplete(TimeSpan elapsed) => AnsiConsole.Markup($"[green]Scrape Completed in {elapsed.TotalMinutes:0.00} minutes\n[/]"); - } - public void OnMessage(string message) - { - AnsiConsole.Markup($"[red]{Markup.Escape(message)}\n[/]"); - } + public void OnMessage(string message) => AnsiConsole.Markup($"[red]{Markup.Escape(message)}\n[/]"); private static ProgressColumn[] GetProgressColumns(bool showScrapeSize) { diff --git a/OF DL/Program.cs b/OF DL/Program.cs index 550ab6f..31339ba 100644 --- a/OF DL/Program.cs +++ b/OF DL/Program.cs @@ -3,6 +3,8 @@ using Microsoft.Extensions.DependencyInjection; using OF_DL.CLI; using OF_DL.Models; using OF_DL.Enumerations; +using OF_DL.Models.Config; +using OF_DL.Models.Downloads; using OF_DL.Models.Entities.Users; using OF_DL.Services; using Serilog;