aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStepan <ste.martinek+git@gmail.com>2020-11-10 19:23:10 +0100
committerStepan <ste.martinek+git@gmail.com>2020-11-10 19:23:10 +0100
commit158eff62d75db2d5e6e6f09fbe6e03eac607fc56 (patch)
treef6b1aa8221d5b929828968082ff322cd1b4cb346
parent693760e38ae51b9267f9383c3957df742bb136a6 (diff)
Xml-doc part2
-rw-r--r--Emby.Naming/Common/MediaType.cs3
-rw-r--r--Emby.Naming/Common/NamingOptions.cs87
-rw-r--r--Emby.Naming/Subtitles/SubtitleInfo.cs9
-rw-r--r--Emby.Naming/Subtitles/SubtitleParser.cs14
-rw-r--r--Emby.Naming/TV/EpisodeResolver.cs17
-rw-r--r--Emby.Naming/TV/SeasonPathParser.cs10
-rw-r--r--Emby.Naming/TV/SeasonPathParserResult.cs7
-rw-r--r--Emby.Naming/Video/ExtraResolver.cs12
-rw-r--r--Emby.Naming/Video/ExtraResult.cs3
-rw-r--r--Emby.Naming/Video/ExtraRule.cs7
-rw-r--r--Emby.Naming/Video/FileStack.cs21
-rw-r--r--Emby.Naming/Video/FlagParser.cs18
-rw-r--r--Emby.Naming/Video/Format3DParser.cs12
-rw-r--r--Emby.Naming/Video/Format3DResult.cs6
-rw-r--r--Emby.Naming/Video/Format3DRule.cs8
-rw-r--r--Emby.Naming/Video/StackResolver.cs27
-rw-r--r--Emby.Naming/Video/StubResolver.cs10
-rw-r--r--Emby.Naming/Video/StubTypeRule.cs8
-rw-r--r--Emby.Naming/Video/VideoListResolver.cs13
-rw-r--r--Emby.Naming/Video/VideoResolver.cs29
-rw-r--r--tests/Jellyfin.Naming.Tests/Subtitles/SubtitleParserTests.cs7
21 files changed, 321 insertions, 7 deletions
diff --git a/Emby.Naming/Common/MediaType.cs b/Emby.Naming/Common/MediaType.cs
index 1231b1887..dc9784c6d 100644
--- a/Emby.Naming/Common/MediaType.cs
+++ b/Emby.Naming/Common/MediaType.cs
@@ -1,5 +1,8 @@
namespace Emby.Naming.Common
{
+ /// <summary>
+ /// Type of audiovisual media.
+ /// </summary>
public enum MediaType
{
/// <summary>
diff --git a/Emby.Naming/Common/NamingOptions.cs b/Emby.Naming/Common/NamingOptions.cs
index 0f02c03cb..035d1b228 100644
--- a/Emby.Naming/Common/NamingOptions.cs
+++ b/Emby.Naming/Common/NamingOptions.cs
@@ -8,8 +8,14 @@ using MediaBrowser.Model.Entities;
namespace Emby.Naming.Common
{
+ /// <summary>
+ /// Big ugly class containing lot of different naming options that should be split and injected instead of passes everywhere.
+ /// </summary>
public class NamingOptions
{
+ /// <summary>
+ /// Initializes a new instance of the <see cref="NamingOptions"/> class.
+ /// </summary>
public NamingOptions()
{
VideoFileExtensions = new[]
@@ -644,58 +650,139 @@ namespace Emby.Naming.Common
Compile();
}
+ /// <summary>
+ /// Gets or sets list of audio file extensions.
+ /// </summary>
public string[] AudioFileExtensions { get; set; }
+ /// <summary>
+ /// Gets or sets list of album stacking prefixes.
+ /// </summary>
public string[] AlbumStackingPrefixes { get; set; }
+ /// <summary>
+ /// Gets or sets list of subtitle file extensions.
+ /// </summary>
public string[] SubtitleFileExtensions { get; set; }
+ /// <summary>
+ /// Gets or sets list of subtitles flag delimiters.
+ /// </summary>
public char[] SubtitleFlagDelimiters { get; set; }
+ /// <summary>
+ /// Gets or sets list of subtitle forced flags.
+ /// </summary>
public string[] SubtitleForcedFlags { get; set; }
+ /// <summary>
+ /// Gets or sets list of subtitle default flags.
+ /// </summary>
public string[] SubtitleDefaultFlags { get; set; }
+ /// <summary>
+ /// Gets or sets list of episode regular expressions.
+ /// </summary>
public EpisodeExpression[] EpisodeExpressions { get; set; }
+ /// <summary>
+ /// Gets or sets list of raw episode without season regular expressions strings.
+ /// </summary>
public string[] EpisodeWithoutSeasonExpressions { get; set; }
+ /// <summary>
+ /// Gets or sets list of raw multi-part episodes regular expressions strings.
+ /// </summary>
public string[] EpisodeMultiPartExpressions { get; set; }
+ /// <summary>
+ /// Gets or sets list of video file extensions.
+ /// </summary>
public string[] VideoFileExtensions { get; set; }
+ /// <summary>
+ /// Gets or sets list of video stub file extensions.
+ /// </summary>
public string[] StubFileExtensions { get; set; }
+ /// <summary>
+ /// Gets or sets list of raw audiobook parts regular expressions strings.
+ /// </summary>
public string[] AudioBookPartsExpressions { get; set; }
+ /// <summary>
+ /// Gets or sets list of raw audiobook names regular expressions strings.
+ /// </summary>
public string[] AudioBookNamesExpressions { get; set; }
+ /// <summary>
+ /// Gets or sets list of stub type rules.
+ /// </summary>
public StubTypeRule[] StubTypes { get; set; }
+ /// <summary>
+ /// Gets or sets list of video flag delimiters.
+ /// </summary>
public char[] VideoFlagDelimiters { get; set; }
+ /// <summary>
+ /// Gets or sets list of 3D Format rules.
+ /// </summary>
public Format3DRule[] Format3DRules { get; set; }
+ /// <summary>
+ /// Gets or sets list of raw video file-stacking expressions strings.
+ /// </summary>
public string[] VideoFileStackingExpressions { get; set; }
+ /// <summary>
+ /// Gets or sets list of raw clean DateTimes regular expressions strings.
+ /// </summary>
public string[] CleanDateTimes { get; set; }
+ /// <summary>
+ /// Gets or sets list of raw clean strings regular expressions strings.
+ /// </summary>
public string[] CleanStrings { get; set; }
+ /// <summary>
+ /// Gets or sets list of multi-episode regular expressions.
+ /// </summary>
public EpisodeExpression[] MultipleEpisodeExpressions { get; set; }
+ /// <summary>
+ /// Gets or sets list of extra rules for videos.
+ /// </summary>
public ExtraRule[] VideoExtraRules { get; set; }
+ /// <summary>
+ /// Gets list of video file-stack regular expressions.
+ /// </summary>
public Regex[] VideoFileStackingRegexes { get; private set; } = Array.Empty<Regex>();
+ /// <summary>
+ /// Gets list of clean datetime regular expressions.
+ /// </summary>
public Regex[] CleanDateTimeRegexes { get; private set; } = Array.Empty<Regex>();
+ /// <summary>
+ /// Gets list of clean string regular expressions.
+ /// </summary>
public Regex[] CleanStringRegexes { get; private set; } = Array.Empty<Regex>();
+ /// <summary>
+ /// Gets list of episode without season regular expressions.
+ /// </summary>
public Regex[] EpisodeWithoutSeasonRegexes { get; private set; } = Array.Empty<Regex>();
+ /// <summary>
+ /// Gets list of multi-part episode regular expressions.
+ /// </summary>
public Regex[] EpisodeMultiPartRegexes { get; private set; } = Array.Empty<Regex>();
+ /// <summary>
+ /// Compiles raw regex strings into regexes.
+ /// </summary>
public void Compile()
{
VideoFileStackingRegexes = VideoFileStackingExpressions.Select(Compile).ToArray();
diff --git a/Emby.Naming/Subtitles/SubtitleInfo.cs b/Emby.Naming/Subtitles/SubtitleInfo.cs
index 62cc3ead1..1fb2e0dc8 100644
--- a/Emby.Naming/Subtitles/SubtitleInfo.cs
+++ b/Emby.Naming/Subtitles/SubtitleInfo.cs
@@ -1,7 +1,16 @@
namespace Emby.Naming.Subtitles
{
+ /// <summary>
+ /// Class holding information about subtitle.
+ /// </summary>
public class SubtitleInfo
{
+ /// <summary>
+ /// Initializes a new instance of the <see cref="SubtitleInfo"/> class.
+ /// </summary>
+ /// <param name="path">Path to file.</param>
+ /// <param name="isDefault">Is subtitle default.</param>
+ /// <param name="isForced">Is subtitle forced.</param>
public SubtitleInfo(string path, bool isDefault, bool isForced)
{
Path = path;
diff --git a/Emby.Naming/Subtitles/SubtitleParser.cs b/Emby.Naming/Subtitles/SubtitleParser.cs
index 476a83cf3..e87245251 100644
--- a/Emby.Naming/Subtitles/SubtitleParser.cs
+++ b/Emby.Naming/Subtitles/SubtitleParser.cs
@@ -5,20 +5,32 @@ using Emby.Naming.Common;
namespace Emby.Naming.Subtitles
{
+ /// <summary>
+ /// Subtitle Parser class.
+ /// </summary>
public class SubtitleParser
{
private readonly NamingOptions _options;
+ /// <summary>
+ /// Initializes a new instance of the <see cref="SubtitleParser"/> class.
+ /// </summary>
+ /// <param name="options"><see cref="NamingOptions"/> object containing SubtitleFileExtensions, SubtitleDefaultFlags, SubtitleForcedFlags and SubtitleFlagDelimiters.</param>
public SubtitleParser(NamingOptions options)
{
_options = options;
}
+ /// <summary>
+ /// Parse file to determine if is subtitle and <see cref="SubtitleInfo"/>.
+ /// </summary>
+ /// <param name="path">Path to file.</param>
+ /// <returns>Returns null or <see cref="SubtitleInfo"/> object if parsing is successful.</returns>
public SubtitleInfo? ParseFile(string path)
{
if (path.Length == 0)
{
- throw new ArgumentException("File path can't be empty.", nameof(path));
+ return null;
}
var extension = Path.GetExtension(path);
diff --git a/Emby.Naming/TV/EpisodeResolver.cs b/Emby.Naming/TV/EpisodeResolver.cs
index 26dd6915b..f7df58786 100644
--- a/Emby.Naming/TV/EpisodeResolver.cs
+++ b/Emby.Naming/TV/EpisodeResolver.cs
@@ -6,15 +6,32 @@ using Emby.Naming.Video;
namespace Emby.Naming.TV
{
+ /// <summary>
+ /// Used to resolve information about episode from path.
+ /// </summary>
public class EpisodeResolver
{
private readonly NamingOptions _options;
+ /// <summary>
+ /// Initializes a new instance of the <see cref="EpisodeResolver"/> class.
+ /// </summary>
+ /// <param name="options"><see cref="NamingOptions"/> object containing VideoFileExtensions and passed to <see cref="StubResolver"/>, <see cref="FlagParser"/>, <see cref="Format3DParser"/> and <see cref="EpisodePathParser"/>.</param>
public EpisodeResolver(NamingOptions options)
{
_options = options;
}
+ /// <summary>
+ /// Resolve 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 null or <see cref="EpisodeInfo"/> object if successful.</returns>
public EpisodeInfo? Resolve(
string path,
bool isDirectory,
diff --git a/Emby.Naming/TV/SeasonPathParser.cs b/Emby.Naming/TV/SeasonPathParser.cs
index cf99097bc..d11c7c99e 100644
--- a/Emby.Naming/TV/SeasonPathParser.cs
+++ b/Emby.Naming/TV/SeasonPathParser.cs
@@ -4,6 +4,9 @@ using System.IO;
namespace Emby.Naming.TV
{
+ /// <summary>
+ /// Class to parse season paths.
+ /// </summary>
public static class SeasonPathParser
{
/// <summary>
@@ -21,6 +24,13 @@ namespace Emby.Naming.TV
"stagione"
};
+ /// <summary>
+ /// Attempts to parse season number from path.
+ /// </summary>
+ /// <param name="path">Path to season.</param>
+ /// <param name="supportSpecialAliases">Support special aliases when parsing.</param>
+ /// <param name="supportNumericSeasonFolders">Support numeric season folders when parsing.</param>
+ /// <returns>Returns <see cref="SeasonPathParserResult"/> object.</returns>
public static SeasonPathParserResult Parse(string path, bool supportSpecialAliases, bool supportNumericSeasonFolders)
{
var result = new SeasonPathParserResult();
diff --git a/Emby.Naming/TV/SeasonPathParserResult.cs b/Emby.Naming/TV/SeasonPathParserResult.cs
index f52f941a7..b4b6f236a 100644
--- a/Emby.Naming/TV/SeasonPathParserResult.cs
+++ b/Emby.Naming/TV/SeasonPathParserResult.cs
@@ -1,5 +1,8 @@
namespace Emby.Naming.TV
{
+ /// <summary>
+ /// Data object to pass result of <see cref="SeasonPathParser"/>.
+ /// </summary>
public class SeasonPathParserResult
{
/// <summary>
@@ -14,6 +17,10 @@ namespace Emby.Naming.TV
/// <value><c>true</c> if success; otherwise, <c>false</c>.</value>
public bool Success { get; set; }
+ /// <summary>
+ /// Gets or sets a value indicating whether "Is season folder".
+ /// Seems redundant and barely used.
+ /// </summary>
public bool IsSeasonFolder { get; set; }
}
}
diff --git a/Emby.Naming/Video/ExtraResolver.cs b/Emby.Naming/Video/ExtraResolver.cs
index 98ea342ac..dd934d91b 100644
--- a/Emby.Naming/Video/ExtraResolver.cs
+++ b/Emby.Naming/Video/ExtraResolver.cs
@@ -6,15 +6,27 @@ using Emby.Naming.Common;
namespace Emby.Naming.Video
{
+ /// <summary>
+ /// Resolve if file is extra for video.
+ /// </summary>
public class ExtraResolver
{
private readonly NamingOptions _options;
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ExtraResolver"/> class.
+ /// </summary>
+ /// <param name="options"><see cref="NamingOptions"/> object containing VideoExtraRules and passed to <see cref="AudioFileParser"/> and <see cref="VideoResolver"/>.</param>
public ExtraResolver(NamingOptions options)
{
_options = options;
}
+ /// <summary>
+ /// Attempts to resolve if file is extra.
+ /// </summary>
+ /// <param name="path">Path to file.</param>
+ /// <returns>Returns <see cref="ExtraResult"/> object.</returns>
public ExtraResult GetExtraInfo(string path)
{
return _options.VideoExtraRules
diff --git a/Emby.Naming/Video/ExtraResult.cs b/Emby.Naming/Video/ExtraResult.cs
index f3b8d2a2f..243fc2b41 100644
--- a/Emby.Naming/Video/ExtraResult.cs
+++ b/Emby.Naming/Video/ExtraResult.cs
@@ -2,6 +2,9 @@ using MediaBrowser.Model.Entities;
namespace Emby.Naming.Video
{
+ /// <summary>
+ /// Holder object for passing results from ExtraResolver.
+ /// </summary>
public class ExtraResult
{
/// <summary>
diff --git a/Emby.Naming/Video/ExtraRule.cs b/Emby.Naming/Video/ExtraRule.cs
index a93474bc6..e267ac55f 100644
--- a/Emby.Naming/Video/ExtraRule.cs
+++ b/Emby.Naming/Video/ExtraRule.cs
@@ -8,6 +8,13 @@ namespace Emby.Naming.Video
/// </summary>
public class ExtraRule
{
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ExtraRule"/> class.
+ /// </summary>
+ /// <param name="extraType">Type of extra.</param>
+ /// <param name="ruleType">Type of rule.</param>
+ /// <param name="token">Token.</param>
+ /// <param name="mediaType">Media type.</param>
public ExtraRule(ExtraType extraType, ExtraRuleType ruleType, string token, MediaType mediaType)
{
Token = token;
diff --git a/Emby.Naming/Video/FileStack.cs b/Emby.Naming/Video/FileStack.cs
index 75620e961..6519db57c 100644
--- a/Emby.Naming/Video/FileStack.cs
+++ b/Emby.Naming/Video/FileStack.cs
@@ -4,19 +4,40 @@ using System.Linq;
namespace Emby.Naming.Video
{
+ /// <summary>
+ /// Object holding list of files paths with additional information.
+ /// </summary>
public class FileStack
{
+ /// <summary>
+ /// Initializes a new instance of the <see cref="FileStack"/> class.
+ /// </summary>
public FileStack()
{
Files = new List<string>();
}
+ /// <summary>
+ /// Gets or sets name of file stack.
+ /// </summary>
public string Name { get; set; } = string.Empty;
+ /// <summary>
+ /// Gets or sets list of paths in stack.
+ /// </summary>
public List<string> Files { get; set; }
+ /// <summary>
+ /// Gets or sets a value indicating whether stack is directory stack.
+ /// </summary>
public bool IsDirectoryStack { get; set; }
+ /// <summary>
+ /// Helper function to determine if path is in the stack.
+ /// </summary>
+ /// <param name="file">Path of desired file.</param>
+ /// <param name="isDirectory">Requested type of stack.</param>
+ /// <returns>True if file is in the stack.</returns>
public bool ContainsFile(string file, bool isDirectory)
{
if (IsDirectoryStack == isDirectory)
diff --git a/Emby.Naming/Video/FlagParser.cs b/Emby.Naming/Video/FlagParser.cs
index cd15b4666..439de1813 100644
--- a/Emby.Naming/Video/FlagParser.cs
+++ b/Emby.Naming/Video/FlagParser.cs
@@ -4,20 +4,38 @@ using Emby.Naming.Common;
namespace Emby.Naming.Video
{
+ /// <summary>
+ /// Parses list of flags from filename based on delimiters.
+ /// </summary>
public class FlagParser
{
private readonly NamingOptions _options;
+ /// <summary>
+ /// Initializes a new instance of the <see cref="FlagParser"/> class.
+ /// </summary>
+ /// <param name="options"><see cref="NamingOptions"/> object containing VideoFlagDelimiters.</param>
public FlagParser(NamingOptions options)
{
_options = options;
}
+ /// <summary>
+ /// Calls GetFlags function with _options.VideoFlagDelimiters parameter.
+ /// </summary>
+ /// <param name="path">Path to file.</param>
+ /// <returns>List of found flags.</returns>
public string[] GetFlags(string path)
{
return GetFlags(path, _options.VideoFlagDelimiters);
}
+ /// <summary>
+ /// Parses flags from filename based on delimiters.
+ /// </summary>
+ /// <param name="path">Path to file.</param>
+ /// <param name="delimiters">Delimiters used to extract flags.</param>
+ /// <returns>List of found flags.</returns>
public string[] GetFlags(string path, char[] delimiters)
{
if (string.IsNullOrEmpty(path))
diff --git a/Emby.Naming/Video/Format3DParser.cs b/Emby.Naming/Video/Format3DParser.cs
index 73ad36af4..4fd5d78ba 100644
--- a/Emby.Naming/Video/Format3DParser.cs
+++ b/Emby.Naming/Video/Format3DParser.cs
@@ -4,15 +4,27 @@ using Emby.Naming.Common;
namespace Emby.Naming.Video
{
+ /// <summary>
+ /// Parste 3D format related flags.
+ /// </summary>
public class Format3DParser
{
private readonly NamingOptions _options;
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Format3DParser"/> class.
+ /// </summary>
+ /// <param name="options"><see cref="NamingOptions"/> object containing VideoFlagDelimiters and passes options to <see cref="FlagParser"/>.</param>
public Format3DParser(NamingOptions options)
{
_options = options;
}
+ /// <summary>
+ /// Parse 3D format related flags.
+ /// </summary>
+ /// <param name="path">Path to file.</param>
+ /// <returns>Returns <see cref="Format3DResult"/> object.</returns>
public Format3DResult Parse(string path)
{
int oldLen = _options.VideoFlagDelimiters.Length;
diff --git a/Emby.Naming/Video/Format3DResult.cs b/Emby.Naming/Video/Format3DResult.cs
index 539060c98..ac935f203 100644
--- a/Emby.Naming/Video/Format3DResult.cs
+++ b/Emby.Naming/Video/Format3DResult.cs
@@ -2,8 +2,14 @@ using System.Collections.Generic;
namespace Emby.Naming.Video
{
+ /// <summary>
+ /// Helper object to return data from <see cref="Format3DParser"/>.
+ /// </summary>
public class Format3DResult
{
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Format3DResult"/> class.
+ /// </summary>
public Format3DResult()
{
Tokens = new List<string>();
diff --git a/Emby.Naming/Video/Format3DRule.cs b/Emby.Naming/Video/Format3DRule.cs
index bee5c109e..e562691df 100644
--- a/Emby.Naming/Video/Format3DRule.cs
+++ b/Emby.Naming/Video/Format3DRule.cs
@@ -1,7 +1,15 @@
namespace Emby.Naming.Video
{
+ /// <summary>
+ /// Data holder class for 3D format rule.
+ /// </summary>
public class Format3DRule
{
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Format3DRule"/> class.
+ /// </summary>
+ /// <param name="token">Token.</param>
+ /// <param name="precedingToken">Token present before current token.</param>
public Format3DRule(string token, string? precedingToken = null)
{
Token = token;
diff --git a/Emby.Naming/Video/StackResolver.cs b/Emby.Naming/Video/StackResolver.cs
index d6de468cc..550c42961 100644
--- a/Emby.Naming/Video/StackResolver.cs
+++ b/Emby.Naming/Video/StackResolver.cs
@@ -9,25 +9,47 @@ using MediaBrowser.Model.IO;
namespace Emby.Naming.Video
{
+ /// <summary>
+ /// Resolve <see cref="FileStack"/> from list of paths.
+ /// </summary>
public class StackResolver
{
private readonly NamingOptions _options;
+ /// <summary>
+ /// Initializes a new instance of the <see cref="StackResolver"/> class.
+ /// </summary>
+ /// <param name="options"><see cref="NamingOptions"/> object containing VideoFileStackingRegexes and passes options to <see cref="VideoResolver"/>.</param>
public StackResolver(NamingOptions options)
{
_options = options;
}
+ /// <summary>
+ /// Resolves only directories from paths.
+ /// </summary>
+ /// <param name="files">List of paths.</param>
+ /// <returns>Enumerable <see cref="FileStack"/> of directories.</returns>
public IEnumerable<FileStack> ResolveDirectories(IEnumerable<string> files)
{
return Resolve(files.Select(i => new FileSystemMetadata { FullName = i, IsDirectory = true }));
}
+ /// <summary>
+ /// Resolves only files from paths.
+ /// </summary>
+ /// <param name="files">List of paths.</param>
+ /// <returns>Enumerable <see cref="FileStack"/> of files.</returns>
public IEnumerable<FileStack> ResolveFiles(IEnumerable<string> files)
{
return Resolve(files.Select(i => new FileSystemMetadata { FullName = i, IsDirectory = false }));
}
+ /// <summary>
+ /// Resolves audiobooks from paths.
+ /// </summary>
+ /// <param name="files">List of paths.</param>
+ /// <returns>Enumerable <see cref="FileStack"/> of directories.</returns>
public IEnumerable<FileStack> ResolveAudioBooks(IEnumerable<AudioBookFileInfo> files)
{
var groupedDirectoryFiles = files.GroupBy(file => Path.GetDirectoryName(file.Path));
@@ -56,6 +78,11 @@ namespace Emby.Naming.Video
}
}
+ /// <summary>
+ /// Resolves videos from paths.
+ /// </summary>
+ /// <param name="files">List of paths.</param>
+ /// <returns>Enumerable <see cref="FileStack"/> of videos.</returns>
public IEnumerable<FileStack> Resolve(IEnumerable<FileSystemMetadata> files)
{
var resolver = new VideoResolver(_options);
diff --git a/Emby.Naming/Video/StubResolver.cs b/Emby.Naming/Video/StubResolver.cs
index 6241a46b0..079987fe8 100644
--- a/Emby.Naming/Video/StubResolver.cs
+++ b/Emby.Naming/Video/StubResolver.cs
@@ -5,8 +5,18 @@ using Emby.Naming.Common;
namespace Emby.Naming.Video
{
+ /// <summary>
+ /// Resolve if file is stub (.disc).
+ /// </summary>
public static class StubResolver
{
+ /// <summary>
+ /// Tries to resolve if file is stub (.disc).
+ /// </summary>
+ /// <param name="path">Path to file.</param>
+ /// <param name="options">NamingOptions containing StubFileExtensions and StubTypes.</param>
+ /// <param name="stubType">Stub type.</param>
+ /// <returns>True if file is a stub.</returns>
public static bool TryResolveFile(string path, NamingOptions options, out string? stubType)
{
stubType = default;
diff --git a/Emby.Naming/Video/StubTypeRule.cs b/Emby.Naming/Video/StubTypeRule.cs
index df2d3c7d2..dfb3ac013 100644
--- a/Emby.Naming/Video/StubTypeRule.cs
+++ b/Emby.Naming/Video/StubTypeRule.cs
@@ -1,7 +1,15 @@
namespace Emby.Naming.Video
{
+ /// <summary>
+ /// Data class holding information about Stub type rule.
+ /// </summary>
public class StubTypeRule
{
+ /// <summary>
+ /// Initializes a new instance of the <see cref="StubTypeRule"/> class.
+ /// </summary>
+ /// <param name="token">Token.</param>
+ /// <param name="stubType">Stub type.</param>
public StubTypeRule(string token, string stubType)
{
Token = token;
diff --git a/Emby.Naming/Video/VideoListResolver.cs b/Emby.Naming/Video/VideoListResolver.cs
index dda322521..ee0e4d465 100644
--- a/Emby.Naming/Video/VideoListResolver.cs
+++ b/Emby.Naming/Video/VideoListResolver.cs
@@ -9,15 +9,28 @@ using MediaBrowser.Model.IO;
namespace Emby.Naming.Video
{
+ /// <summary>
+ /// Resolves alternative versions and extras from list of video files.
+ /// </summary>
public class VideoListResolver
{
private readonly NamingOptions _options;
+ /// <summary>
+ /// Initializes a new instance of the <see cref="VideoListResolver"/> class.
+ /// </summary>
+ /// <param name="options"><see cref="NamingOptions"/> object containing CleanStringRegexes and VideoFlagDelimiters and passes options to <see cref="StackResolver"/> and <see cref="VideoResolver"/>.</param>
public VideoListResolver(NamingOptions options)
{
_options = options;
}
+ /// <summary>
+ /// Resolves alternative versions and extras from list of video files.
+ /// </summary>
+ /// <param name="files">List of related video files.</param>
+ /// <param name="supportMultiVersion">Indication we should consider multi-versions of content.</param>
+ /// <returns>Returns enumerable of <see cref="VideoInfo"/> which groups files togeather when related.</returns>
public IEnumerable<VideoInfo> Resolve(List<FileSystemMetadata> files, bool supportMultiVersion = true)
{
var videoResolver = new VideoResolver(_options);
diff --git a/Emby.Naming/Video/VideoResolver.cs b/Emby.Naming/Video/VideoResolver.cs
index 31b47cdf1..d7165d8d7 100644
--- a/Emby.Naming/Video/VideoResolver.cs
+++ b/Emby.Naming/Video/VideoResolver.cs
@@ -5,10 +5,18 @@ using Emby.Naming.Common;
namespace Emby.Naming.Video
{
+ /// <summary>
+ /// Resolves <see cref="VideoFileInfo"/> from file path.
+ /// </summary>
public class VideoResolver
{
private readonly NamingOptions _options;
+ /// <summary>
+ /// Initializes a new instance of the <see cref="VideoResolver"/> class.
+ /// </summary>
+ /// <param name="options"><see cref="NamingOptions"/> object containing VideoFileExtensions, StubFileExtensions, CleanStringRegexes and CleanDateTimeRegexes
+ /// and passes options in <see cref="StubResolver"/>, <see cref="FlagParser"/>, <see cref="Format3DParser"/> and <see cref="ExtraResolver"/>.</param>
public VideoResolver(NamingOptions options)
{
_options = options;
@@ -110,23 +118,44 @@ namespace Emby.Naming.Video
extraRule: extraResult.Rule);
}
+ /// <summary>
+ /// Determines if path is video file based on extension.
+ /// </summary>
+ /// <param name="path">Path to file.</param>
+ /// <returns>True if is video file.</returns>
public bool IsVideoFile(string path)
{
var extension = Path.GetExtension(path) ?? string.Empty;
return _options.VideoFileExtensions.Contains(extension, StringComparer.OrdinalIgnoreCase);
}
+ /// <summary>
+ /// Determines if path is video file stub based on extension.
+ /// </summary>
+ /// <param name="path">Path to file.</param>
+ /// <returns>True if is video file stub.</returns>
public bool IsStubFile(string path)
{
var extension = Path.GetExtension(path) ?? string.Empty;
return _options.StubFileExtensions.Contains(extension, StringComparer.OrdinalIgnoreCase);
}
+ /// <summary>
+ /// Tries to clean name of clutter.
+ /// </summary>
+ /// <param name="name">Raw name.</param>
+ /// <param name="newName">Clean name.</param>
+ /// <returns>True if cleaning of name was successful.</returns>
public bool TryCleanString(string name, out ReadOnlySpan<char> newName)
{
return CleanStringParser.TryClean(name, _options.CleanStringRegexes, out newName);
}
+ /// <summary>
+ /// Tries to get name and year from raw name.
+ /// </summary>
+ /// <param name="name">Raw name.</param>
+ /// <returns>Returns <see cref="CleanDateTimeResult"/> with name and optional year.</returns>
public CleanDateTimeResult CleanDateTime(string name)
{
return CleanDateTimeParser.Clean(name, _options.CleanDateTimeRegexes);
diff --git a/tests/Jellyfin.Naming.Tests/Subtitles/SubtitleParserTests.cs b/tests/Jellyfin.Naming.Tests/Subtitles/SubtitleParserTests.cs
index 515209890..f3abacb4f 100644
--- a/tests/Jellyfin.Naming.Tests/Subtitles/SubtitleParserTests.cs
+++ b/tests/Jellyfin.Naming.Tests/Subtitles/SubtitleParserTests.cs
@@ -31,17 +31,12 @@ namespace Jellyfin.Naming.Tests.Subtitles
[Theory]
[InlineData("The Skin I Live In (2011).mp4")]
+ [InlineData("")]
public void SubtitleParser_InvalidFileName_ReturnsNull(string input)
{
var parser = new SubtitleParser(_namingOptions);
Assert.Null(parser.ParseFile(input));
}
-
- [Fact]
- public void SubtitleParser_EmptyFileName_ThrowsArgumentException()
- {
- Assert.Throws<ArgumentException>(() => new SubtitleParser(_namingOptions).ParseFile(string.Empty));
- }
}
}