diff --git a/Submarine.Api/Controllers/ReleaseController.cs b/Submarine.Api/Controllers/ReleaseController.cs index 523843c..f97cb72 100644 --- a/Submarine.Api/Controllers/ReleaseController.cs +++ b/Submarine.Api/Controllers/ReleaseController.cs @@ -26,7 +26,7 @@ public ReleaseController(ILogger logger, } [HttpGet] - public Task GetAsync([FromQuery, Required] string title, [FromQuery, Required] Protocol protocol) + public Task GetAsync([FromQuery] [Required] string title, [FromQuery] [Required] Protocol protocol) { try { diff --git a/Submarine.Api/Models/Database/PostgresDatabaseContext.cs b/Submarine.Api/Models/Database/PostgresDatabaseContext.cs index be7ff88..5ba40be 100644 --- a/Submarine.Api/Models/Database/PostgresDatabaseContext.cs +++ b/Submarine.Api/Models/Database/PostgresDatabaseContext.cs @@ -5,8 +5,9 @@ namespace Submarine.Api.Models.Database; public class PostgresDatabaseContext : SubmarineDatabaseContext { private readonly IConfiguration _configuration; - - public PostgresDatabaseContext(DbContextOptions options, IConfiguration configuration) : base(options, configuration) + + public PostgresDatabaseContext(DbContextOptions options, IConfiguration configuration) : base(options, + configuration) => _configuration = configuration; protected override void OnConfiguring(DbContextOptionsBuilder options) diff --git a/Submarine.Api/Models/Database/SubmarineDatabaseContext.cs b/Submarine.Api/Models/Database/SubmarineDatabaseContext.cs index cf49bd4..64b853d 100644 --- a/Submarine.Api/Models/Database/SubmarineDatabaseContext.cs +++ b/Submarine.Api/Models/Database/SubmarineDatabaseContext.cs @@ -5,17 +5,21 @@ namespace Submarine.Api.Models.Database; /// -/// Submarine Database Context +/// Submarine Database Context /// public class SubmarineDatabaseContext : DbContext { - public DbSet Providers { get; set; } - /// - /// Configuration of this Database Context + /// Configuration of this Database Context /// protected readonly IConfiguration Configuration; - + + public DbSet Providers { get; set; } + + /// + public SubmarineDatabaseContext(DbContextOptions options, IConfiguration configuration) : base(options) + => Configuration = configuration; + protected override void OnModelCreating(ModelBuilder builder) { builder.Entity(); @@ -24,10 +28,6 @@ protected override void OnModelCreating(ModelBuilder builder) base.OnModelCreating(builder); } - /// - public SubmarineDatabaseContext(DbContextOptions options, IConfiguration configuration) : base(options) - => Configuration = configuration; - /// public override Task SaveChangesAsync(CancellationToken cancellationToken = new()) { diff --git a/Submarine.Api/Repository/IProviderRepository.cs b/Submarine.Api/Repository/IProviderRepository.cs index 4ba1685..1ed0709 100644 --- a/Submarine.Api/Repository/IProviderRepository.cs +++ b/Submarine.Api/Repository/IProviderRepository.cs @@ -3,7 +3,7 @@ namespace Submarine.Api.Repository; /// -/// Provider Repository abstraction +/// Provider Repository abstraction /// public interface IProviderRepository : IRepositoryBase { diff --git a/Submarine.Api/Repository/IRepositoryBase.cs b/Submarine.Api/Repository/IRepositoryBase.cs index f083bf3..2d2ece7 100644 --- a/Submarine.Api/Repository/IRepositoryBase.cs +++ b/Submarine.Api/Repository/IRepositoryBase.cs @@ -3,68 +3,68 @@ namespace Submarine.Api.Repository; /// -/// Base Repository abstraction +/// Base Repository abstraction /// /// Entity Type public interface IRepositoryBase { /// - /// Finds all entities in this Repository + /// Finds all entities in this Repository /// /// List of entities Task> FindAllAsync(); /// - /// Finds entities by condition + /// Finds entities by condition /// /// condition of entities to find /// List of matching entities Task> FindByConditionAsync(Expression> expression); /// - /// Finds first entity matching condition + /// Finds first entity matching condition /// /// condition of entity to find /// Entity matching condition if found Task FirstByConditionAsync(Expression> expression); /// - /// Creates an entity in the Database + /// Creates an entity in the Database /// /// entity to create /// created entity Task CreateAsync(T entity); - + /// - /// Creates collection of entities in the Database + /// Creates collection of entities in the Database /// /// entities to create /// collection of created entities Task> CreateAsync(ICollection entities); /// - /// Updates an entity in the Database + /// Updates an entity in the Database /// /// entity to update /// updated entity Task UpdateAsync(T entity); /// - /// Updates enumerable of entities in the Database + /// Updates enumerable of entities in the Database /// /// entities to update /// Task UpdateAsync(IEnumerable entities); /// - /// Deletes entity from the Database + /// Deletes entity from the Database /// /// entity to delete /// Task DeleteAsync(T entity); /// - /// Deletes enumerable of entities from the Database + /// Deletes enumerable of entities from the Database /// /// entities to delete /// diff --git a/Submarine.Api/Repository/ProviderRepository.cs b/Submarine.Api/Repository/ProviderRepository.cs index 45b3eb3..00d6734 100644 --- a/Submarine.Api/Repository/ProviderRepository.cs +++ b/Submarine.Api/Repository/ProviderRepository.cs @@ -4,12 +4,12 @@ namespace Submarine.Api.Repository; /// -/// Provider Repository implementation +/// Provider Repository implementation /// public class ProviderRepository : RepositoryBase, IProviderRepository { /// - /// Creates a new instance of + /// Creates a new instance of /// /// Database Context public ProviderRepository(SubmarineDatabaseContext databaseContext) : base(databaseContext) diff --git a/Submarine.Api/Repository/RepositoryBase.cs b/Submarine.Api/Repository/RepositoryBase.cs index d874421..a28ed4d 100644 --- a/Submarine.Api/Repository/RepositoryBase.cs +++ b/Submarine.Api/Repository/RepositoryBase.cs @@ -5,13 +5,13 @@ namespace Submarine.Api.Repository; /// -/// Repository Base implementation +/// Repository Base implementation /// /// Entity Type public abstract class RepositoryBase : IRepositoryBase where T : class { /// - /// Database Context of this Repository + /// Database Context of this Repository /// protected SubmarineDatabaseContext DatabaseContext { get; } @@ -19,7 +19,7 @@ private DbSet Set => DatabaseContext.Set(); /// - /// Creates a new instance of + /// Creates a new instance of /// /// database context protected RepositoryBase(SubmarineDatabaseContext databaseContext) @@ -44,7 +44,7 @@ public async Task CreateAsync(T entity) await SaveAsync(); return entity; } - + /// public async Task> CreateAsync(ICollection entities) { diff --git a/Submarine.Api/Services/ProviderService.cs b/Submarine.Api/Services/ProviderService.cs index 899fa84..0da20b0 100644 --- a/Submarine.Api/Services/ProviderService.cs +++ b/Submarine.Api/Services/ProviderService.cs @@ -7,8 +7,8 @@ namespace Submarine.Api.Services; public class ProviderService { - private readonly IProviderRepository _repository; private readonly ILogger _logger; + private readonly IProviderRepository _repository; public ProviderService(ILogger logger, IProviderRepository repository) { diff --git a/Submarine.Api/Submarine.Api.csproj b/Submarine.Api/Submarine.Api.csproj index 61641c6..e9a0a48 100644 --- a/Submarine.Api/Submarine.Api.csproj +++ b/Submarine.Api/Submarine.Api.csproj @@ -1,44 +1,44 @@ - - net7.0 - enable - enable - Linux - 0.0.1 - 11 - + + net7.0 + enable + enable + Linux + 0.0.1 + 11 + - - bin\Debug\net6.0\Submarine.Api.xml - + + bin\Debug\net6.0\Submarine.Api.xml + - - bin\Release\net6.0\Submarine.Api.xml - + + bin\Release\net6.0\Submarine.Api.xml + - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - - - + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + + - - - + + + - - - + + + diff --git a/Submarine.Core.Test/Parser/QualityParserServiceTest.cs b/Submarine.Core.Test/Parser/QualityParserServiceTest.cs index 9297dd9..359d4fb 100644 --- a/Submarine.Core.Test/Parser/QualityParserServiceTest.cs +++ b/Submarine.Core.Test/Parser/QualityParserServiceTest.cs @@ -17,7 +17,7 @@ public QualityParserServiceTest(ITestOutputHelper output) [InlineData("The Series 2014 S08 1080p Blu-ray AVC DTS-HD MA 5.1-BTN")] public void Parse_ShouldReturnQualitySourceBlurayDisc_WhenReleaseIsBlurayDisc(string input) => AssertQualitySource(input, QualitySource.BLURAY_DISK); - + [Theory] [InlineData("Movie Name 1978 1080p BluRay REMUX AVC FLAC 1.0-BLURANiUM")] [InlineData("Series!!! on ICE - S01E12[JP BD Remux][ENG subs]")] diff --git a/Submarine.Core.Test/Parser/Release/ReleaseParserServiceTest.cs b/Submarine.Core.Test/Parser/Release/ReleaseParserServiceTest.cs index 5aa3075..27426ad 100644 --- a/Submarine.Core.Test/Parser/Release/ReleaseParserServiceTest.cs +++ b/Submarine.Core.Test/Parser/Release/ReleaseParserServiceTest.cs @@ -37,11 +37,13 @@ public void Parse_ShouldParseAliases_WhenTitleContainsAKA(string input, string t Assert.Equal(title, parsed.Title); Assert.Equal(aliases, parsed.Aliases); } - + [Theory] [InlineData("Anime S01 2021 1080p WEB-DL AVC AAC 2.0 Dual Audio -ZR-", "Anime")] - [InlineData("The Anime Title (Japanese Alias) S01 2021 1080p WEB-DL AVC AAC 2.0 Dual Audio -ZR-", "The Anime Title")] - [InlineData("The Anime Title (Japanese Alias) S04E18 2022 1080p WEB-DL AVC AAC 2.0 Dual Audio -ZR-", "The Anime Title")] + [InlineData("The Anime Title (Japanese Alias) S01 2021 1080p WEB-DL AVC AAC 2.0 Dual Audio -ZR-", + "The Anime Title")] + [InlineData("The Anime Title (Japanese Alias) S04E18 2022 1080p WEB-DL AVC AAC 2.0 Dual Audio -ZR-", + "The Anime Title")] public void Parse_ShouldParseTitle_WhenReleaseIsAnime(string input, string title) { var parsed = _instance.Parse(input); @@ -57,10 +59,10 @@ public void Parse_ShouldParseTitle_WhenReleaseIsAnime(string input, string title public void Parse_ShouldIdentifySeries_WhenReleaseIsSeries(string input) { var parsed = _instance.Parse(input); - + Assert.Equal(ReleaseType.SERIES, parsed.Type); } - + [Theory] [InlineData("Movie Name AKA Other Movie Name 1983 1080p BluRay REMUX AVC FLAC 2.0-BLURANiUM")] [InlineData("Movie.Title.1987.1080p.BluRay.REMUX.DD+2.0.AVC")] @@ -69,7 +71,7 @@ public void Parse_ShouldIdentifySeries_WhenReleaseIsSeries(string input) public void Parse_ShouldIdentifyMovie_WhenReleaseIsMovie(string input) { var parsed = _instance.Parse(input); - + Assert.Equal(ReleaseType.MOVIE, parsed.Type); } @@ -79,27 +81,31 @@ public void Parse_ShouldParseAbsoluteEpisode_WhenReleaseIsAnime(string input, in { var parsed = _instance.Parse(input); - Assert.Contains(absoluteEpisode, parsed.SeriesReleaseData?.AbsoluteEpisodes ?? throw new InvalidOperationException()); + Assert.Contains(absoluteEpisode, + parsed.SeriesReleaseData?.AbsoluteEpisodes ?? throw new InvalidOperationException()); } [Theory] [InlineData("[HorribleSubs] Anime - 12 [1080p].mkv", QualitySource.WEB_DL)] [InlineData("[SubsPlease] Anime - 14 (1080p) [3168B4D7].mkv", QualitySource.WEB_DL)] - [InlineData("[Erai-raws] Anime 2nd Season - 11 [1080p][Multiple Subtitle] [ENG][POR-BR][SPA-LA][SPA][GER][ITA][RUS]", QualitySource.WEB_DL)] + [InlineData( + "[Erai-raws] Anime 2nd Season - 11 [1080p][Multiple Subtitle] [ENG][POR-BR][SPA-LA][SPA][GER][ITA][RUS]", + QualitySource.WEB_DL)] public void Parse_ShouldApplyEdgeCaseReleaseGroupQualitySourceMapping_WhenReleaseHasUnknownSourceAndGroupMatches( string input, QualitySource expected) { var parsed = _instance.Parse(input); - + Assert.Equal(expected, parsed.Quality.Resolution.Source); } [Theory] [InlineData("[Erai-raws] Anime - 01 ~ 24 [BD 720p][Multiple Subtitle]", QualitySource.BLURAY)] - public void Parse_ShouldNotApplyEdgeCaseReleaseGroupQualitySourceMapping_IfReleaseSpecifiesQualitySource(string input, QualitySource expected) + public void Parse_ShouldNotApplyEdgeCaseReleaseGroupQualitySourceMapping_IfReleaseSpecifiesQualitySource( + string input, QualitySource expected) { var parsed = _instance.Parse(input); - + Assert.Equal(expected, parsed.Quality.Resolution.Source); } } diff --git a/Submarine.Core.Test/Parser/StreamingProviderParserServiceTest.cs b/Submarine.Core.Test/Parser/StreamingProviderParserServiceTest.cs index 6af6e85..a263c2b 100644 --- a/Submarine.Core.Test/Parser/StreamingProviderParserServiceTest.cs +++ b/Submarine.Core.Test/Parser/StreamingProviderParserServiceTest.cs @@ -117,7 +117,7 @@ public void Parse_ShouldReturnStreamingProviderDCUniverse_WhenReleaseIsDCUnivers [InlineData("Show.Title.S04E04.Teambuilding.Exercise.720p.HBO.WEB-DL.DD5.1.H.264-monkee")] public void Parse_ShouldReturnStreamingProviderHBONow_WhenReleaseIsHBONow(string input) => AssertStreamingProvider(input, StreamingProvider.HBO_NOW); - + [Theory] [InlineData("Series.Title.S03E01.2160p.PMTP.WEB-DL.DDP5.1.HDR.HEVC-NTb")] [InlineData("Movie.2022.Hybrid.2160p.PMTP.WEB-DL.DDPA5.1.DV.HEVC-ShiNobi")] diff --git a/Submarine.Core.Test/Submarine.Core.Test.csproj b/Submarine.Core.Test/Submarine.Core.Test.csproj index 0473107..3ef0993 100644 --- a/Submarine.Core.Test/Submarine.Core.Test.csproj +++ b/Submarine.Core.Test/Submarine.Core.Test.csproj @@ -15,8 +15,8 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + runtime; build; native; contentfiles; analyzers; buildtransitive all @@ -28,7 +28,7 @@ - + diff --git a/Submarine.Core/Attributes/RegExAttribute.cs b/Submarine.Core/Attributes/RegExAttribute.cs index a6b6ea5..b2af6f7 100644 --- a/Submarine.Core/Attributes/RegExAttribute.cs +++ b/Submarine.Core/Attributes/RegExAttribute.cs @@ -4,18 +4,18 @@ namespace Submarine.Core.Attributes; /// -/// Attribute containing a regular expression +/// Attribute containing a regular expression /// [AttributeUsage(AttributeTargets.Field)] public class RegExAttribute : Attribute { /// - /// The regular expression + /// The regular expression /// public Regex Regex { get; } /// - /// Creates a new instance of + /// Creates a new instance of /// /// The regex as string /// Options of this Regex diff --git a/Submarine.Core/Database/ICreatable.cs b/Submarine.Core/Database/ICreatable.cs index 531df10..9da4938 100644 --- a/Submarine.Core/Database/ICreatable.cs +++ b/Submarine.Core/Database/ICreatable.cs @@ -3,12 +3,12 @@ namespace Submarine.Core.Database; /// -/// Interface which abstracts CreatedAt for Database entities +/// Interface which abstracts CreatedAt for Database entities /// public interface ICreatable { /// - /// When this entity was created in the database + /// When this entity was created in the database /// public DateTimeOffset CreatedAt { get; set; } } diff --git a/Submarine.Core/Database/IUpdatable.cs b/Submarine.Core/Database/IUpdatable.cs index fda9716..285d3d5 100644 --- a/Submarine.Core/Database/IUpdatable.cs +++ b/Submarine.Core/Database/IUpdatable.cs @@ -3,12 +3,12 @@ namespace Submarine.Core.Database; /// -/// Interface which abstracts UpdatedAt for Database entities +/// Interface which abstracts UpdatedAt for Database entities /// public interface IUpdatable { /// - /// When this entity was last updated in the Database + /// When this entity was last updated in the Database /// public DateTimeOffset UpdatedAt { get; set; } } diff --git a/Submarine.Core/Languages/Language.cs b/Submarine.Core/Languages/Language.cs index a19af5a..366b1d6 100644 --- a/Submarine.Core/Languages/Language.cs +++ b/Submarine.Core/Languages/Language.cs @@ -4,167 +4,167 @@ namespace Submarine.Core.Languages; /// -/// Language of a release +/// Language of a release /// public enum Language { /// - /// The English language + /// The English language /// ENGLISH, /// - /// The French language + /// The French language /// [RegEx("(?:FR[A]?|french)")] FRENCH, /// - /// The Spanish language + /// The Spanish language /// [RegEx("spanish")] SPANISH, /// - /// The German language + /// The German language /// [RegEx(@"(?:ger|german|videomann|deu)\b")] GERMAN, /// - /// The Italian language + /// The Italian language /// [RegEx(@"\b(?:ita|italian)\b")] ITALIAN, /// - /// The Danish language + /// The Danish language /// [RegEx("danish")] DANISH, /// - /// The Dutch language + /// The Dutch language /// [RegEx(@"\b(?:dutch)\b")] DUTCH, /// - /// The Japanese language + /// The Japanese language /// [RegEx(@"\b(?:japanese|jp)\b")] JAPANESE, /// - /// The Icelandic language + /// The Icelandic language /// [RegEx("icelandic")] ICELANDIC, /// - /// The Chinese language + /// The Chinese language /// [RegEx(@"\[(?:CH[ST]|BIG5|GB)\]|简|繁|字幕|chinese|cantonese|mandarin")] CHINESE, /// - /// The Russian language + /// The Russian language /// [RegEx(@"\b(?:russian|rus)\b")] RUSSIAN, /// - /// The Polish language + /// The Polish language /// [RegEx(@"\b(?:PL\W?DUB|DUB\W?PL|LEK\W?PL|PL\W?LEK|polish|PL|POL)\b")] POLISH, /// - /// The Vietnamese language + /// The Vietnamese language /// [RegEx("vietnamese")] VIETNAMESE, /// - /// The Swedish language + /// The Swedish language /// [RegEx("swedish")] SWEDISH, /// - /// The Norwegian language + /// The Norwegian language /// [RegEx("norwegian")] NORWEGIAN, /// - /// The Finnish language + /// The Finnish language /// [RegEx("finnish")] FINNISH, /// - /// The Turkish language + /// The Turkish language /// [RegEx("turkish")] TURKISH, /// - /// The Portuguese language + /// The Portuguese language /// [RegEx("portuguese")] PORTUGUESE, /// - /// The Flemish dialect for Dutch + /// The Flemish dialect for Dutch /// [RegEx("flemish")] FLEMISH, /// - /// The Greek language + /// The Greek language /// [RegEx("greek")] GREEK, /// - /// The Korean language + /// The Korean language /// [RegEx("(?:KR|korean)")] KOREAN, /// - /// The Hungarian language + /// The Hungarian language /// [RegEx(@"\b(?:HUNDUB|HUN)\b")] HUNGARIAN, /// - /// The Hebrew language + /// The Hebrew language /// [RegEx(@"\bHebDub\b")] HEBREW, /// - /// The Lithuanian language + /// The Lithuanian language /// [RegEx(@"\b(?:lithuanian|LT)\b")] LITHUANIAN, /// - /// The Czech language + /// The Czech language /// [RegEx(@"\bCZ\b", RegexOptions.Compiled)] CZECH, /// - /// The Arabic language + /// The Arabic language /// [RegEx("arabic")] ARABIC, /// - /// The Hindi language + /// The Hindi language /// [RegEx("hindi")] HINDI diff --git a/Submarine.Core/MediaFile/MediaFileConstants.cs b/Submarine.Core/MediaFile/MediaFileConstants.cs index 5824672..139aaf2 100644 --- a/Submarine.Core/MediaFile/MediaFileConstants.cs +++ b/Submarine.Core/MediaFile/MediaFileConstants.cs @@ -4,12 +4,12 @@ namespace Submarine.Core.MediaFile; /// -/// Constants related to MediaFiles +/// Constants related to MediaFiles /// public static class MediaFileConstants { /// - /// Extensions of media files + /// Extensions of media files /// public static readonly IImmutableSet MediaFileExtensions = new HashSet { diff --git a/Submarine.Core/Parser/IParser.cs b/Submarine.Core/Parser/IParser.cs index 3a93949..dbac643 100644 --- a/Submarine.Core/Parser/IParser.cs +++ b/Submarine.Core/Parser/IParser.cs @@ -1,13 +1,13 @@ namespace Submarine.Core.Parser; /// -/// A Parser which can parse a string into a specific type +/// A Parser which can parse a string into a specific type /// /// The type to parse to public interface IParser { /// - /// Parses the input into the specified type + /// Parses the input into the specified type /// /// The input string /// The generic interface type diff --git a/Submarine.Core/Parser/LanguageParserService.cs b/Submarine.Core/Parser/LanguageParserService.cs index 33c39a9..f1bb0ad 100644 --- a/Submarine.Core/Parser/LanguageParserService.cs +++ b/Submarine.Core/Parser/LanguageParserService.cs @@ -11,7 +11,7 @@ namespace Submarine.Core.Parser; /// -/// Service which Parses the language(s) of a release +/// Service which Parses the language(s) of a release /// public class LanguageParserService : IParser> { @@ -26,9 +26,9 @@ public class LanguageParserService : IParser> private readonly ILogger _logger; /// - /// Creates a new + /// Creates a new /// - /// The logger of this + /// The logger of this public LanguageParserService(ILogger logger) { _logger = logger; @@ -48,10 +48,10 @@ public LanguageParserService(ILogger logger) } /// - /// Parses the language(s) of a release + /// Parses the language(s) of a release /// /// The input string - /// a of Languages + /// a of Languages public IReadOnlyList Parse(string input) { _logger.LogDebug("Trying to parse language for {Input}", input); diff --git a/Submarine.Core/Parser/QualityParserService.cs b/Submarine.Core/Parser/QualityParserService.cs index be6db2b..98e1fec 100644 --- a/Submarine.Core/Parser/QualityParserService.cs +++ b/Submarine.Core/Parser/QualityParserService.cs @@ -6,7 +6,7 @@ namespace Submarine.Core.Parser; /// -/// Service which parses the Quality of a Release +/// Service which parses the Quality of a Release /// public class QualityParserService : IParser { @@ -86,15 +86,15 @@ public class QualityParserService : IParser private readonly ILogger _logger; /// - /// Creates a new + /// Creates a new /// - /// The Logger of this + /// The Logger of this public QualityParserService(ILogger logger) => _logger = logger; /// - /// Parses the Quality of a Release + /// Parses the Quality of a Release /// /// The Release name /// The QualityModel of that Release @@ -166,7 +166,8 @@ private QualityResolutionModel ParseResolutionModel(string normalizedName) // Handle Edge cases where there is no indicator if its a full disc or not besides the codecs if (FullBlurayCodecsRegex.IsMatch(normalizedName)) { - _logger.LogDebug("{Input} found no remux in name but AVC/HEVC as codec, setting source to bluray disc instead", + _logger.LogDebug( + "{Input} found no remux in name but AVC/HEVC as codec, setting source to bluray disc instead", normalizedName); return new QualityResolutionModel(QualitySource.BLURAY_DISK, resolution); diff --git a/Submarine.Core/Parser/Release/ReleaseGroupParserService.cs b/Submarine.Core/Parser/Release/ReleaseGroupParserService.cs index eaa3a30..6e6b878 100644 --- a/Submarine.Core/Parser/Release/ReleaseGroupParserService.cs +++ b/Submarine.Core/Parser/Release/ReleaseGroupParserService.cs @@ -5,7 +5,7 @@ namespace Submarine.Core.Parser.Release; /// -/// Services to parse the Release Group of a release +/// Services to parse the Release Group of a release /// public class ReleaseGroupParserService : IParser { @@ -22,14 +22,14 @@ public class ReleaseGroupParserService : IParser private readonly ILogger _logger; /// - /// Creates a new + /// Creates a new /// - /// The Logger of this + /// The Logger of this public ReleaseGroupParserService(ILogger logger) => _logger = logger; /// - /// Parses the Release Group of a release + /// Parses the Release Group of a release /// /// The Release /// The release group, if any diff --git a/Submarine.Core/Parser/Release/ReleaseParserService.cs b/Submarine.Core/Parser/Release/ReleaseParserService.cs index 6178ea7..3df7523 100644 --- a/Submarine.Core/Parser/Release/ReleaseParserService.cs +++ b/Submarine.Core/Parser/Release/ReleaseParserService.cs @@ -14,11 +14,13 @@ namespace Submarine.Core.Parser.Release; /// -/// Service which parses a release +/// Service which parses a release /// public class ReleaseParserService : IParser { - private static readonly Regex EditionRegex = new(@"\(?\b(?(((Recut.|Extended.|Ultimate.)?(Director.?s|Collector.?s|Theatrical|Ultimate|Extended|Despecialized|(Special|Rouge|Final|Assembly|Imperial|Diamond|Signature|Hunter|Rekall)(?=(.(Cut|Edition|Version)))|\d{2,3}(th)?.Anniversary)(?:.(Cut|Edition|Version))?(.(Extended|Uncensored|Remastered|Unrated|Uncut|IMAX|Fan.?Edit))?|((Uncensored|Remastered|Unrated|Uncut|IMAX|Fan.?Edit|Restored|((2|3|4)in1))))))\b\)?", RegexOptions.Compiled | RegexOptions.IgnoreCase); + private static readonly Regex EditionRegex = new( + @"\(?\b(?(((Recut.|Extended.|Ultimate.)?(Director.?s|Collector.?s|Theatrical|Ultimate|Extended|Despecialized|(Special|Rouge|Final|Assembly|Imperial|Diamond|Signature|Hunter|Rekall)(?=(.(Cut|Edition|Version)))|\d{2,3}(th)?.Anniversary)(?:.(Cut|Edition|Version))?(.(Extended|Uncensored|Remastered|Unrated|Uncut|IMAX|Fan.?Edit))?|((Uncensored|Remastered|Unrated|Uncut|IMAX|Fan.?Edit|Restored|((2|3|4)in1))))))\b\)?", + RegexOptions.Compiled | RegexOptions.IgnoreCase); private static readonly RegexReplace WebsitePrefixRegex = new( @"^\[\s*[-a-z]+(\.[a-z]+)+\s*\][- ]*|^www\.[a-z]+\.(?:com|net|org)[ -]*", @@ -148,8 +150,10 @@ public class ReleaseParserService : IParser RegexOptions.IgnoreCase | RegexOptions.Compiled), //Anime - Title (Optional Alias) Season/Episode Year - new(@"^(?.+?)[-_. ](?<alias>\(.+?\))?[-_. ]?(S?(?<season>(?<!\d+)(?:\d{1,2}|\d{4})(?!\d+))(?:(?:[-_ ]?[ex])(?<episode>\d{2,3}(?!\d+)))?)[-_. ](?<titleyear>\d{4})[-_. ]", RegexOptions.IgnoreCase | RegexOptions.Compiled), - + new( + @"^(?<title>.+?)[-_. ](?<alias>\(.+?\))?[-_. ]?(S?(?<season>(?<!\d+)(?:\d{1,2}|\d{4})(?!\d+))(?:(?:[-_ ]?[ex])(?<episode>\d{2,3}(?!\d+)))?)[-_. ](?<titleyear>\d{4})[-_. ]", + RegexOptions.IgnoreCase | RegexOptions.Compiled), + //Anime - Title Season EpisodeNumber + Absolute Episode Number [SubGroup] new( @"^(?<title>.+?)(?:[-_\W](?<![()\[!]))+(?:S?(?<season>(?<!\d+)\d{1,2}(?!\d+))(?:(?:[ex]|\W[ex]|-){1,2}(?<episode>(?<!\d+)\d{2}(?!\d+)))+)[-_. (]+?(?:[-_. ]?(?<absoluteepisode>(?<!\d+)\d{3}(\.\d{1,2})?(?!\d+|[pi])))+.+?\[(?<subgroup>.+?)\](?:$|\.mkv)", @@ -218,7 +222,7 @@ public class ReleaseParserService : IParser<BaseRelease> new( @"^(?<title>.+?)(?:\W+S(?<season>(?<!\d+)(?:\d{1,2})(?!\d+))\W+(?:(?:Part\W?|(?<!\d+\W+)e)(?<seasonpart>\d{1,2}(?!\d+)))+)", RegexOptions.IgnoreCase | RegexOptions.Compiled), - + //Anime - Title 4-digit Absolute Episode Number [SubGroup] new(@"^(?<title>.+?)[-_. ]+(?<absoluteepisode>(?<!\d+)\d{4}(?!\d+))[-_. ]\[(?<subgroup>.+?)\]", RegexOptions.IgnoreCase | RegexOptions.Compiled), @@ -417,44 +421,63 @@ public class ReleaseParserService : IParser<BaseRelease> @"^(?:\[(?<subgroup>.+?)\][-_. ])?(?<title>.+?)[-_. ]+?[\[(](?:S|Season|Saison|Series)[-_. ]?(?<season>\d{1,2}(?![-_. ]?\d+))(?:[-_. )\]]|$)+(?<extras>EXTRAS|SUBPACK)?(?!\\)", RegexOptions.IgnoreCase | RegexOptions.Compiled) }; - - private static readonly Regex[] ReportMovieTitleRegex = { - //Anime [Subgroup] and Year - new(@"^(?:\[(?<subgroup>.+?)\][-_. ]?)(?<title>(?![(\[]).+?)?(?:(?:[-_\W](?<![)\[!]))*(?<year>(1(8|9)|20)\d{2}(?!p|i|x|\d+|\]|\W\d+)))+.*?(?<hash>\[\w{8}\])?(?:$|\.)", RegexOptions.IgnoreCase | RegexOptions.Compiled), - //Anime [Subgroup] no year, versioned title, hash - new(@"^(?:\[(?<subgroup>.+?)\][-_. ]?)(?<title>(?![(\[]).+?)((v)(?:\d{1,2})(?:([-_. ])))(\[.*)?(?:[\[(][^])])?.*?(?<hash>\[\w{8}\])(?:$|\.)", RegexOptions.IgnoreCase | RegexOptions.Compiled), + private static readonly Regex[] ReportMovieTitleRegex = + { + //Anime [Subgroup] and Year + new( + @"^(?:\[(?<subgroup>.+?)\][-_. ]?)(?<title>(?![(\[]).+?)?(?:(?:[-_\W](?<![)\[!]))*(?<year>(1(8|9)|20)\d{2}(?!p|i|x|\d+|\]|\W\d+)))+.*?(?<hash>\[\w{8}\])?(?:$|\.)", + RegexOptions.IgnoreCase | RegexOptions.Compiled), - //Anime [Subgroup] no year, info in double sets of brackets, hash - new(@"^(?:\[(?<subgroup>.+?)\][-_. ]?)(?<title>(?![(\[]).+?)(\[.*).*?(?<hash>\[\w{8}\])(?:$|\.)", RegexOptions.IgnoreCase | RegexOptions.Compiled), + //Anime [Subgroup] no year, versioned title, hash + new( + @"^(?:\[(?<subgroup>.+?)\][-_. ]?)(?<title>(?![(\[]).+?)((v)(?:\d{1,2})(?:([-_. ])))(\[.*)?(?:[\[(][^])])?.*?(?<hash>\[\w{8}\])(?:$|\.)", + RegexOptions.IgnoreCase | RegexOptions.Compiled), - //Anime [Subgroup] no year, info in parentheses or brackets, hash - new(@"^(?:\[(?<subgroup>.+?)\][-_. ]?)(?<title>(?![(\[]).+)(?:[\[(][^])]).*?(?<hash>\[\w{8}\])(?:$|\.)", RegexOptions.IgnoreCase | RegexOptions.Compiled), + //Anime [Subgroup] no year, info in double sets of brackets, hash + new(@"^(?:\[(?<subgroup>.+?)\][-_. ]?)(?<title>(?![(\[]).+?)(\[.*).*?(?<hash>\[\w{8}\])(?:$|\.)", + RegexOptions.IgnoreCase | RegexOptions.Compiled), - //Some german or french tracker formats (missing year, ...) (Only applies to german and TrueFrench releases) - see ParserFixture for examples and tests - french removed as it broke all movies w/ french titles - new(@"^(?<title>(?![(\[]).+?)((\W|_))(" + EditionRegex + @".{1,3})?(?:(?<!(19|20)\d{2}.*?)(German|TrueFrench))(.+?)(?=((19|20)\d{2}|$))(?<year>(19|20)\d{2}(?!p|i|\d+|\]|\W\d+))?(\W+|_|$)(?!\\)", RegexOptions.IgnoreCase | RegexOptions.Compiled), + //Anime [Subgroup] no year, info in parentheses or brackets, hash + new(@"^(?:\[(?<subgroup>.+?)\][-_. ]?)(?<title>(?![(\[]).+)(?:[\[(][^])]).*?(?<hash>\[\w{8}\])(?:$|\.)", + RegexOptions.IgnoreCase | RegexOptions.Compiled), - //Special, Despecialized, etc. Edition Movies, e.g: Mission.Impossible.3.Special.Edition.2011 - new(@"^(?<title>(?![(\[]).+?)?(?:(?:[-_\W](?<![)\[!]))*" + EditionRegex + @".{1,3}(?<year>(1(8|9)|20)\d{2}(?!p|i|\d+|\]|\W\d+)))+(\W+|_|$)(?!\\)", - RegexOptions.IgnoreCase | RegexOptions.Compiled), + //Some german or french tracker formats (missing year, ...) (Only applies to german and TrueFrench releases) - see ParserFixture for examples and tests - french removed as it broke all movies w/ french titles + new( + @"^(?<title>(?![(\[]).+?)((\W|_))(" + EditionRegex + + @".{1,3})?(?:(?<!(19|20)\d{2}.*?)(German|TrueFrench))(.+?)(?=((19|20)\d{2}|$))(?<year>(19|20)\d{2}(?!p|i|\d+|\]|\W\d+))?(\W+|_|$)(?!\\)", + RegexOptions.IgnoreCase | RegexOptions.Compiled), - //Normal movie format, e.g: Mission.Impossible.3.2011 - new(@"^(?<title>(?![(\[]).+?)?(?:(?:[-_\W](?<![)\[!]))*(?<year>(1(8|9)|20)\d{2}(?!p|i|(1(8|9)|20)\d{2}|\]|\W(1(8|9)|20)\d{2})))+(\W+|_|$)(?!\\)", RegexOptions.IgnoreCase | RegexOptions.Compiled), + //Special, Despecialized, etc. Edition Movies, e.g: Mission.Impossible.3.Special.Edition.2011 + new( + @"^(?<title>(?![(\[]).+?)?(?:(?:[-_\W](?<![)\[!]))*" + EditionRegex + + @".{1,3}(?<year>(1(8|9)|20)\d{2}(?!p|i|\d+|\]|\W\d+)))+(\W+|_|$)(?!\\)", + RegexOptions.IgnoreCase | RegexOptions.Compiled), + + //Normal movie format, e.g: Mission.Impossible.3.2011 + new( + @"^(?<title>(?![(\[]).+?)?(?:(?:[-_\W](?<![)\[!]))*(?<year>(1(8|9)|20)\d{2}(?!p|i|(1(8|9)|20)\d{2}|\]|\W(1(8|9)|20)\d{2})))+(\W+|_|$)(?!\\)", + RegexOptions.IgnoreCase | RegexOptions.Compiled), - //PassThePopcorn Torrent names: Star.Wars[PassThePopcorn] - new(@"^(?<title>.+?)?(?:(?:[-_\W](?<![()\[!]))*(?<year>(\[\w *\])))+(\W+|_|$)(?!\\)", RegexOptions.IgnoreCase | RegexOptions.Compiled), + //PassThePopcorn Torrent names: Star.Wars[PassThePopcorn] + new(@"^(?<title>.+?)?(?:(?:[-_\W](?<![()\[!]))*(?<year>(\[\w *\])))+(\W+|_|$)(?!\\)", + RegexOptions.IgnoreCase | RegexOptions.Compiled), - //That did not work? Maybe some tool uses [] for years. Who would do that? - new(@"^(?<title>(?![(\[]).+?)?(?:(?:[-_\W](?<![)!]))*(?<year>(1(8|9)|20)\d{2}(?!p|i|\d+|\W\d+)))+(\W+|_|$)(?!\\)", RegexOptions.IgnoreCase | RegexOptions.Compiled), + //That did not work? Maybe some tool uses [] for years. Who would do that? + new( + @"^(?<title>(?![(\[]).+?)?(?:(?:[-_\W](?<![)!]))*(?<year>(1(8|9)|20)\d{2}(?!p|i|\d+|\W\d+)))+(\W+|_|$)(?!\\)", + RegexOptions.IgnoreCase | RegexOptions.Compiled), - //As a last resort for movies that have ( or [ in their title. - new(@"^(?<title>.+?)?(?:(?:[-_\W](?<![)\[!]))*(?<year>(1(8|9)|20)\d{2}(?!p|i|\d+|\]|\W\d+)))+(\W+|_|$)(?!\\)", RegexOptions.IgnoreCase | RegexOptions.Compiled) - }; + //As a last resort for movies that have ( or [ in their title. + new(@"^(?<title>.+?)?(?:(?:[-_\W](?<![)\[!]))*(?<year>(1(8|9)|20)\d{2}(?!p|i|\d+|\]|\W\d+)))+(\W+|_|$)(?!\\)", + RegexOptions.IgnoreCase | RegexOptions.Compiled) + }; - private static readonly Regex[] ReportMovieTitleFolderRegex = { - //When year comes first. - new(@"^(?:(?:[-_\W](?<![)!]))*(?<year>(19|20)\d{2}(?!p|i|\d+|\W\d+)))+(\W+|_|$)(?<title>.+?)?$") - }; + private static readonly Regex[] ReportMovieTitleFolderRegex = + { + //When year comes first. + new(@"^(?:(?:[-_\W](?<![)!]))*(?<year>(19|20)\d{2}(?!p|i|\d+|\W\d+)))+(\W+|_|$)(?<title>.+?)?$") + }; //Regex to split titles that contain `AKA`. private static readonly Regex AlternativeTitleRegex = @@ -499,10 +522,10 @@ public ReleaseParserService( } /// <summary> - /// Parse a BaseRelease from a Release Title. + /// Parse a BaseRelease from a Release Title. /// </summary> /// <param name="input">The Release Title</param> - /// <returns>A <see cref="BaseRelease"/></returns> + /// <returns>A <see cref="BaseRelease" /></returns> /// <exception cref="ArgumentOutOfRangeException">If an Enum is out of range</exception> public BaseRelease Parse(string input) { @@ -536,9 +559,13 @@ public BaseRelease Parse(string input) _logger.LogDebug("Skipping Parsing of Streaming Provider for {Input} since Quality is not WebDL or WebRip", input); - if (quality.Resolution.Source is QualitySource.UNKNOWN && releaseGroup != null && QualityEdgeCasesConstants.EdgeCaseReleaseGroupQualitySourceMapping.TryGetValue(releaseGroup, out var qualitySource)) + if (quality.Resolution.Source is QualitySource.UNKNOWN && releaseGroup != null && + QualityEdgeCasesConstants.EdgeCaseReleaseGroupQualitySourceMapping.TryGetValue(releaseGroup, + out var qualitySource)) { - _logger.LogDebug("{Input} quality source is UNKNOWN but release group has edge case source mapping, applying default source instead", input); + _logger.LogDebug( + "{Input} quality source is UNKNOWN but release group has edge case source mapping, applying default source instead", + input); quality.Resolution.Source = qualitySource; } @@ -555,17 +582,18 @@ public BaseRelease Parse(string input) var (_, _, seasons, episodes, absoluteEpisodes, _, _, _) = seriesTitleMetadata; type = ReleaseType.SERIES; - + var parsedSeasons = seasons != null ? (IReadOnlyList<int>)seasons : new List<int>(); var parsedEpisodes = episodes != null ? (IReadOnlyList<int>)episodes : new List<int>(); - var parsedAbsoluteEpisodes = absoluteEpisodes != null ? (IReadOnlyList<int>)absoluteEpisodes : new List<int>(); + var parsedAbsoluteEpisodes = + absoluteEpisodes != null ? (IReadOnlyList<int>)absoluteEpisodes : new List<int>(); var seriesReleaseType = parsedSeasons.Count switch { > 1 => SeriesReleaseType.MULTI_SEASON, 1 when parsedEpisodes.Count == 0 => SeriesReleaseType.FULL_SEASON, 1 when parsedEpisodes.Count > 1 => SeriesReleaseType.PARTIAL_SEASON, - 0 or 1 when parsedEpisodes.Count == 1 => SeriesReleaseType.EPISODE, + 0 or 1 when parsedEpisodes.Count == 1 => SeriesReleaseType.EPISODE, 0 when parsedAbsoluteEpisodes.Count > 1 => SeriesReleaseType.MULTI_EPISODES, 0 when parsedAbsoluteEpisodes.Count == 1 => SeriesReleaseType.EPISODE, _ => throw new ArgumentOutOfRangeException() @@ -583,7 +611,7 @@ public BaseRelease Parse(string input) case MovieTitleMetadata movieTitleMetadata: { type = ReleaseType.MOVIE; - + break; } } @@ -603,7 +631,7 @@ public BaseRelease Parse(string input) SeriesReleaseData = seriesReleaseData, MovieReleaseData = movieReleaseData }; - + return release; } @@ -624,7 +652,6 @@ private TitleMetadata ParseTitle(string input) titles.RemoveAt(titles.Count - 1); if (!ContainsSeriesInformationRegex.IsMatch(parsableTitle)) - { foreach (var regex in ReportMovieTitleRegex.Concat(ReportMovieTitleFolderRegex)) { var match = regex.Matches(parsableTitle); @@ -637,32 +664,26 @@ private TitleMetadata ParseTitle(string input) var year = matched.Groups["titleyear"]?.Value; string? group = null; string? hash = null; - + var subGroup = matched.Groups["subgroup"]; - if (subGroup.Success) - { - group = subGroup.Value; - } - + if (subGroup.Success) group = subGroup.Value; + var hashGroup = matched.Groups["hash"]; if (hashGroup.Success) { var hashValue = hashGroup.Value.Trim('[', ']'); - if (!hashValue.Equals("1280x720")) - { - hash = hashValue; - } + if (!hashValue.Equals("1280x720")) hash = hashValue; } if (title.IsNotNullOrWhitespace()) - return new MovieTitleMetadata(title, titles.Select(t => t.NormalizeReleaseTitle()).ToList(), year, + return new MovieTitleMetadata(title, titles.Select(t => t.NormalizeReleaseTitle()).ToList(), + year, group, hash, null); } } - } foreach (var regex in ReportSeriesTitleRegex) { @@ -686,11 +707,8 @@ private TitleMetadata ParseTitle(string input) var episodeCaptures = matched.Groups["episode"].Captures.ToList(); var absoluteEpisodeCaptures = matched.Groups["absoluteepisode"].Captures.ToList(); - if (seasonCaptures.Any()) - { - seasons.AddRange(seasonCaptures.Select(s => s.Value.ToInteger())); - } - + if (seasonCaptures.Any()) seasons.AddRange(seasonCaptures.Select(s => s.Value.ToInteger())); + //Allows use to return a list of 0 episodes (We can handle that as a full season release) if (episodeCaptures.Any()) { @@ -698,23 +716,21 @@ private TitleMetadata ParseTitle(string input) var last = episodeCaptures.Last().Value.ToInteger(); if (first > last) - { - throw new InvalidReleaseException("First episode is greater than last one (invalid release or multiple seasons maybe?)"); - } + throw new InvalidReleaseException( + "First episode is greater than last one (invalid release or multiple seasons maybe?)"); var count = last - first + 1; episodes.AddRange(Enumerable.Range(first, count)); } - + if (absoluteEpisodeCaptures.Any()) { var first = absoluteEpisodeCaptures.First().Value.ToDecimal(); var last = absoluteEpisodeCaptures.Last().Value.ToDecimal(); if (first > last) - { - throw new InvalidReleaseException("First absolute episode is greater than last one (invalid release or multiple seasons maybe?)"); - } + throw new InvalidReleaseException( + "First absolute episode is greater than last one (invalid release or multiple seasons maybe?)"); if (first % 1 != 0 || last % 1 != 0) { @@ -729,34 +745,26 @@ private TitleMetadata ParseTitle(string input) var count = last - first + 1; absoluteEpisodes.AddRange(Enumerable.Range((int)first, (int)count).ToArray()); - if (matched.Groups["special"].Success) - { - special = true; - } + if (matched.Groups["special"].Success) special = true; } } - + var subGroup = matched.Groups["subgroup"]; - if (subGroup.Success) - { - group = subGroup.Value; - } - + if (subGroup.Success) group = subGroup.Value; + var hashGroup = matched.Groups["hash"]; if (hashGroup.Success) { var hashValue = hashGroup.Value.Trim('[', ']'); - if (!hashValue.Equals("1280x720")) - { - hash = hashValue; - } + if (!hashValue.Equals("1280x720")) hash = hashValue; } if (title.IsNotNullOrWhitespace()) - return new SeriesTitleMetadata(title, titles.Select(t => t.NormalizeReleaseTitle()).ToList(), seasons, episodes, absoluteEpisodes, year, group, hash); + return new SeriesTitleMetadata(title, titles.Select(t => t.NormalizeReleaseTitle()).ToList(), + seasons, episodes, absoluteEpisodes, year, group, hash); } } diff --git a/Submarine.Core/Parser/Release/TorrentReleaseParserService.cs b/Submarine.Core/Parser/Release/TorrentReleaseParserService.cs index 40e8c1e..c156c3e 100644 --- a/Submarine.Core/Parser/Release/TorrentReleaseParserService.cs +++ b/Submarine.Core/Parser/Release/TorrentReleaseParserService.cs @@ -7,7 +7,7 @@ namespace Submarine.Core.Parser.Release; /// <summary> -/// Service to parse a release with Bittorrent standards +/// Service to parse a release with Bittorrent standards /// </summary> public class TorrentReleaseParserService : IParser<TorrentRelease> { @@ -21,10 +21,10 @@ public class TorrentReleaseParserService : IParser<TorrentRelease> private readonly IParser<BaseRelease> _releaseParserService; /// <summary> - /// Creates a new <see cref="TorrentReleaseParserService"/> + /// Creates a new <see cref="TorrentReleaseParserService" /> /// </summary> - /// <param name="logger">The <see cref="ILogger{TCategoryName}"/></param> - /// <param name="releaseParserService">The <see cref="ReleaseParserService"/></param> + /// <param name="logger">The <see cref="ILogger{TCategoryName}" /></param> + /// <param name="releaseParserService">The <see cref="ReleaseParserService" /></param> public TorrentReleaseParserService( ILogger<TorrentReleaseParserService> logger, IParser<BaseRelease> releaseParserService) @@ -34,10 +34,10 @@ public TorrentReleaseParserService( } /// <summary> - /// Parses a release with Bittorrent standards + /// Parses a release with Bittorrent standards /// </summary> /// <param name="input">Release Title</param> - /// <returns>A <see cref="TorrentRelease"/></returns> + /// <returns>A <see cref="TorrentRelease" /></returns> public TorrentRelease Parse(string input) { _logger.LogDebug("Starting parse of {Input} with Bittorrent standards", input); diff --git a/Submarine.Core/Parser/Release/UsenetReleaseParserService.cs b/Submarine.Core/Parser/Release/UsenetReleaseParserService.cs index f2f2a60..d2bffba 100644 --- a/Submarine.Core/Parser/Release/UsenetReleaseParserService.cs +++ b/Submarine.Core/Parser/Release/UsenetReleaseParserService.cs @@ -10,7 +10,7 @@ namespace Submarine.Core.Parser.Release; /// <summary> -/// Service to parse a release with Usenet standards +/// Service to parse a release with Usenet standards /// </summary> public class UsenetReleaseParserService : IParser<UsenetRelease> { @@ -30,11 +30,11 @@ public class UsenetReleaseParserService : IParser<UsenetRelease> private readonly UsenetReleaseValidatorService _usenetReleaseValidatorService; /// <summary> - /// Creates a new <see cref="UsenetReleaseParserService"/> + /// Creates a new <see cref="UsenetReleaseParserService" /> /// </summary> - /// <param name="logger">The <see cref="ILogger{TCategoryName}"/></param> - /// <param name="usenetReleaseValidatorService">The <see cref="UsenetReleaseValidatorService"/></param> - /// <param name="releaseParserService">The <see cref="ReleaseParserService"/></param> + /// <param name="logger">The <see cref="ILogger{TCategoryName}" /></param> + /// <param name="usenetReleaseValidatorService">The <see cref="UsenetReleaseValidatorService" /></param> + /// <param name="releaseParserService">The <see cref="ReleaseParserService" /></param> public UsenetReleaseParserService( ILogger<UsenetReleaseParserService> logger, UsenetReleaseValidatorService usenetReleaseValidatorService, @@ -46,10 +46,10 @@ public UsenetReleaseParserService( } /// <summary> - /// Parses a release with Usenet standards + /// Parses a release with Usenet standards /// </summary> /// <param name="input">Release Title</param> - /// <returns>a <see cref="UsenetRelease"/></returns> + /// <returns>a <see cref="UsenetRelease" /></returns> public UsenetRelease Parse(string input) { _logger.LogDebug("Starting parse of {Input} with Usenet standards", input); diff --git a/Submarine.Core/Parser/StreamingProviderParserService.cs b/Submarine.Core/Parser/StreamingProviderParserService.cs index 4f8939b..0296f39 100644 --- a/Submarine.Core/Parser/StreamingProviderParserService.cs +++ b/Submarine.Core/Parser/StreamingProviderParserService.cs @@ -9,7 +9,7 @@ namespace Submarine.Core.Parser; /// <summary> -/// Service which parses the Streaming Provider of releases +/// Service which parses the Streaming Provider of releases /// </summary> public class StreamingProviderParserService : IParser<StreamingProvider?> { @@ -18,9 +18,9 @@ public class StreamingProviderParserService : IParser<StreamingProvider?> private readonly Dictionary<StreamingProvider, Regex> _streamingProviderRegexes; /// <summary> - /// Creates a new <see cref="StreamingProviderParserService"/> + /// Creates a new <see cref="StreamingProviderParserService" /> /// </summary> - /// <param name="logger">The logger of this <see cref="StreamingProviderParserService"/></param> + /// <param name="logger">The logger of this <see cref="StreamingProviderParserService" /></param> /// <exception cref="InvalidOperationException">if an StreamingProvider enum member has no Regex Attribute present</exception> public StreamingProviderParserService(ILogger<StreamingProviderParserService> logger) { @@ -38,7 +38,7 @@ public StreamingProviderParserService(ILogger<StreamingProviderParserService> lo } /// <summary> - /// Parses the Streaming Provider of a release, if any is present + /// Parses the Streaming Provider of a release, if any is present /// </summary> /// <param name="input">The Release name</param> /// <returns>The parsed Streaming Provider, if any</returns> diff --git a/Submarine.Core/Provider/UsenetIndexer.cs b/Submarine.Core/Provider/UsenetIndexer.cs index d14e460..e3e93e9 100644 --- a/Submarine.Core/Provider/UsenetIndexer.cs +++ b/Submarine.Core/Provider/UsenetIndexer.cs @@ -1,7 +1,8 @@ namespace Submarine.Core.Provider; /// <summary> -/// A Usenet Indexer is a Provider which serves <see href="https://en.wikipedia.org/wiki/NZB">NZB</see> files to download via <see cref="Protocol.USENET" /> +/// A Usenet Indexer is a Provider which serves <see href="https://en.wikipedia.org/wiki/NZB">NZB</see> files to +/// download via <see cref="Protocol.USENET" /> /// </summary> public class UsenetIndexer : Provider { diff --git a/Submarine.Core/Quality/Attributes/DisplayNameAttribute.cs b/Submarine.Core/Quality/Attributes/DisplayNameAttribute.cs index 9e53b39..ccbfd95 100644 --- a/Submarine.Core/Quality/Attributes/DisplayNameAttribute.cs +++ b/Submarine.Core/Quality/Attributes/DisplayNameAttribute.cs @@ -3,18 +3,18 @@ namespace Submarine.Core.Quality.Attributes; /// <summary> -/// Attribute to specify the display name of an enum value +/// Attribute to specify the display name of an enum value /// </summary> [AttributeUsage(AttributeTargets.Field)] public class DisplayNameAttribute : Attribute { /// <summary> - /// The display name of the enum value + /// The display name of the enum value /// </summary> public string Name { get; } /// <summary> - /// Creates a new instance of <see cref="DisplayNameAttribute"/> + /// Creates a new instance of <see cref="DisplayNameAttribute" /> /// </summary> /// <param name="name">The display name of the enum value</param> public DisplayNameAttribute(string name) diff --git a/Submarine.Core/Quality/Attributes/ResolutionAttribute.cs b/Submarine.Core/Quality/Attributes/ResolutionAttribute.cs index 345c538..688d228 100644 --- a/Submarine.Core/Quality/Attributes/ResolutionAttribute.cs +++ b/Submarine.Core/Quality/Attributes/ResolutionAttribute.cs @@ -3,18 +3,18 @@ namespace Submarine.Core.Quality.Attributes; /// <summary> -/// Attribute to specify the Resolution a Quality is available in +/// Attribute to specify the Resolution a Quality is available in /// </summary> [AttributeUsage(AttributeTargets.Field)] public class ResolutionAttribute : Attribute { /// <summary> - /// The Resolutions this Quality is available in + /// The Resolutions this Quality is available in /// </summary> public QualityResolution[] Resolutions { get; } /// <summary> - /// Creates a new instance of <see cref="ResolutionAttribute"/> + /// Creates a new instance of <see cref="ResolutionAttribute" /> /// </summary> /// <param name="resolutions">The Resolutions this Quality is available in</param> public ResolutionAttribute(params QualityResolution[] resolutions) diff --git a/Submarine.Core/Quality/QualityEdgeCasesConstants.cs b/Submarine.Core/Quality/QualityEdgeCasesConstants.cs index eab9ffb..c63b4f9 100644 --- a/Submarine.Core/Quality/QualityEdgeCasesConstants.cs +++ b/Submarine.Core/Quality/QualityEdgeCasesConstants.cs @@ -4,7 +4,7 @@ namespace Submarine.Core.Quality; /// <summary> -/// Constants related to QualityEdgeCases +/// Constants related to QualityEdgeCases /// </summary> public static class QualityEdgeCasesConstants { diff --git a/Submarine.Core/Quality/QualityModel.cs b/Submarine.Core/Quality/QualityModel.cs index ab40da7..1490f09 100644 --- a/Submarine.Core/Quality/QualityModel.cs +++ b/Submarine.Core/Quality/QualityModel.cs @@ -1,7 +1,7 @@ namespace Submarine.Core.Quality; /// <summary> -/// Contains the QualityResolution and Revision of a Quality +/// Contains the QualityResolution and Revision of a Quality /// </summary> /// <param name="Resolution">The QualityResolution of this QualityModel</param> /// <param name="Revision">The Revision of this QualityModel</param> diff --git a/Submarine.Core/Quality/QualityResolution.cs b/Submarine.Core/Quality/QualityResolution.cs index f7c570a..478d60e 100644 --- a/Submarine.Core/Quality/QualityResolution.cs +++ b/Submarine.Core/Quality/QualityResolution.cs @@ -1,42 +1,42 @@ namespace Submarine.Core.Quality; /// <summary> -/// Standardized Resolution enum +/// Standardized Resolution enum /// </summary> public enum QualityResolution { /// <summary> - /// 360p <see href="https://en.wikipedia.org/wiki/Low-definition_television"/> + /// 360p <see href="https://en.wikipedia.org/wiki/Low-definition_television" /> /// </summary> R360_P, /// <summary> - /// 480p <see href="https://en.wikipedia.org/wiki/Enhanced-definition_television"/> + /// 480p <see href="https://en.wikipedia.org/wiki/Enhanced-definition_television" /> /// </summary> R480_P, /// <summary> - /// 540p <see href="https://en.wikipedia.org/wiki/Enhanced-definition_television"/> + /// 540p <see href="https://en.wikipedia.org/wiki/Enhanced-definition_television" /> /// </summary> R540_P, /// <summary> - /// 576p <see href="https://en.wikipedia.org/wiki/576p"/>, quite uncommon but used on some Streaming Services + /// 576p <see href="https://en.wikipedia.org/wiki/576p" />, quite uncommon but used on some Streaming Services /// </summary> R576_P, /// <summary> - /// 720p <see href="https://en.wikipedia.org/wiki/720p"/> + /// 720p <see href="https://en.wikipedia.org/wiki/720p" /> /// </summary> R720_P, /// <summary> - /// 1080p <see href="https://en.wikipedia.org/wiki/1080p"/> + /// 1080p <see href="https://en.wikipedia.org/wiki/1080p" /> /// </summary> R1080_P, /// <summary> - /// 2160p (also known as 4K) <see href="https://en.wikipedia.org/wiki/4K_resolution"/> + /// 2160p (also known as 4K) <see href="https://en.wikipedia.org/wiki/4K_resolution" /> /// </summary> R2160_P } diff --git a/Submarine.Core/Quality/QualityResolutionModel.cs b/Submarine.Core/Quality/QualityResolutionModel.cs index a59dcd4..6ddfa6a 100644 --- a/Submarine.Core/Quality/QualityResolutionModel.cs +++ b/Submarine.Core/Quality/QualityResolutionModel.cs @@ -6,7 +6,7 @@ namespace Submarine.Core.Quality; /// <summary> -/// A QualityResolutionModel is a combination of a QualitySource and a QualityResolution +/// A QualityResolutionModel is a combination of a QualitySource and a QualityResolution /// </summary> public class QualityResolutionModel { @@ -19,28 +19,28 @@ public class QualityResolutionModel .ToArray(); /// <summary> - /// The Source of this QualityResolutionModel + /// The Source of this QualityResolutionModel /// </summary> public QualitySource? Source { get; set; } /// <summary> - /// The Resolution of this QualityResolutionModel + /// The Resolution of this QualityResolutionModel /// </summary> public QualityResolution? Resolution { get; set; } /// <summary> - /// The Name of this QualityResolutionModel, using the Display Name if possible + /// The Name of this QualityResolutionModel, using the Display Name if possible /// </summary> public string Name => $"{QualitySourceName ?? Source.ToString()}{(Resolution != null ? $"-{ResolutionHumanReadable}" : "")}"; /// <summary> - /// The Display Name of the QualitySource, if existing + /// The Display Name of the QualitySource, if existing /// </summary> private string? QualitySourceName { get; } /// <summary> - /// The Resolution of this QualityResolutionModel, in a human readable format + /// The Resolution of this QualityResolutionModel, in a human readable format /// </summary> private string? ResolutionHumanReadable => Resolution?.ToString() @@ -50,7 +50,7 @@ private string? ResolutionHumanReadable /// <summary> - /// Create a new QualityResolutionModel + /// Create a new QualityResolutionModel /// </summary> /// <param name="source">The source</param> /// <param name="resolution">The resolution</param> diff --git a/Submarine.Core/Quality/QualitySource.cs b/Submarine.Core/Quality/QualitySource.cs index 9f8ddea..14ee5c7 100644 --- a/Submarine.Core/Quality/QualitySource.cs +++ b/Submarine.Core/Quality/QualitySource.cs @@ -3,39 +3,40 @@ namespace Submarine.Core.Quality; /// <summary> -/// Sources of a Release Quality +/// Sources of a Release Quality /// </summary> public enum QualitySource { /// <summary> - /// The source is unknown + /// The source is unknown /// </summary> UNKNOWN, /// <summary> - /// The source is a Cam-rip <see href="https://en.wikipedia.org/wiki/Cam_(bootleg)"/> + /// The source is a Cam-rip <see href="https://en.wikipedia.org/wiki/Cam_(bootleg)" /> /// </summary> CAM, /// <summary> - /// The source is recording from a TV + /// The source is recording from a TV /// </summary> [Resolution(QualityResolution.R480_P, QualityResolution.R720_P, QualityResolution.R1080_P, QualityResolution.R2160_P)] TV, /// <summary> - /// The source is a DVD + /// The source is a DVD /// </summary> DVD, /// <summary> - /// The source is a raw and (mostly) uncompressed HD recording + /// The source is a raw and (mostly) uncompressed HD recording /// </summary> RAW_HD, /// <summary> - /// The source is a WEBRip, which is sourced from a Streaming Service but not 100% untouched like a WebDL (can be re-encoded or transcode from 4k -> 1080p for better quality, very depending on the release group) + /// The source is a WEBRip, which is sourced from a Streaming Service but not 100% untouched like a WebDL (can be + /// re-encoded or transcode from 4k -> 1080p for better quality, very depending on the release group) /// </summary> [DisplayName("WEBRip")] [Resolution(QualityResolution.R480_P, QualityResolution.R720_P, QualityResolution.R1080_P, @@ -43,7 +44,7 @@ public enum QualitySource WEB_RIP, /// <summary> - /// The source is a WebDL, which is sourced from a Streaming Service and released as in (almost) untouched quality + /// The source is a WebDL, which is sourced from a Streaming Service and released as in (almost) untouched quality /// </summary> [DisplayName("WebDL")] [Resolution(QualityResolution.R480_P, QualityResolution.R720_P, QualityResolution.R1080_P, @@ -51,7 +52,7 @@ public enum QualitySource WEB_DL, /// <summary> - /// The source is a BluRay, which is sourced from a BluRay Disc but encoded + /// The source is a BluRay, which is sourced from a BluRay Disc but encoded /// </summary> [DisplayName("BluRay")] [Resolution(QualityResolution.R480_P, QualityResolution.R576_P, QualityResolution.R720_P, QualityResolution.R1080_P, @@ -59,14 +60,14 @@ public enum QualitySource BLURAY, /// <summary> - /// The source is a BluRay Remux, which is sourced from a BluRay Disc but does not encode the video + /// The source is a BluRay Remux, which is sourced from a BluRay Disc but does not encode the video /// </summary> [DisplayName("BluRay Remux")] [Resolution(QualityResolution.R720_P, QualityResolution.R1080_P, QualityResolution.R2160_P)] BLURAY_REMUX, /// <summary> - /// The source is an untouched BluRay Disk in its raw format (M2TS or ISO) + /// The source is an untouched BluRay Disk in its raw format (M2TS or ISO) /// </summary> [DisplayName("BluRay Disc")] [Resolution(QualityResolution.R720_P, QualityResolution.R1080_P, QualityResolution.R2160_P)] diff --git a/Submarine.Core/Quality/Revision.cs b/Submarine.Core/Quality/Revision.cs index 973a8bc..0f43fd6 100644 --- a/Submarine.Core/Quality/Revision.cs +++ b/Submarine.Core/Quality/Revision.cs @@ -3,7 +3,7 @@ namespace Submarine.Core.Quality; /// <summary> -/// A Revision of a Quality +/// A Revision of a Quality /// </summary> /// <param name="Version">The version of this revision, default is 1</param> /// <param name="IsRepack">If this revision is a repack</param> @@ -17,7 +17,7 @@ public record Revision( : IComparable<Revision> { /// <summary> - /// Compares this Revision to another Revision + /// Compares this Revision to another Revision /// </summary> /// <param name="other">The other Revision</param> /// <returns>1 if this Revision is higher, 0 if they are the same, -1 if the other one is higher</returns> @@ -36,7 +36,7 @@ public int CompareTo(Revision? other) } /// <summary> - /// If this Revision is equal to another Revision + /// If this Revision is equal to another Revision /// </summary> /// <param name="other">The other Revision</param> /// <returns>bool indicating if the two Revisions are identical</returns> @@ -56,7 +56,7 @@ public override int GetHashCode() => HashCode.Combine(Version, IsRepack, IsProper, IsReal); /// <summary> - /// Convenience method to compare two Revisions + /// Convenience method to compare two Revisions /// </summary> /// <param name="left">First Revision</param> /// <param name="right">Second Revision</param> @@ -70,7 +70,7 @@ public override int GetHashCode() } /// <summary> - /// Convenience method to compare two Revisions + /// Convenience method to compare two Revisions /// </summary> /// <param name="left">First Revision</param> /// <param name="right">Second Revision</param> @@ -84,7 +84,7 @@ public override int GetHashCode() } /// <summary> - /// Convenience method to compare two Revisions + /// Convenience method to compare two Revisions /// </summary> /// <param name="left">First Revision</param> /// <param name="right">Second Revision</param> @@ -98,7 +98,7 @@ public override int GetHashCode() } /// <summary> - /// Convenience method to compare two Revisions + /// Convenience method to compare two Revisions /// </summary> /// <param name="left">First Revision</param> /// <param name="right">Second Revision</param> diff --git a/Submarine.Core/Quality/StreamingProvider.cs b/Submarine.Core/Quality/StreamingProvider.cs index 971f601..e709ace 100644 --- a/Submarine.Core/Quality/StreamingProvider.cs +++ b/Submarine.Core/Quality/StreamingProvider.cs @@ -3,114 +3,114 @@ namespace Submarine.Core.Quality; /// <summary> -/// Streaming Provider (or commonly known as Streaming Service) are services that provide content over the internet +/// Streaming Provider (or commonly known as Streaming Service) are services that provide content over the internet /// </summary> public enum StreamingProvider { /// <summary> - /// Amazon Prime Video <see href="https://en.wikipedia.org/wiki/Amazon_Prime_Video"/> + /// Amazon Prime Video <see href="https://en.wikipedia.org/wiki/Amazon_Prime_Video" /> /// </summary> [RegEx("(amzn|amazon)(?=[ ._-]web[ ._-]?(dl|rip)?)")] AMAZON, /// <summary> - /// Netflix <see href="https://en.wikipedia.org/wiki/Netflix"/> + /// Netflix <see href="https://en.wikipedia.org/wiki/Netflix" /> /// </summary> [RegEx("(nf|netflix)(?=[ ._-]web[ ._-]?(dl|rip)?)")] NETFLIX, /// <summary> - /// Apple TV+ <see href="https://en.wikipedia.org/wiki/Apple_TV%2B"/> + /// Apple TV+ <see href="https://en.wikipedia.org/wiki/Apple_TV%2B" /> /// </summary> [RegEx("(atvp|aptv)(?=[ ._-]web[ ._-]?(dl|rip)?)")] APPLE_TV, /// <summary> - /// HBO Max <see href="https://en.wikipedia.org/wiki/HBO_Max"/> + /// HBO Max <see href="https://en.wikipedia.org/wiki/HBO_Max" /> /// </summary> [RegEx("(hmax)(?=[ ._-]web[ ._-]?(dl|rip)?)")] HBO_MAX, /// <summary> - /// Disney Plus <see href="https://en.wikipedia.org/wiki/Disney%2B"/> + /// Disney Plus <see href="https://en.wikipedia.org/wiki/Disney%2B" /> /// </summary> [RegEx("(dp|dsnp|dsny|disney|disney\\+)(?=[ ._-]web[ ._-]?(dl|rip)?)")] DISNEY, /// <summary> - /// Hulu <see href="https://en.wikipedia.org/wiki/Hulu"/> + /// Hulu <see href="https://en.wikipedia.org/wiki/Hulu" /> /// </summary> [RegEx("(hulu)(?=[ ._-]web[ ._-]?(dl|rip)?)")] HULU, /// <summary> - /// Crunchyroll <see href="https://en.wikipedia.org/wiki/Crunchyroll"/> + /// Crunchyroll <see href="https://en.wikipedia.org/wiki/Crunchyroll" /> /// </summary> [RegEx(@"(cr|crunchyroll|cr-dub)(?=[ ._\-\)](web[ ._-]?(dl|rip)?)?)")] CRUNCHYROLL, /// <summary> - /// Funimation <see href="https://en.wikipedia.org/wiki/Funimation"/> + /// Funimation <see href="https://en.wikipedia.org/wiki/Funimation" /> /// </summary> [RegEx("(funi|funidub|funimation)(?=[ ._-]web[ ._-]?(dl|rip)?)?")] FUNIMATION, /// <summary> - /// YouTube Premium <see href="https://en.wikipedia.org/wiki/YouTube_Premium"/> + /// YouTube Premium <see href="https://en.wikipedia.org/wiki/YouTube_Premium" /> /// </summary> [RegEx("(red)(?=[ ._-]web[ ._-]?(dl|rip)?)")] YOUTUBE_PREMIUM, /// <summary> - /// Peacock <see href="https://en.wikipedia.org/wiki/Peacock_(streaming_service)"/> + /// Peacock <see href="https://en.wikipedia.org/wiki/Peacock_(streaming_service)" /> /// </summary> [RegEx("(pcok)(?=[ ._-]web[ ._-]?(dl|rip)?)")] PEACOCK, /// <summary> - /// DC Universe <see href="https://en.wikipedia.org/wiki/DC_Universe_(streaming_service)"/> + /// DC Universe <see href="https://en.wikipedia.org/wiki/DC_Universe_(streaming_service)" /> /// </summary> [RegEx("(dcu)(?=[ ._-]web[ ._-]?(dl|rip)?)")] DC_UNIVERSE, /// <summary> - /// HBO Now <see href="https://en.wikipedia.org/wiki/HBO_Now"/> + /// HBO Now <see href="https://en.wikipedia.org/wiki/HBO_Now" /> /// </summary> [RegEx("(hbo)(?=[ ._-]web[ ._-]?(dl|rip)?)")] HBO_NOW, /// <summary> - /// Paramount+ <see href="https://en.wikipedia.org/wiki/Paramount%2B"/> + /// Paramount+ <see href="https://en.wikipedia.org/wiki/Paramount%2B" /> /// </summary> [RegEx("(pmtp)(?=[ ._-]web[ ._-]?(dl|rip)?)")] PARAMOUNT_PLUS, /// <summary> - /// Comedy Central <see href="https://en.wikipedia.org/wiki/Comedy_Central"/> + /// Comedy Central <see href="https://en.wikipedia.org/wiki/Comedy_Central" /> /// </summary> [RegEx(@"\b(CC)\b[ ._-]web[ ._-]?(dl|rip)?\b")] COMEDY_CENTRAL, /// <summary> - /// Crave <see href="https://en.wikipedia.org/wiki/Crave_(streaming_service)"/> + /// Crave <see href="https://en.wikipedia.org/wiki/Crave_(streaming_service)" /> /// </summary> [RegEx(@"\b(crav(e)?)\b[ ._-]web[ ._-]?(dl|rip)?\b")] CRAVE, /// <summary> - /// HiDive <see href="https://en.wikipedia.org/wiki/Sentai_Filmworks#Hidive"/> + /// HiDive <see href="https://en.wikipedia.org/wiki/Sentai_Filmworks#Hidive" /> /// </summary> [RegEx(@"\b(HIDI(VE)?)\b")] HIDIVE, /// <summary> - /// Itunes <see href="https://en.wikipedia.org/wiki/ITunes"/> + /// Itunes <see href="https://en.wikipedia.org/wiki/ITunes" /> /// </summary> [RegEx(@"\b(it|itunes)\b(?=[ ._-]web[ ._-]?(dl|rip)\b)")] ITUNES, /// <summary> - /// Movies Anywhere <see href="https://en.wikipedia.org/wiki/Movies_Anywhere"/> + /// Movies Anywhere <see href="https://en.wikipedia.org/wiki/Movies_Anywhere" /> /// </summary> [RegEx(@"(?<!dts[ .-]?hd[ .-]?)ma\b(?=.*\bweb[ ._-]?(dl|rip)\b)")] MOVIES_ANYWHERE diff --git a/Submarine.Core/Release/BaseRelease.cs b/Submarine.Core/Release/BaseRelease.cs index 64d435b..895efb0 100644 --- a/Submarine.Core/Release/BaseRelease.cs +++ b/Submarine.Core/Release/BaseRelease.cs @@ -8,84 +8,84 @@ namespace Submarine.Core.Release; /// <summary> -/// The base class for all releases, contains all common properties +/// The base class for all releases, contains all common properties /// </summary> public record BaseRelease { /// <summary> - /// The Full Title of the Release + /// The Full Title of the Release /// </summary> public string FullTitle { get; init; } /// <summary> - /// The parsed Title of the Release + /// The parsed Title of the Release /// </summary> public string Title { get; init; } /// <summary> - /// The Year included in the Release Title, if any + /// The Year included in the Release Title, if any /// </summary> public int? Year { get; init; } /// <summary> - /// Aliases for the Release, if any + /// Aliases for the Release, if any /// </summary> public IReadOnlyList<string> Aliases { get; init; } /// <summary> - /// Languages included in the Release Title, if any + /// Languages included in the Release Title, if any /// </summary> public IReadOnlyList<Language> Languages { get; init; } /// <summary> - /// Streaming Provider of this Release, if any + /// Streaming Provider of this Release, if any /// </summary> public StreamingProvider? StreamingProvider { get; init; } /// <summary> - /// The Type of Release + /// The Type of Release /// </summary> public ReleaseType Type { get; init; } /// <summary> - /// Release data for Series Releases, if any + /// Release data for Series Releases, if any /// </summary> public SeriesReleaseData? SeriesReleaseData { get; init; } /// <summary> - /// Release data for Movie Releases, if any + /// Release data for Movie Releases, if any /// </summary> public MovieReleaseData? MovieReleaseData { get; init; } /// <summary> - /// The Quality of the Release + /// The Quality of the Release /// </summary> public QualityModel Quality { get; init; } /// <summary> - /// The Protocol of the Release + /// The Protocol of the Release /// </summary> public Protocol Protocol { get; init; } /// <summary> - /// The Release Group of the Release, if any + /// The Release Group of the Release, if any /// </summary> public string? ReleaseGroup { get; init; } /// <summary> - /// The Hash of the Release, if any + /// The Hash of the Release, if any /// </summary> public string? ReleaseHash { get; init; } /// <summary> - /// Creates a new instance of <see cref="BaseRelease"/> + /// Creates a new instance of <see cref="BaseRelease" /> /// </summary> public BaseRelease() { } /// <summary> - /// Creates a new instance of <see cref="BaseRelease"/>, used in Inheritance + /// Creates a new instance of <see cref="BaseRelease" />, used in Inheritance /// </summary> /// <param name="source">The source base release</param> public BaseRelease(BaseRelease source) @@ -104,7 +104,7 @@ public BaseRelease(BaseRelease source) } /// <summary> - /// Converts this Release to a Torrent Release + /// Converts this Release to a Torrent Release /// </summary> /// <returns>This release as a TorrentRelease</returns> public TorrentRelease ToTorrent() @@ -112,7 +112,7 @@ public TorrentRelease ToTorrent() /// <summary> - /// Converts this Release to a Usenet Release + /// Converts this Release to a Usenet Release /// </summary> /// <returns>This release as a Usenet Release</returns> public UsenetRelease ToUsenet() diff --git a/Submarine.Core/Release/Exceptions/InvalidReleaseException.cs b/Submarine.Core/Release/Exceptions/InvalidReleaseException.cs index 0534fb2..9ce90fd 100644 --- a/Submarine.Core/Release/Exceptions/InvalidReleaseException.cs +++ b/Submarine.Core/Release/Exceptions/InvalidReleaseException.cs @@ -3,12 +3,12 @@ namespace Submarine.Core.Release.Exceptions; /// <summary> -/// Exception thrown when a release is invalid +/// Exception thrown when a release is invalid /// </summary> public class InvalidReleaseException : Exception { /// <summary> - /// Creates a new instance of <see cref="InvalidReleaseException"/> + /// Creates a new instance of <see cref="InvalidReleaseException" /> /// </summary> /// <param name="reason">The reason why the Release is invalid</param> public InvalidReleaseException(string reason) : base(reason) diff --git a/Submarine.Core/Release/Exceptions/NotParsableReleaseException.cs b/Submarine.Core/Release/Exceptions/NotParsableReleaseException.cs index 0bb33e4..3a3b8a3 100644 --- a/Submarine.Core/Release/Exceptions/NotParsableReleaseException.cs +++ b/Submarine.Core/Release/Exceptions/NotParsableReleaseException.cs @@ -3,12 +3,12 @@ namespace Submarine.Core.Release.Exceptions; /// <summary> -/// Exception thrown when a release is not parsable +/// Exception thrown when a release is not parsable /// </summary> public class NotParsableReleaseException : Exception { /// <summary> - /// Creates a new instance of <see cref="NotParsableReleaseException"/> + /// Creates a new instance of <see cref="NotParsableReleaseException" /> /// </summary> /// <param name="reason">The reason why this Release is not parsable</param> public NotParsableReleaseException(string reason) : base(reason) diff --git a/Submarine.Core/Release/MovieReleaseData.cs b/Submarine.Core/Release/MovieReleaseData.cs index 057f484..7fd504e 100644 --- a/Submarine.Core/Release/MovieReleaseData.cs +++ b/Submarine.Core/Release/MovieReleaseData.cs @@ -1,12 +1,12 @@ namespace Submarine.Core.Release; /// <summary> -/// Movie specific Release Data +/// Movie specific Release Data /// </summary> public class MovieReleaseData { /// <summary> - /// The Edition of this Movie Release + /// The Edition of this Movie Release /// </summary> public string Edition { get; set; } } diff --git a/Submarine.Core/Release/MovieTitleMetadata.cs b/Submarine.Core/Release/MovieTitleMetadata.cs index 0fcba9a..ac59ead 100644 --- a/Submarine.Core/Release/MovieTitleMetadata.cs +++ b/Submarine.Core/Release/MovieTitleMetadata.cs @@ -3,7 +3,7 @@ namespace Submarine.Core.Release; /// <summary> -/// The Metadata for a Movie Release Title +/// The Metadata for a Movie Release Title /// </summary> /// <param name="MainTitle">The Main Title of this Release</param> /// <param name="Aliases">The Aliases of this Release</param> @@ -11,5 +11,6 @@ namespace Submarine.Core.Release; /// <param name="Group">The Release Group of this Release</param> /// <param name="Hash">The Hash of this Release</param> /// <param name="Edition">The Movie Edition of this Release</param> -public record MovieTitleMetadata(string MainTitle, IReadOnlyList<string> Aliases, string? Year, string? Group, string? Hash, string? Edition) +public record MovieTitleMetadata(string MainTitle, IReadOnlyList<string> Aliases, string? Year, string? Group, + string? Hash, string? Edition) : TitleMetadata(MainTitle, Aliases, Year, Group, Hash); diff --git a/Submarine.Core/Release/ReleaseType.cs b/Submarine.Core/Release/ReleaseType.cs index 157e1e3..a3dc919 100644 --- a/Submarine.Core/Release/ReleaseType.cs +++ b/Submarine.Core/Release/ReleaseType.cs @@ -1,22 +1,22 @@ namespace Submarine.Core.Release; /// <summary> -/// The Types of Releases +/// The Types of Releases /// </summary> public enum ReleaseType { /// <summary> - /// Release type is unknown + /// Release type is unknown /// </summary> UNKNOWN, /// <summary> - /// Release is a Series Release + /// Release is a Series Release /// </summary> SERIES, /// <summary> - /// Release is a Movie Release + /// Release is a Movie Release /// </summary> MOVIE } diff --git a/Submarine.Core/Release/SeriesReleaseData.cs b/Submarine.Core/Release/SeriesReleaseData.cs index 53b72a4..ebadec4 100644 --- a/Submarine.Core/Release/SeriesReleaseData.cs +++ b/Submarine.Core/Release/SeriesReleaseData.cs @@ -3,27 +3,27 @@ namespace Submarine.Core.Release; /// <summary> -/// Series specific Release Data +/// Series specific Release Data /// </summary> public record SeriesReleaseData { /// <summary> - /// The Type of Series Release + /// The Type of Series Release /// </summary> public SeriesReleaseType ReleaseType { get; init; } /// <summary> - /// The Season(s) included in the Release Title, if any + /// The Season(s) included in the Release Title, if any /// </summary> public IReadOnlyList<int> Seasons { get; init; } /// <summary> - /// The Episode(s) included in the Release Title, if any + /// The Episode(s) included in the Release Title, if any /// </summary> public IReadOnlyList<int> Episodes { get; init; } /// <summary> - /// The Absolute Episode(s) included in the Release Title, if any + /// The Absolute Episode(s) included in the Release Title, if any /// </summary> public IReadOnlyList<int> AbsoluteEpisodes { get; init; } } diff --git a/Submarine.Core/Release/SeriesReleaseType.cs b/Submarine.Core/Release/SeriesReleaseType.cs index 7f39098..2a97ab3 100644 --- a/Submarine.Core/Release/SeriesReleaseType.cs +++ b/Submarine.Core/Release/SeriesReleaseType.cs @@ -1,37 +1,37 @@ namespace Submarine.Core.Release; /// <summary> -/// The Type of a Series Release +/// The Type of a Series Release /// </summary> public enum SeriesReleaseType { /// <summary> - /// Release is a special episode of a Series + /// Release is a special episode of a Series /// </summary> SPECIAL, - + /// <summary> - /// Release is an episode of a Series + /// Release is an episode of a Series /// </summary> EPISODE, - + /// <summary> - /// Release contains multiple absolute episode (common for anime) + /// Release contains multiple absolute episode (common for anime) /// </summary> MULTI_EPISODES, /// <summary> - /// Release is a partial season of this Series + /// Release is a partial season of this Series /// </summary> PARTIAL_SEASON, - + /// <summary> - /// Release is a full season of a Series + /// Release is a full season of a Series /// </summary> FULL_SEASON, /// <summary> - /// Release is containing multiple seasons of this Series + /// Release is containing multiple seasons of this Series /// </summary> MULTI_SEASON } diff --git a/Submarine.Core/Release/SeriesTitleMetadata.cs b/Submarine.Core/Release/SeriesTitleMetadata.cs index 89f67d0..b17f847 100644 --- a/Submarine.Core/Release/SeriesTitleMetadata.cs +++ b/Submarine.Core/Release/SeriesTitleMetadata.cs @@ -3,7 +3,7 @@ namespace Submarine.Core.Release; /// <summary> -/// The Metadata for a Series Release Title +/// The Metadata for a Series Release Title /// </summary> /// <param name="MainTitle">The Main Title</param> /// <param name="Aliases">The Aliases of this Release Title</param> @@ -13,5 +13,7 @@ namespace Submarine.Core.Release; /// <param name="Year">The Year from this Release Title</param> /// <param name="Group">The Release Group from this Release Title</param> /// <param name="Hash">The Hash from this Release Title</param> -public record SeriesTitleMetadata(string MainTitle, IReadOnlyList<string> Aliases, IReadOnlyCollection<int>? Seasons, IReadOnlyCollection<int>? Episodes, IReadOnlyCollection<int>? AbsoluteEpisodes, string? Year, string? Group, string? Hash) +public record SeriesTitleMetadata(string MainTitle, IReadOnlyList<string> Aliases, IReadOnlyCollection<int>? Seasons, + IReadOnlyCollection<int>? Episodes, IReadOnlyCollection<int>? AbsoluteEpisodes, string? Year, string? Group, + string? Hash) : TitleMetadata(MainTitle, Aliases, Year, Group, Hash); diff --git a/Submarine.Core/Release/TitleMetadata.cs b/Submarine.Core/Release/TitleMetadata.cs index 2f079b9..b35db9d 100644 --- a/Submarine.Core/Release/TitleMetadata.cs +++ b/Submarine.Core/Release/TitleMetadata.cs @@ -3,11 +3,12 @@ namespace Submarine.Core.Release; /// <summary> -/// Metadata of a release Title +/// Metadata of a release Title /// </summary> /// <param name="MainTitle">The Main Release Title (Without AKA Aliases)</param> /// <param name="Aliases">Aliases included in this Title, if any</param> /// <param name="Year">Year included in the Title, if any</param> /// <param name="Group">Release Group included in the Title, if any</param> /// <param name="Hash">The Hash included in the Title, if any</param> -public abstract record TitleMetadata(string MainTitle, IReadOnlyList<string> Aliases, string? Year, string? Group, string? Hash); +public abstract record TitleMetadata(string MainTitle, IReadOnlyList<string> Aliases, string? Year, string? Group, + string? Hash); diff --git a/Submarine.Core/Release/Torrent/TorrentRelease.cs b/Submarine.Core/Release/Torrent/TorrentRelease.cs index 0f43b4a..3c75f55 100644 --- a/Submarine.Core/Release/Torrent/TorrentRelease.cs +++ b/Submarine.Core/Release/Torrent/TorrentRelease.cs @@ -3,22 +3,22 @@ namespace Submarine.Core.Release.Torrent; /// <summary> -/// A Torrent Release +/// A Torrent Release /// </summary> public record TorrentRelease : BaseRelease { /// <summary> - /// Flags for this Torrent Release + /// Flags for this Torrent Release /// </summary> public TorrentReleaseFlags Flags { get; init; } = TorrentReleaseFlags.NONE; /// <summary> - /// Hash of the Torrent, if any + /// Hash of the Torrent, if any /// </summary> public string? Hash { get; init; } /// <summary> - /// Creates a new instance of <see cref="TorrentRelease"/> from a <see cref="BaseRelease"/> + /// Creates a new instance of <see cref="TorrentRelease" /> from a <see cref="BaseRelease" /> /// </summary> /// <param name="baseRelease">The base release</param> public TorrentRelease(BaseRelease baseRelease) : base(baseRelease) diff --git a/Submarine.Core/Release/Torrent/TorrentReleaseFlags.cs b/Submarine.Core/Release/Torrent/TorrentReleaseFlags.cs index ac1792a..b11c203 100644 --- a/Submarine.Core/Release/Torrent/TorrentReleaseFlags.cs +++ b/Submarine.Core/Release/Torrent/TorrentReleaseFlags.cs @@ -3,53 +3,53 @@ namespace Submarine.Core.Release.Torrent; /// <summary> -/// Flags for Torrent Releases +/// Flags for Torrent Releases /// </summary> [Flags] public enum TorrentReleaseFlags { /// <summary> - /// No flags + /// No flags /// </summary> NONE = 0, /// <summary> - /// Torrent is Freeleech (0% Download Credited) + /// Torrent is Freeleech (0% Download Credited) /// </summary> FREELEECH = 1 << 1, /// <summary> - /// Torrent is Halfleech (50% Download Credited) + /// Torrent is Halfleech (50% Download Credited) /// </summary> HALFLEECH = 1 << 2, /// <summary> - /// No Upload/Download is counted for this Torrent + /// No Upload/Download is counted for this Torrent /// </summary> NEUTRALLEECH = 1 << 3, /// <summary> - /// Double Upload is counted for this Torrent + /// Double Upload is counted for this Torrent /// </summary> DOUBLE_UPLOAD = 1 << 4, /// <summary> - /// Torrent has a Promotion (anything besides Freeleech, Halfleech, Double Upload) + /// Torrent has a Promotion (anything besides Freeleech, Halfleech, Double Upload) /// </summary> OTHER_PROMOTION = 1 << 5, /// <summary> - /// Torrent is a Scene Release + /// Torrent is a Scene Release /// </summary> SCENE = 1 << 6, /// <summary> - /// Torrent is an Internal Release for this Tracker + /// Torrent is an Internal Release for this Tracker /// </summary> INTERNAL = 1 << 7, /// <summary> - /// This Torrent is Exclusive to this Tracker + /// This Torrent is Exclusive to this Tracker /// </summary> - EXCLUSIVE = 1 << 8, + EXCLUSIVE = 1 << 8 } diff --git a/Submarine.Core/Release/Usenet/UsenetRelease.cs b/Submarine.Core/Release/Usenet/UsenetRelease.cs index 0714fd6..2ea9aae 100644 --- a/Submarine.Core/Release/Usenet/UsenetRelease.cs +++ b/Submarine.Core/Release/Usenet/UsenetRelease.cs @@ -3,12 +3,12 @@ namespace Submarine.Core.Release.Usenet; /// <summary> -/// Usenet Release +/// Usenet Release /// </summary> public record UsenetRelease : BaseRelease { /// <summary> - /// Creates a new instance of <see cref="UsenetRelease"/> from a <see cref="BaseRelease"/> + /// Creates a new instance of <see cref="UsenetRelease" /> from a <see cref="BaseRelease" /> /// </summary> /// <param name="release">The base release</param> public UsenetRelease(BaseRelease release) : base(release) diff --git a/Submarine.Core/Release/Util/ReleaseUtil.cs b/Submarine.Core/Release/Util/ReleaseUtil.cs index 9636499..5b30e56 100644 --- a/Submarine.Core/Release/Util/ReleaseUtil.cs +++ b/Submarine.Core/Release/Util/ReleaseUtil.cs @@ -6,7 +6,7 @@ namespace Submarine.Core.Release.Util; /// <summary> -/// Utilities for Releases +/// Utilities for Releases /// </summary> public static class ReleaseUtil { @@ -22,7 +22,7 @@ public static class ReleaseUtil }, RegexOptions.IgnoreCase | RegexOptions.Compiled); /// <summary> - /// Removes the file extension from a release title + /// Removes the file extension from a release title /// </summary> /// <param name="title">The release title</param> /// <returns>The replaced String</returns> diff --git a/Submarine.Core/Submarine.Core.csproj b/Submarine.Core/Submarine.Core.csproj index 9a7a00d..1233a3f 100644 --- a/Submarine.Core/Submarine.Core.csproj +++ b/Submarine.Core/Submarine.Core.csproj @@ -7,15 +7,15 @@ </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> - <DocumentationFile>bin\Debug\net6.0\Submarine.Core.xml</DocumentationFile> + <DocumentationFile>bin\Debug\net6.0\Submarine.Core.xml</DocumentationFile> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)' == 'Release' "> - <DocumentationFile>bin\Release\net6.0\Submarine.Core.xml</DocumentationFile> + <DocumentationFile>bin\Release\net6.0\Submarine.Core.xml</DocumentationFile> </PropertyGroup> <ItemGroup> - <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.1" /> + <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.1"/> </ItemGroup> diff --git a/Submarine.Core/Util/Extensions/EnumExtensions.cs b/Submarine.Core/Util/Extensions/EnumExtensions.cs index 6eab6fc..b2bca40 100644 --- a/Submarine.Core/Util/Extensions/EnumExtensions.cs +++ b/Submarine.Core/Util/Extensions/EnumExtensions.cs @@ -4,12 +4,12 @@ namespace Submarine.Core.Util.Extensions; /// <summary> -/// Extensions for Enums +/// Extensions for Enums /// </summary> public static class EnumExtensions { /// <summary> - /// Get the Attribute of an Enum + /// Get the Attribute of an Enum /// </summary> /// <param name="value">The enum to get the Attribute for</param> /// <typeparam name="TAttribute">The Attribute to get</typeparam> diff --git a/Submarine.Core/Util/Extensions/StringExtensions.cs b/Submarine.Core/Util/Extensions/StringExtensions.cs index 9a6ded9..d36a81d 100644 --- a/Submarine.Core/Util/Extensions/StringExtensions.cs +++ b/Submarine.Core/Util/Extensions/StringExtensions.cs @@ -9,8 +9,9 @@ namespace Submarine.Core.Util.Extensions; /// </summary> public static class StringExtensions { - private static readonly string[] Numbers = { "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine" }; - + private static readonly string[] Numbers = + { "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine" }; + /// <summary> /// Reverses the String /// </summary> @@ -37,7 +38,7 @@ public static bool IsNotNullOrWhitespace(this string str) => !string.IsNullOrWhiteSpace(str); /// <summary> - /// Parses an string to an integer including written out numbers + /// Parses an string to an integer including written out numbers /// </summary> /// <param name="str">Input string</param> /// <returns>parsed integer</returns> @@ -46,23 +47,17 @@ public static int ToInteger(this string str) { var normalized = str.Normalize(NormalizationForm.FormKC); - if (int.TryParse(normalized, out var number)) - { - return number; - } + if (int.TryParse(normalized, out var number)) return number; number = Array.IndexOf(Numbers, str.ToLower()); - if (number != -1) - { - return number; - } + if (number != -1) return number; throw new FormatException($"{str} isn't a number"); } /// <summary> - /// Converts a string to a decimal including written out numbers + /// Converts a string to a decimal including written out numbers /// </summary> /// <param name="str">Input String</param> /// <returns>parsed decimal</returns> @@ -72,15 +67,13 @@ public static decimal ToDecimal(this string str) var normalized = str.Normalize(NormalizationForm.FormKC); if (decimal.TryParse(normalized, NumberStyles.Float, CultureInfo.InvariantCulture, out var number)) - { return number; - } throw new FormatException($"{str} isn't a number"); } /// <summary> - /// Normalises the given Release string + /// Normalises the given Release string /// </summary> /// <param name="str">Input string</param> /// <returns></returns>