Fix warnings in Emby.Naming

pull/2667/head
crobibero 4 years ago
parent 37ff36226b
commit cb68fbeb0a

@ -3,41 +3,41 @@ using System;
namespace Emby.Naming.AudioBook
{
/// <summary>
/// Represents a single video file.
/// Represents a single video file.
/// </summary>
public class AudioBookFileInfo : IComparable<AudioBookFileInfo>
{
/// <summary>
/// Gets or sets the path.
/// Gets or sets the path.
/// </summary>
/// <value>The path.</value>
public string Path { get; set; }
/// <summary>
/// Gets or sets the container.
/// Gets or sets the container.
/// </summary>
/// <value>The container.</value>
public string Container { get; set; }
/// <summary>
/// Gets or sets the part number.
/// Gets or sets the part number.
/// </summary>
/// <value>The part number.</value>
public int? PartNumber { get; set; }
/// <summary>
/// Gets or sets the chapter number.
/// Gets or sets the chapter number.
/// </summary>
/// <value>The chapter number.</value>
public int? ChapterNumber { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is a directory.
/// Gets or sets a value indicating whether this instance is a directory.
/// </summary>
/// <value>The type.</value>
public bool IsDirectory { get; set; }
/// <inheritdoc/>
/// <inheritdoc />
public int CompareTo(AudioBookFileInfo other)
{
if (ReferenceEquals(this, other))

@ -3,12 +3,12 @@ using System.Collections.Generic;
namespace Emby.Naming.AudioBook
{
/// <summary>
/// Represents a complete video, including all parts and subtitles.
/// Represents a complete video, including all parts and subtitles.
/// </summary>
public class AudioBookInfo
{
/// <summary>
/// Initializes a new instance of the <see cref="AudioBookInfo" /> class.
/// Initializes a new instance of the <see cref="AudioBookInfo" /> class.
/// </summary>
public AudioBookInfo()
{
@ -18,30 +18,30 @@ namespace Emby.Naming.AudioBook
}
/// <summary>
/// Gets or sets the name.
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
public string Name { get; set; }
/// <summary>
/// Gets or sets the year.
/// Gets or sets the year.
/// </summary>
public int? Year { get; set; }
/// <summary>
/// Gets or sets the files.
/// Gets or sets the files.
/// </summary>
/// <value>The files.</value>
public List<AudioBookFileInfo> Files { get; set; }
/// <summary>
/// Gets or sets the extras.
/// Gets or sets the extras.
/// </summary>
/// <value>The extras.</value>
public List<AudioBookFileInfo> Extras { get; set; }
/// <summary>
/// Gets or sets the alternate versions.
/// Gets or sets the alternate versions.
/// </summary>
/// <value>The alternate versions.</value>
public List<AudioBookFileInfo> AlternateVersions { get; set; }

@ -29,11 +29,7 @@ namespace Emby.Naming.AudioBook
// Filter out all extras, otherwise they could cause stacks to not be resolved
// See the unit test TestStackedWithTrailer
var metadata = audiobookFileInfos
.Select(i => new FileSystemMetadata
{
FullName = i.Path,
IsDirectory = i.IsDirectory
});
.Select(i => new FileSystemMetadata { FullName = i.Path, IsDirectory = i.IsDirectory });
var stackResult = new StackResolver(_options)
.ResolveAudioBooks(metadata);
@ -42,11 +38,7 @@ namespace Emby.Naming.AudioBook
{
var stackFiles = stack.Files.Select(i => audioBookResolver.Resolve(i, stack.IsDirectoryStack)).ToList();
stackFiles.Sort();
var info = new AudioBookInfo
{
Files = stackFiles,
Name = stack.Name
};
var info = new AudioBookInfo { Files = stackFiles, Name = stack.Name };
yield return info;
}

@ -5,17 +5,17 @@ namespace Emby.Naming.Common
public enum MediaType
{
/// <summary>
/// The audio
/// The audio
/// </summary>
Audio = 0,
/// <summary>
/// The photo
/// The photo
/// </summary>
Photo = 1,
/// <summary>
/// The video
/// The video
/// </summary>
Video = 2
}

@ -5,25 +5,25 @@ namespace Emby.Naming.Subtitles
public class SubtitleInfo
{
/// <summary>
/// Gets or sets the path.
/// Gets or sets the path.
/// </summary>
/// <value>The path.</value>
public string Path { get; set; }
/// <summary>
/// Gets or sets the language.
/// Gets or sets the language.
/// </summary>
/// <value>The language.</value>
public string Language { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is default.
/// Gets or sets a value indicating whether this instance is default.
/// </summary>
/// <value><c>true</c> if this instance is default; otherwise, <c>false</c>.</value>
public bool IsDefault { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is forced.
/// Gets or sets a value indicating whether this instance is forced.
/// </summary>
/// <value><c>true</c> if this instance is forced; otherwise, <c>false</c>.</value>
public bool IsForced { get; set; }

@ -37,7 +37,9 @@ namespace Emby.Naming.Subtitles
IsForced = _options.SubtitleForcedFlags.Any(i => flags.Contains(i, StringComparer.OrdinalIgnoreCase))
};
var parts = flags.Where(i => !_options.SubtitleDefaultFlags.Contains(i, StringComparer.OrdinalIgnoreCase) && !_options.SubtitleForcedFlags.Contains(i, StringComparer.OrdinalIgnoreCase))
var parts = flags.Where(i =>
!_options.SubtitleDefaultFlags.Contains(i, StringComparer.OrdinalIgnoreCase) &&
!_options.SubtitleForcedFlags.Contains(i, StringComparer.OrdinalIgnoreCase))
.ToList();
// Should have a name, language and file extension

@ -5,43 +5,43 @@ namespace Emby.Naming.TV
public class EpisodeInfo
{
/// <summary>
/// Gets or sets the path.
/// Gets or sets the path.
/// </summary>
/// <value>The path.</value>
public string Path { get; set; }
/// <summary>
/// Gets or sets the container.
/// Gets or sets the container.
/// </summary>
/// <value>The container.</value>
public string Container { get; set; }
/// <summary>
/// Gets or sets the name of the series.
/// Gets or sets the name of the series.
/// </summary>
/// <value>The name of the series.</value>
public string SeriesName { get; set; }
/// <summary>
/// Gets or sets the format3 d.
/// Gets or sets the format3 d.
/// </summary>
/// <value>The format3 d.</value>
public string Format3D { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [is3 d].
/// Gets or sets a value indicating whether [is3 d].
/// </summary>
/// <value><c>true</c> if [is3 d]; otherwise, <c>false</c>.</value>
public bool Is3D { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is stub.
/// Gets or sets a value indicating whether this instance is stub.
/// </summary>
/// <value><c>true</c> if this instance is stub; otherwise, <c>false</c>.</value>
public bool IsStub { get; set; }
/// <summary>
/// Gets or sets the type of the stub.
/// Gets or sets the type of the stub.
/// </summary>
/// <value>The type of the stub.</value>
public string StubType { get; set; }

@ -18,7 +18,13 @@ namespace Emby.Naming.TV
_options = options;
}
public EpisodePathParserResult Parse(string path, bool isDirectory, bool? isNamed = null, bool? isOptimistic = null, bool? supportsAbsoluteNumbers = null, bool fillExtendedInfo = true)
public EpisodePathParserResult Parse(
string path,
bool isDirectory,
bool? isNamed = null,
bool? isOptimistic = null,
bool? supportsAbsoluteNumbers = null,
bool fillExtendedInfo = true)
{
// Added to be able to use regex patterns which require a file extension.
// There were no failed tests without this block, but to be safe, we can keep it until
@ -64,7 +70,7 @@ namespace Emby.Naming.TV
{
result.SeriesName = result.SeriesName
.Trim()
.Trim(new[] { '_', '.', '-' })
.Trim('_', '.', '-')
.Trim();
}
}

@ -9,7 +9,7 @@ namespace Emby.Naming.TV
public static class SeasonPathParser
{
/// <summary>
/// A season folder must contain one of these somewhere in the name.
/// A season folder must contain one of these somewhere in the name.
/// </summary>
private static readonly string[] _seasonFolderNames =
{
@ -41,7 +41,7 @@ namespace Emby.Naming.TV
}
/// <summary>
/// Gets the season number from path.
/// Gets the season number from path.
/// </summary>
/// <param name="path">The path.</param>
/// <param name="supportSpecialAliases">if set to <c>true</c> [support special aliases].</param>

@ -5,13 +5,13 @@ namespace Emby.Naming.TV
public class SeasonPathParserResult
{
/// <summary>
/// Gets or sets the season number.
/// Gets or sets the season number.
/// </summary>
/// <value>The season number.</value>
public int? SeasonNumber { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this <see cref="SeasonPathParserResult"/> is success.
/// Gets or sets a value indicating whether this <see cref="SeasonPathParserResult" /> is success.
/// </summary>
/// <value><c>true</c> if success; otherwise, <c>false</c>.</value>
public bool Success { get; set; }

@ -8,7 +8,7 @@ using System.Text.RegularExpressions;
namespace Emby.Naming.Video
{
/// <summary>
/// <see href="http://kodi.wiki/view/Advancedsettings.xml#video" />.
/// <see href="http://kodi.wiki/view/Advancedsettings.xml#video" />.
/// </summary>
public static class CleanDateTimeParser
{

@ -18,13 +18,13 @@ namespace Emby.Naming.Video
}
/// <summary>
/// Gets the name.
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public string Name { get; }
/// <summary>
/// Gets the year.
/// Gets the year.
/// </summary>
/// <value>The year.</value>
public int? Year { get; }

@ -8,7 +8,7 @@ using System.Text.RegularExpressions;
namespace Emby.Naming.Video
{
/// <summary>
/// <see href="http://kodi.wiki/view/Advancedsettings.xml#video" />.
/// <see href="http://kodi.wiki/view/Advancedsettings.xml#video" />.
/// </summary>
public static class CleanStringParser
{

@ -7,13 +7,13 @@ namespace Emby.Naming.Video
public class ExtraResult
{
/// <summary>
/// Gets or sets the type of the extra.
/// Gets or sets the type of the extra.
/// </summary>
/// <value>The type of the extra.</value>
public ExtraType? ExtraType { get; set; }
/// <summary>
/// Gets or sets the rule.
/// Gets or sets the rule.
/// </summary>
/// <value>The rule.</value>
public ExtraRule Rule { get; set; }

@ -8,25 +8,25 @@ namespace Emby.Naming.Video
public class ExtraRule
{
/// <summary>
/// Gets or sets the token.
/// Gets or sets the token.
/// </summary>
/// <value>The token.</value>
public string Token { get; set; }
/// <summary>
/// Gets or sets the type of the extra.
/// Gets or sets the type of the extra.
/// </summary>
/// <value>The type of the extra.</value>
public ExtraType ExtraType { get; set; }
/// <summary>
/// Gets or sets the type of the rule.
/// Gets or sets the type of the rule.
/// </summary>
/// <value>The type of the rule.</value>
public ExtraRuleType RuleType { get; set; }
/// <summary>
/// Gets or sets the type of the media.
/// Gets or sets the type of the media.
/// </summary>
/// <value>The type of the media.</value>
public MediaType MediaType { get; set; }

@ -5,17 +5,17 @@ namespace Emby.Naming.Video
public enum ExtraRuleType
{
/// <summary>
/// The suffix
/// The suffix
/// </summary>
Suffix = 0,
/// <summary>
/// The filename
/// The filename
/// </summary>
Filename = 1,
/// <summary>
/// The regex
/// The regex
/// </summary>
Regex = 2
}

@ -12,19 +12,19 @@ namespace Emby.Naming.Video
}
/// <summary>
/// Gets or sets a value indicating whether [is3 d].
/// Gets or sets a value indicating whether [is3 d].
/// </summary>
/// <value><c>true</c> if [is3 d]; otherwise, <c>false</c>.</value>
public bool Is3D { get; set; }
/// <summary>
/// Gets or sets the format3 d.
/// Gets or sets the format3 d.
/// </summary>
/// <value>The format3 d.</value>
public string Format3D { get; set; }
/// <summary>
/// Gets or sets the tokens.
/// Gets or sets the tokens.
/// </summary>
/// <value>The tokens.</value>
public List<string> Tokens { get; set; }

@ -5,13 +5,13 @@ namespace Emby.Naming.Video
public class Format3DRule
{
/// <summary>
/// Gets or sets the token.
/// Gets or sets the token.
/// </summary>
/// <value>The token.</value>
public string Token { get; set; }
/// <summary>
/// Gets or sets the preceeding token.
/// Gets or sets the preceeding token.
/// </summary>
/// <value>The preceeding token.</value>
public string PreceedingToken { get; set; }

@ -21,31 +21,20 @@ namespace Emby.Naming.Video
public IEnumerable<FileStack> ResolveDirectories(IEnumerable<string> files)
{
return Resolve(files.Select(i => new FileSystemMetadata
{
FullName = i,
IsDirectory = true
}));
return Resolve(files.Select(i => new FileSystemMetadata { FullName = i, IsDirectory = true }));
}
public IEnumerable<FileStack> ResolveFiles(IEnumerable<string> files)
{
return Resolve(files.Select(i => new FileSystemMetadata
{
FullName = i,
IsDirectory = false
}));
return Resolve(files.Select(i => new FileSystemMetadata { FullName = i, IsDirectory = false }));
}
public IEnumerable<FileStack> ResolveAudioBooks(IEnumerable<FileSystemMetadata> files)
{
foreach (var directory in files.GroupBy(file => file.IsDirectory ? file.FullName : Path.GetDirectoryName(file.FullName)))
foreach (var directory in files.GroupBy(file =>
file.IsDirectory ? file.FullName : Path.GetDirectoryName(file.FullName)))
{
var stack = new FileStack()
{
Name = Path.GetFileName(directory.Key),
IsDirectoryStack = false
};
var stack = new FileStack { Name = Path.GetFileName(directory.Key), IsDirectoryStack = false };
foreach (var file in directory)
{
if (file.IsDirectory)

@ -5,13 +5,13 @@ namespace Emby.Naming.Video
public struct StubResult
{
/// <summary>
/// Gets or sets a value indicating whether this instance is stub.
/// Gets or sets a value indicating whether this instance is stub.
/// </summary>
/// <value><c>true</c> if this instance is stub; otherwise, <c>false</c>.</value>
public bool IsStub { get; set; }
/// <summary>
/// Gets or sets the type of the stub.
/// Gets or sets the type of the stub.
/// </summary>
/// <value>The type of the stub.</value>
public string StubType { get; set; }

@ -5,13 +5,13 @@ namespace Emby.Naming.Video
public class StubTypeRule
{
/// <summary>
/// Gets or sets the token.
/// Gets or sets the token.
/// </summary>
/// <value>The token.</value>
public string Token { get; set; }
/// <summary>
/// Gets or sets the type of the stub.
/// Gets or sets the type of the stub.
/// </summary>
/// <value>The type of the stub.</value>
public string StubType { get; set; }

@ -3,81 +3,83 @@ using MediaBrowser.Model.Entities;
namespace Emby.Naming.Video
{
/// <summary>
/// Represents a single video file.
/// Represents a single video file.
/// </summary>
public class VideoFileInfo
{
/// <summary>
/// Gets or sets the path.
/// Gets or sets the path.
/// </summary>
/// <value>The path.</value>
public string Path { get; set; }
/// <summary>
/// Gets or sets the container.
/// Gets or sets the container.
/// </summary>
/// <value>The container.</value>
public string Container { get; set; }
/// <summary>
/// Gets or sets the name.
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
public string Name { get; set; }
/// <summary>
/// Gets or sets the year.
/// Gets or sets the year.
/// </summary>
/// <value>The year.</value>
public int? Year { get; set; }
/// <summary>
/// Gets or sets the type of the extra, e.g. trailer, theme song, behind the scenes, etc.
/// Gets or sets the type of the extra, e.g. trailer, theme song, behind the scenes, etc.
/// </summary>
/// <value>The type of the extra.</value>
public ExtraType? ExtraType { get; set; }
/// <summary>
/// Gets or sets the extra rule.
/// Gets or sets the extra rule.
/// </summary>
/// <value>The extra rule.</value>
public ExtraRule ExtraRule { get; set; }
/// <summary>
/// Gets or sets the format3 d.
/// Gets or sets the format3 d.
/// </summary>
/// <value>The format3 d.</value>
public string Format3D { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [is3 d].
/// Gets or sets a value indicating whether [is3 d].
/// </summary>
/// <value><c>true</c> if [is3 d]; otherwise, <c>false</c>.</value>
public bool Is3D { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is stub.
/// Gets or sets a value indicating whether this instance is stub.
/// </summary>
/// <value><c>true</c> if this instance is stub; otherwise, <c>false</c>.</value>
public bool IsStub { get; set; }
/// <summary>
/// Gets or sets the type of the stub.
/// Gets or sets the type of the stub.
/// </summary>
/// <value>The type of the stub.</value>
public string StubType { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is a directory.
/// Gets or sets a value indicating whether this instance is a directory.
/// </summary>
/// <value>The type.</value>
public bool IsDirectory { get; set; }
/// <summary>
/// Gets the file name without extension.
/// Gets the file name without extension.
/// </summary>
/// <value>The file name without extension.</value>
public string FileNameWithoutExtension => !IsDirectory ? System.IO.Path.GetFileNameWithoutExtension(Path) : System.IO.Path.GetFileName(Path);
public string FileNameWithoutExtension => !IsDirectory
? System.IO.Path.GetFileNameWithoutExtension(Path)
: System.IO.Path.GetFileName(Path);
/// <inheritdoc />
public override string ToString()

@ -4,12 +4,12 @@ using System.Collections.Generic;
namespace Emby.Naming.Video
{
/// <summary>
/// Represents a complete video, including all parts and subtitles.
/// Represents a complete video, including all parts and subtitles.
/// </summary>
public class VideoInfo
{
/// <summary>
/// Initializes a new instance of the <see cref="VideoInfo" /> class.
/// Initializes a new instance of the <see cref="VideoInfo" /> class.
/// </summary>
/// <param name="name">The name.</param>
public VideoInfo(string name)
@ -22,31 +22,31 @@ namespace Emby.Naming.Video
}
/// <summary>
/// Gets or sets the name.
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
public string Name { get; set; }
/// <summary>
/// Gets or sets the year.
/// Gets or sets the year.
/// </summary>
/// <value>The year.</value>
public int? Year { get; set; }
/// <summary>
/// Gets or sets the files.
/// Gets or sets the files.
/// </summary>
/// <value>The files.</value>
public IReadOnlyList<VideoFileInfo> Files { get; set; }
/// <summary>
/// Gets or sets the extras.
/// Gets or sets the extras.
/// </summary>
/// <value>The extras.</value>
public IReadOnlyList<VideoFileInfo> Extras { get; set; }
/// <summary>
/// Gets or sets the alternate versions.
/// Gets or sets the alternate versions.
/// </summary>
/// <value>The alternate versions.</value>
public IReadOnlyList<VideoFileInfo> AlternateVersions { get; set; }

@ -33,11 +33,7 @@ namespace Emby.Naming.Video
// See the unit test TestStackedWithTrailer
var nonExtras = videoInfos
.Where(i => i.ExtraType == null)
.Select(i => new FileSystemMetadata
{
FullName = i.Path,
IsDirectory = i.IsDirectory
});
.Select(i => new FileSystemMetadata { FullName = i.Path, IsDirectory = i.IsDirectory });
var stackResult = new StackResolver(_options)
.Resolve(nonExtras).ToList();
@ -57,11 +53,7 @@ namespace Emby.Naming.Video
info.Year = info.Files[0].Year;
var extraBaseNames = new List<string>
{
stack.Name,
Path.GetFileNameWithoutExtension(stack.Files[0])
};
var extraBaseNames = new List<string> { stack.Name, Path.GetFileNameWithoutExtension(stack.Files[0]) };
var extras = GetExtras(remainingFiles, extraBaseNames);
@ -83,10 +75,7 @@ namespace Emby.Naming.Video
foreach (var media in standaloneMedia)
{
var info = new VideoInfo(media.Name)
{
Files = new List<VideoFileInfo> { media }
};
var info = new VideoInfo(media.Name) { Files = new List<VideoFileInfo> { media } };
info.Year = info.Files[0].Year;
@ -162,8 +151,7 @@ namespace Emby.Naming.Video
// Whatever files are left, just add them
list.AddRange(remainingFiles.Select(i => new VideoInfo(i.Name)
{
Files = new List<VideoFileInfo> { i },
Year = i.Year
Files = new List<VideoFileInfo> { i }, Year = i.Year
}));
return list;
@ -183,7 +171,7 @@ namespace Emby.Naming.Video
if (!string.IsNullOrEmpty(folderName)
&& folderName.Length > 1
&& videos.All(i => i.Files.Count == 1
&& IsEligibleForMultiVersion(folderName, i.Files[0].Path))
&& IsEligibleForMultiVersion(folderName, i.Files[0].Path))
&& HaveSameYear(videos))
{
var ordered = videos.OrderBy(i => i.Name).ToList();
@ -222,8 +210,8 @@ namespace Emby.Naming.Video
{
testFilename = testFilename.Substring(folderName.Length).Trim();
return string.IsNullOrEmpty(testFilename)
|| testFilename[0] == '-'
|| string.IsNullOrWhiteSpace(Regex.Replace(testFilename, @"\[([^]]*)\]", string.Empty));
|| testFilename[0] == '-'
|| string.IsNullOrWhiteSpace(Regex.Replace(testFilename, @"\[([^]]*)\]", string.Empty));
}
return false;
@ -239,7 +227,8 @@ namespace Emby.Naming.Video
return remainingFiles
.Where(i => i.ExtraType == null)
.Where(i => baseNames.Any(b => i.FileNameWithoutExtension.StartsWith(b, StringComparison.OrdinalIgnoreCase)))
.Where(i => baseNames.Any(b =>
i.FileNameWithoutExtension.StartsWith(b, StringComparison.OrdinalIgnoreCase)))
.ToList();
}
}

@ -18,7 +18,7 @@ namespace Emby.Naming.Video
}
/// <summary>
/// Resolves the directory.
/// Resolves the directory.
/// </summary>
/// <param name="path">The path.</param>
/// <returns>VideoFileInfo.</returns>
@ -28,7 +28,7 @@ namespace Emby.Naming.Video
}
/// <summary>
/// Resolves the file.
/// Resolves the file.
/// </summary>
/// <param name="path">The path.</param>
/// <returns>VideoFileInfo.</returns>
@ -38,7 +38,7 @@ namespace Emby.Naming.Video
}
/// <summary>
/// Resolves the specified path.
/// Resolves the specified path.
/// </summary>
/// <param name="path">The path.</param>
/// <param name="isDirectory">if set to <c>true</c> [is folder].</param>

@ -26,6 +26,7 @@ namespace MediaBrowser.Model.Entities
/// </summary>
/// <value>The image path.</value>
public string ImagePath { get; set; }
public DateTime ImageDateModified { get; set; }
public string ImageTag { get; set; }

Loading…
Cancel
Save