Xml-doc part1

This commit is contained in:
Stepan 2020-11-10 17:11:48 +01:00
parent c0747512d6
commit 693760e38a
36 changed files with 218 additions and 101 deletions

View File

@ -1,6 +1,3 @@
#nullable enable
#pragma warning disable CS1591
using System; using System;
using System.Globalization; using System.Globalization;
using System.IO; using System.IO;
@ -9,15 +6,27 @@ using Emby.Naming.Common;
namespace Emby.Naming.Audio namespace Emby.Naming.Audio
{ {
/// <summary>
/// Helper class to determine if Album is multipart.
/// </summary>
public class AlbumParser public class AlbumParser
{ {
private readonly NamingOptions _options; private readonly NamingOptions _options;
/// <summary>
/// Initializes a new instance of the <see cref="AlbumParser"/> class.
/// </summary>
/// <param name="options">Naming options containing AlbumStackingPrefixes.</param>
public AlbumParser(NamingOptions options) public AlbumParser(NamingOptions options)
{ {
_options = options; _options = options;
} }
/// <summary>
/// Function that determines if album is multipart.
/// </summary>
/// <param name="path">Path to file.</param>
/// <returns>True if album is multipart.</returns>
public bool IsMultiPart(string path) public bool IsMultiPart(string path)
{ {
var filename = Path.GetFileName(path); var filename = Path.GetFileName(path);

View File

@ -1,6 +1,3 @@
#nullable enable
#pragma warning disable CS1591
using System; using System;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
@ -8,8 +5,17 @@ using Emby.Naming.Common;
namespace Emby.Naming.Audio namespace Emby.Naming.Audio
{ {
/// <summary>
/// Static helper class to determine if file at path is audio file.
/// </summary>
public static class AudioFileParser public static class AudioFileParser
{ {
/// <summary>
/// Static helper method to determine if file at path is audio file.
/// </summary>
/// <param name="path">Path to file.</param>
/// <param name="options"><see cref="NamingOptions"/> containing AudioFileExtensions.</param>
/// <returns>True if file at path is audio file.</returns>
public static bool IsAudioFile(string path, NamingOptions options) public static bool IsAudioFile(string path, NamingOptions options)
{ {
var extension = Path.GetExtension(path); var extension = Path.GetExtension(path);

View File

@ -1,6 +1,3 @@
#nullable enable
#pragma warning disable CS1591
using System.Globalization; using System.Globalization;
using System.IO; using System.IO;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
@ -8,15 +5,27 @@ using Emby.Naming.Common;
namespace Emby.Naming.AudioBook namespace Emby.Naming.AudioBook
{ {
/// <summary>
/// Parser class to extract part and/or chapter number from audiobook filename.
/// </summary>
public class AudioBookFilePathParser public class AudioBookFilePathParser
{ {
private readonly NamingOptions _options; private readonly NamingOptions _options;
/// <summary>
/// Initializes a new instance of the <see cref="AudioBookFilePathParser"/> class.
/// </summary>
/// <param name="options">Naming options containing AudioBookPartsExpressions.</param>
public AudioBookFilePathParser(NamingOptions options) public AudioBookFilePathParser(NamingOptions options)
{ {
_options = options; _options = options;
} }
/// <summary>
/// Based on regex determines if filename includes part/chapter number.
/// </summary>
/// <param name="path">Path to audiobook file.</param>
/// <returns>Returns <see cref="AudioBookFilePathParser"/> object.</returns>
public AudioBookFilePathParserResult Parse(string path) public AudioBookFilePathParserResult Parse(string path)
{ {
AudioBookFilePathParserResult result = default; AudioBookFilePathParserResult result = default;

View File

@ -1,12 +1,18 @@
#nullable enable
#pragma warning disable CS1591
namespace Emby.Naming.AudioBook namespace Emby.Naming.AudioBook
{ {
/// <summary>
/// Data object for passing result of audiobook part/chapter extraction.
/// </summary>
public struct AudioBookFilePathParserResult public struct AudioBookFilePathParserResult
{ {
/// <summary>
/// Gets or sets optional number of path extracted from audiobook filename.
/// </summary>
public int? PartNumber { get; set; } public int? PartNumber { get; set; }
/// <summary>
/// Gets or sets optional number of chapter extracted from audiobook filename.
/// </summary>
public int? ChapterNumber { get; set; } public int? ChapterNumber { get; set; }
} }
} }

View File

@ -1,5 +1,3 @@
#pragma warning disable CS1591
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
@ -10,15 +8,27 @@ using MediaBrowser.Model.IO;
namespace Emby.Naming.AudioBook namespace Emby.Naming.AudioBook
{ {
/// <summary>
/// Class used to resolve Name, Year, alternative files and extras from stack of files.
/// </summary>
public class AudioBookListResolver public class AudioBookListResolver
{ {
private readonly NamingOptions _options; private readonly NamingOptions _options;
/// <summary>
/// Initializes a new instance of the <see cref="AudioBookListResolver"/> class.
/// </summary>
/// <param name="options">Naming options passed along to <see cref="AudioBookResolver"/> and <see cref="AudioBookNameParser"/>.</param>
public AudioBookListResolver(NamingOptions options) public AudioBookListResolver(NamingOptions options)
{ {
_options = options; _options = options;
} }
/// <summary>
/// Resolves Name, Year and differentiate alternative files and extras from regular audiobook files.
/// </summary>
/// <param name="files">List of files related to audiobook.</param>
/// <returns>Returns IEnumerable of <see cref="AudioBookInfo"/>.</returns>
public IEnumerable<AudioBookInfo> Resolve(IEnumerable<FileSystemMetadata> files) public IEnumerable<AudioBookInfo> Resolve(IEnumerable<FileSystemMetadata> files)
{ {
var audioBookResolver = new AudioBookResolver(_options); var audioBookResolver = new AudioBookResolver(_options);

View File

@ -1,21 +1,30 @@
#nullable enable
#pragma warning disable CS1591
using System.Globalization; using System.Globalization;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using Emby.Naming.Common; using Emby.Naming.Common;
namespace Emby.Naming.AudioBook namespace Emby.Naming.AudioBook
{ {
/// <summary>
/// Helper class to retrieve name and year from audiobook previously retrieved name.
/// </summary>
public class AudioBookNameParser public class AudioBookNameParser
{ {
private readonly NamingOptions _options; private readonly NamingOptions _options;
/// <summary>
/// Initializes a new instance of the <see cref="AudioBookNameParser"/> class.
/// </summary>
/// <param name="options">Naming options containing AudioBookNamesExpressions.</param>
public AudioBookNameParser(NamingOptions options) public AudioBookNameParser(NamingOptions options)
{ {
_options = options; _options = options;
} }
/// <summary>
/// Parse name and year from previously determined name of audiobook.
/// </summary>
/// <param name="name">Name of the audiobook.</param>
/// <returns>Returns <see cref="AudioBookNameParserResult"/> object.</returns>
public AudioBookNameParserResult Parse(string name) public AudioBookNameParserResult Parse(string name)
{ {
AudioBookNameParserResult result = default; AudioBookNameParserResult result = default;

View File

@ -1,12 +1,18 @@
#nullable enable
#pragma warning disable CS1591
namespace Emby.Naming.AudioBook namespace Emby.Naming.AudioBook
{ {
/// <summary>
/// Data object used to pass result of name and year parsing.
/// </summary>
public struct AudioBookNameParserResult public struct AudioBookNameParserResult
{ {
/// <summary>
/// Gets or sets name of audiobook.
/// </summary>
public string Name { get; set; } public string Name { get; set; }
/// <summary>
/// Gets or sets optional year of release.
/// </summary>
public int? Year { get; set; } public int? Year { get; set; }
} }
} }

View File

@ -1,6 +1,3 @@
#nullable enable
#pragma warning disable CS1591
using System; using System;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
@ -8,15 +5,27 @@ using Emby.Naming.Common;
namespace Emby.Naming.AudioBook namespace Emby.Naming.AudioBook
{ {
/// <summary>
/// Resolve specifics (path, container, partNumber, chapterNumber) about audiobook file.
/// </summary>
public class AudioBookResolver public class AudioBookResolver
{ {
private readonly NamingOptions _options; private readonly NamingOptions _options;
/// <summary>
/// Initializes a new instance of the <see cref="AudioBookResolver"/> class.
/// </summary>
/// <param name="options"><see cref="NamingOptions"/> containing AudioFileExtensions and also used to pass to AudioBookFilePathParser.</param>
public AudioBookResolver(NamingOptions options) public AudioBookResolver(NamingOptions options)
{ {
_options = options; _options = options;
} }
/// <summary>
/// Resolve specifics (path, container, partNumber, chapterNumber) about audiobook file.
/// </summary>
/// <param name="path">Path to audiobook file.</param>
/// <returns>Returns <see cref="AudioBookResolver"/> object.</returns>
public AudioBookFileInfo? Resolve(string path) public AudioBookFileInfo? Resolve(string path)
{ {
if (path.Length == 0 || Path.GetFileNameWithoutExtension(path).Length == 0) if (path.Length == 0 || Path.GetFileNameWithoutExtension(path).Length == 0)

View File

@ -1,16 +1,22 @@
#pragma warning disable CS1591
using System; using System;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
namespace Emby.Naming.Common namespace Emby.Naming.Common
{ {
/// <summary>
/// Regular expressions for parsing TV Episodes.
/// </summary>
public class EpisodeExpression public class EpisodeExpression
{ {
private string _expression; private string _expression;
private Regex? _regex; private Regex? _regex;
public EpisodeExpression(string expression, bool byDate) /// <summary>
/// Initializes a new instance of the <see cref="EpisodeExpression"/> class.
/// </summary>
/// <param name="expression">Regular expressions.</param>
/// <param name="byDate">True if date is expected.</param>
public EpisodeExpression(string expression, bool byDate = false)
{ {
_expression = expression; _expression = expression;
IsByDate = byDate; IsByDate = byDate;
@ -18,11 +24,9 @@ namespace Emby.Naming.Common
SupportsAbsoluteEpisodeNumbers = true; SupportsAbsoluteEpisodeNumbers = true;
} }
public EpisodeExpression(string expression) /// <summary>
: this(expression, false) /// Gets or sets raw expressions string.
{ /// </summary>
}
public string Expression public string Expression
{ {
get => _expression; get => _expression;
@ -33,16 +37,34 @@ namespace Emby.Naming.Common
} }
} }
/// <summary>
/// Gets or sets a value indicating whether gets or sets property indicating if date can be find in expression.
/// </summary>
public bool IsByDate { get; set; } public bool IsByDate { get; set; }
/// <summary>
/// Gets or sets a value indicating whether gets or sets property indicating if expression is optimistic.
/// </summary>
public bool IsOptimistic { get; set; } public bool IsOptimistic { get; set; }
/// <summary>
/// Gets or sets a value indicating whether gets or sets property indicating if expression is named.
/// </summary>
public bool IsNamed { get; set; } public bool IsNamed { get; set; }
/// <summary>
/// Gets or sets a value indicating whether gets or sets property indicating if expression supports episodes with absolute numbers.
/// </summary>
public bool SupportsAbsoluteEpisodeNumbers { get; set; } public bool SupportsAbsoluteEpisodeNumbers { get; set; }
/// <summary>
/// Gets or sets optional list of date formats used for date parsing.
/// </summary>
public string[] DateTimeFormats { get; set; } public string[] DateTimeFormats { get; set; }
/// <summary>
/// Gets a <see cref="Regex"/> expressions objects (creates it if null).
/// </summary>
public Regex Regex => _regex ??= new Regex(Expression, RegexOptions.IgnoreCase | RegexOptions.Compiled); public Regex Regex => _regex ??= new Regex(Expression, RegexOptions.IgnoreCase | RegexOptions.Compiled);
} }
} }

View File

@ -1,5 +1,3 @@
#pragma warning disable CS1591
namespace Emby.Naming.Common namespace Emby.Naming.Common
{ {
public enum MediaType public enum MediaType

View File

@ -1,5 +1,3 @@
#pragma warning disable CS1591
using System; using System;
using System.Linq; using System.Linq;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;

View File

@ -1,5 +1,3 @@
#pragma warning disable CS1591
namespace Emby.Naming.Subtitles namespace Emby.Naming.Subtitles
{ {
public class SubtitleInfo public class SubtitleInfo

View File

@ -1,6 +1,3 @@
#nullable enable
#pragma warning disable CS1591
using System; using System;
using System.IO; using System.IO;
using System.Linq; using System.Linq;

View File

@ -1,9 +1,14 @@
#pragma warning disable CS1591
namespace Emby.Naming.TV namespace Emby.Naming.TV
{ {
/// <summary>
/// Holder object for Episode information.
/// </summary>
public class EpisodeInfo public class EpisodeInfo
{ {
/// <summary>
/// Initializes a new instance of the <see cref="EpisodeInfo"/> class.
/// </summary>
/// <param name="path">Path to the file.</param>
public EpisodeInfo(string path) public EpisodeInfo(string path)
{ {
Path = path; Path = path;
@ -51,18 +56,39 @@ namespace Emby.Naming.TV
/// <value>The type of the stub.</value> /// <value>The type of the stub.</value>
public string? StubType { get; set; } public string? StubType { get; set; }
/// <summary>
/// Gets or sets optional season number.
/// </summary>
public int? SeasonNumber { get; set; } public int? SeasonNumber { get; set; }
/// <summary>
/// Gets or sets optional episode number.
/// </summary>
public int? EpisodeNumber { get; set; } public int? EpisodeNumber { get; set; }
/// <summary>
/// Gets or sets optional ending episode number. For multi-episode files 1-13.
/// </summary>
public int? EndingEpisodeNumber { get; set; } public int? EndingEpisodeNumber { get; set; }
/// <summary>
/// Gets or sets optional year of release.
/// </summary>
public int? Year { get; set; } public int? Year { get; set; }
/// <summary>
/// Gets or sets optional year of release.
/// </summary>
public int? Month { get; set; } public int? Month { get; set; }
/// <summary>
/// Gets or sets optional day of release.
/// </summary>
public int? Day { get; set; } public int? Day { get; set; }
/// <summary>
/// Gets or sets a value indicating whether by date expression was used.
/// </summary>
public bool IsByDate { get; set; } public bool IsByDate { get; set; }
} }
} }

View File

@ -1,6 +1,3 @@
#pragma warning disable CS1591
#nullable enable
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization; using System.Globalization;
@ -9,15 +6,32 @@ using Emby.Naming.Common;
namespace Emby.Naming.TV namespace Emby.Naming.TV
{ {
/// <summary>
/// Used to parse information about episode from path.
/// </summary>
public class EpisodePathParser public class EpisodePathParser
{ {
private readonly NamingOptions _options; private readonly NamingOptions _options;
/// <summary>
/// Initializes a new instance of the <see cref="EpisodePathParser"/> class.
/// </summary>
/// <param name="options"><see cref="NamingOptions"/> object containing EpisodeExpressions and MultipleEpisodeExpressions.</param>
public EpisodePathParser(NamingOptions options) public EpisodePathParser(NamingOptions options)
{ {
_options = options; _options = options;
} }
/// <summary>
/// Parses information about episode from path.
/// </summary>
/// <param name="path">Path.</param>
/// <param name="isDirectory">Is path for a directory or file.</param>
/// <param name="isNamed">Do we want to use IsNamed expressions.</param>
/// <param name="isOptimistic">Do we want to use Optimistic expressions.</param>
/// <param name="supportsAbsoluteNumbers">Do we want to use expressions supporting absolute episode numbers.</param>
/// <param name="fillExtendedInfo">Should we attempt to retrieve extended information.</param>
/// <returns>Returns <see cref="EpisodePathParserResult"/> object.</returns>
public EpisodePathParserResult Parse( public EpisodePathParserResult Parse(
string path, string path,
bool isDirectory, bool isDirectory,

View File

@ -1,25 +1,54 @@
#pragma warning disable CS1591
namespace Emby.Naming.TV namespace Emby.Naming.TV
{ {
/// <summary>
/// Holder object for <see cref="EpisodePathParser"/> result.
/// </summary>
public class EpisodePathParserResult public class EpisodePathParserResult
{ {
/// <summary>
/// Gets or sets optional season number.
/// </summary>
public int? SeasonNumber { get; set; } public int? SeasonNumber { get; set; }
/// <summary>
/// Gets or sets optional episode number.
/// </summary>
public int? EpisodeNumber { get; set; } public int? EpisodeNumber { get; set; }
/// <summary>
/// Gets or sets optional ending episode number. For multi-episode files 1-13.
/// </summary>
public int? EndingEpisodeNumber { get; set; } public int? EndingEpisodeNumber { get; set; }
/// <summary>
/// Gets or sets the name of the series.
/// </summary>
/// <value>The name of the series.</value>
public string? SeriesName { get; set; } public string? SeriesName { get; set; }
/// <summary>
/// Gets or sets a value indicating whether parsing was successful.
/// </summary>
public bool Success { get; set; } public bool Success { get; set; }
/// <summary>
/// Gets or sets a value indicating whether by date expression was used.
/// </summary>
public bool IsByDate { get; set; } public bool IsByDate { get; set; }
/// <summary>
/// Gets or sets optional year of release.
/// </summary>
public int? Year { get; set; } public int? Year { get; set; }
/// <summary>
/// Gets or sets optional year of release.
/// </summary>
public int? Month { get; set; } public int? Month { get; set; }
/// <summary>
/// Gets or sets optional day of release.
/// </summary>
public int? Day { get; set; } public int? Day { get; set; }
} }
} }

View File

@ -1,6 +1,3 @@
#pragma warning disable CS1591
#nullable enable
using System; using System;
using System.IO; using System.IO;
using System.Linq; using System.Linq;

View File

@ -1,5 +1,3 @@
#pragma warning disable CS1591
using System; using System;
using System.Globalization; using System.Globalization;
using System.IO; using System.IO;

View File

@ -1,5 +1,3 @@
#pragma warning disable CS1591
namespace Emby.Naming.TV namespace Emby.Naming.TV
{ {
public class SeasonPathParserResult public class SeasonPathParserResult

View File

@ -1,6 +1,3 @@
#pragma warning disable CS1591
#nullable enable
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
@ -12,6 +9,12 @@ namespace Emby.Naming.Video
/// </summary> /// </summary>
public static class CleanDateTimeParser public static class CleanDateTimeParser
{ {
/// <summary>
/// Attempts to clean the name.
/// </summary>
/// <param name="name">Name of video.</param>
/// <param name="cleanDateTimeRegexes">Optional list of regexes to clean the name.</param>
/// <returns>Returns <see cref="CleanDateTimeResult"/> object.</returns>
public static CleanDateTimeResult Clean(string name, IReadOnlyList<Regex> cleanDateTimeRegexes) public static CleanDateTimeResult Clean(string name, IReadOnlyList<Regex> cleanDateTimeRegexes)
{ {
CleanDateTimeResult result = new CleanDateTimeResult(name); CleanDateTimeResult result = new CleanDateTimeResult(name);

View File

@ -1,22 +1,21 @@
#pragma warning disable CS1591
#nullable enable
namespace Emby.Naming.Video namespace Emby.Naming.Video
{ {
/// <summary>
/// Holder structure for name and year.
/// </summary>
public readonly struct CleanDateTimeResult public readonly struct CleanDateTimeResult
{ {
public CleanDateTimeResult(string name, int? year) /// <summary>
/// Initializes a new instance of the <see cref="CleanDateTimeResult"/> struct.
/// </summary>
/// <param name="name">Name of video.</param>
/// <param name="year">Year of release.</param>
public CleanDateTimeResult(string name, int? year = null)
{ {
Name = name; Name = name;
Year = year; Year = year;
} }
public CleanDateTimeResult(string name)
{
Name = name;
Year = null;
}
/// <summary> /// <summary>
/// Gets the name. /// Gets the name.
/// </summary> /// </summary>

View File

@ -1,6 +1,3 @@
#pragma warning disable CS1591
#nullable enable
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
@ -12,6 +9,13 @@ namespace Emby.Naming.Video
/// </summary> /// </summary>
public static class CleanStringParser public static class CleanStringParser
{ {
/// <summary>
/// Attempts to extract clean name with regular expressions.
/// </summary>
/// <param name="name">Name of file.</param>
/// <param name="expressions">List of regex to parse name and year from.</param>
/// <param name="newName">Parsing result string.</param>
/// <returns>True if parsing was successful.</returns>
public static bool TryClean(string name, IReadOnlyList<Regex> expressions, out ReadOnlySpan<char> newName) public static bool TryClean(string name, IReadOnlyList<Regex> expressions, out ReadOnlySpan<char> newName)
{ {
var len = expressions.Count; var len = expressions.Count;

View File

@ -1,9 +1,6 @@
#pragma warning disable CS1591
using System; using System;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text.RegularExpressions;
using Emby.Naming.Audio; using Emby.Naming.Audio;
using Emby.Naming.Common; using Emby.Naming.Common;

View File

@ -1,5 +1,3 @@
#pragma warning disable CS1591
using MediaBrowser.Model.Entities; using MediaBrowser.Model.Entities;
namespace Emby.Naming.Video namespace Emby.Naming.Video

View File

@ -1,5 +1,3 @@
#pragma warning disable CS1591
using MediaBrowser.Model.Entities; using MediaBrowser.Model.Entities;
using MediaType = Emby.Naming.Common.MediaType; using MediaType = Emby.Naming.Common.MediaType;

View File

@ -1,7 +1,8 @@
#pragma warning disable CS1591
namespace Emby.Naming.Video namespace Emby.Naming.Video
{ {
/// <summary>
/// Extra rules type to determine against what <see cref="ExtraRule.Token"/> should be matched.
/// </summary>
public enum ExtraRuleType public enum ExtraRuleType
{ {
/// <summary> /// <summary>

View File

@ -1,5 +1,3 @@
#pragma warning disable CS1591
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;

View File

@ -1,5 +1,3 @@
#pragma warning disable CS1591
using System; using System;
using System.IO; using System.IO;
using Emby.Naming.Common; using Emby.Naming.Common;

View File

@ -1,5 +1,3 @@
#pragma warning disable CS1591
using System; using System;
using System.Linq; using System.Linq;
using Emby.Naming.Common; using Emby.Naming.Common;

View File

@ -1,5 +1,3 @@
#pragma warning disable CS1591
using System.Collections.Generic; using System.Collections.Generic;
namespace Emby.Naming.Video namespace Emby.Naming.Video

View File

@ -1,5 +1,3 @@
#pragma warning disable CS1591
namespace Emby.Naming.Video namespace Emby.Naming.Video
{ {
public class Format3DRule public class Format3DRule

View File

@ -1,5 +1,3 @@
#pragma warning disable CS1591
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;

View File

@ -1,6 +1,3 @@
#pragma warning disable CS1591
#nullable enable
using System; using System;
using System.IO; using System.IO;
using System.Linq; using System.Linq;

View File

@ -1,5 +1,3 @@
#pragma warning disable CS1591
namespace Emby.Naming.Video namespace Emby.Naming.Video
{ {
public class StubTypeRule public class StubTypeRule

View File

@ -1,5 +1,3 @@
#pragma warning disable CS1591
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;

View File

@ -1,6 +1,3 @@
#pragma warning disable CS1591
#nullable enable
using System; using System;
using System.IO; using System.IO;
using System.Linq; using System.Linq;