jellyfin/Emby.Naming/Video/VideoFileInfo.cs

120 lines
4.1 KiB
C#
Raw Normal View History

2019-12-06 12:40:06 -07:00
using MediaBrowser.Model.Entities;
2018-09-12 10:26:21 -07:00
namespace Emby.Naming.Video
{
/// <summary>
2020-03-25 13:31:03 -07:00
/// Represents a single video file.
2018-09-12 10:26:21 -07:00
/// </summary>
public class VideoFileInfo
{
2020-11-05 08:59:15 -07:00
/// <summary>
/// Initializes a new instance of the <see cref="VideoFileInfo"/> class.
/// </summary>
/// <param name="name">Name of file.</param>
/// <param name="path">Path to the file.</param>
/// <param name="container">Container type.</param>
/// <param name="year">Year of release.</param>
/// <param name="extraType">Extra type.</param>
/// <param name="extraRule">Extra rule.</param>
/// <param name="format3D">Format 3D.</param>
/// <param name="is3D">Is 3D.</param>
/// <param name="isStub">Is Stub.</param>
/// <param name="stubType">Stub type.</param>
/// <param name="isDirectory">Is directory.</param>
2020-11-17 05:06:56 -07:00
public VideoFileInfo(string name, string path, string? container, int? year = default, ExtraType? extraType = default, ExtraRule? extraRule = default, string? format3D = default, bool is3D = default, bool isStub = default, string? stubType = default, bool isDirectory = default)
2020-11-05 08:59:15 -07:00
{
Path = path;
Container = container;
Name = name;
Year = year;
ExtraType = extraType;
ExtraRule = extraRule;
Format3D = format3D;
Is3D = is3D;
IsStub = isStub;
StubType = stubType;
IsDirectory = isDirectory;
}
2018-09-12 10:26:21 -07:00
/// <summary>
2020-03-25 13:31:03 -07:00
/// Gets or sets the path.
2018-09-12 10:26:21 -07:00
/// </summary>
/// <value>The path.</value>
2020-11-17 05:06:56 -07:00
public string Path { get; set; }
2019-05-10 11:37:42 -07:00
2018-09-12 10:26:21 -07:00
/// <summary>
2020-03-25 13:31:03 -07:00
/// Gets or sets the container.
2018-09-12 10:26:21 -07:00
/// </summary>
/// <value>The container.</value>
2020-11-01 02:47:31 -07:00
public string? Container { get; set; }
2019-05-10 11:37:42 -07:00
2018-09-12 10:26:21 -07:00
/// <summary>
2020-03-25 13:31:03 -07:00
/// Gets or sets the name.
2018-09-12 10:26:21 -07:00
/// </summary>
/// <value>The name.</value>
2020-11-05 08:59:15 -07:00
public string Name { get; set; }
2019-05-10 11:37:42 -07:00
2018-09-12 10:26:21 -07:00
/// <summary>
2020-03-25 13:31:03 -07:00
/// Gets or sets the year.
2018-09-12 10:26:21 -07:00
/// </summary>
/// <value>The year.</value>
public int? Year { get; set; }
2019-05-10 11:37:42 -07:00
2018-09-12 10:26:21 -07:00
/// <summary>
2020-03-25 13:31:03 -07:00
/// Gets or sets the type of the extra, e.g. trailer, theme song, behind the scenes, etc.
2018-09-12 10:26:21 -07:00
/// </summary>
/// <value>The type of the extra.</value>
2019-12-06 12:40:06 -07:00
public ExtraType? ExtraType { get; set; }
2019-05-10 11:37:42 -07:00
2018-09-12 10:26:21 -07:00
/// <summary>
2020-03-25 13:31:03 -07:00
/// Gets or sets the extra rule.
2018-09-12 10:26:21 -07:00
/// </summary>
/// <value>The extra rule.</value>
2020-11-01 02:47:31 -07:00
public ExtraRule? ExtraRule { get; set; }
2019-05-10 11:37:42 -07:00
2018-09-12 10:26:21 -07:00
/// <summary>
2020-03-25 13:31:03 -07:00
/// Gets or sets the format3 d.
2018-09-12 10:26:21 -07:00
/// </summary>
/// <value>The format3 d.</value>
2020-11-01 02:47:31 -07:00
public string? Format3D { get; set; }
2019-05-10 11:37:42 -07:00
2018-09-12 10:26:21 -07:00
/// <summary>
2020-03-25 13:31:03 -07:00
/// Gets or sets a value indicating whether [is3 d].
2018-09-12 10:26:21 -07:00
/// </summary>
/// <value><c>true</c> if [is3 d]; otherwise, <c>false</c>.</value>
public bool Is3D { get; set; }
2019-05-10 11:37:42 -07:00
2018-09-12 10:26:21 -07:00
/// <summary>
2020-03-25 13:31:03 -07:00
/// Gets or sets a value indicating whether this instance is stub.
2018-09-12 10:26:21 -07:00
/// </summary>
/// <value><c>true</c> if this instance is stub; otherwise, <c>false</c>.</value>
public bool IsStub { get; set; }
2019-05-10 11:37:42 -07:00
2018-09-12 10:26:21 -07:00
/// <summary>
2020-03-25 13:31:03 -07:00
/// Gets or sets the type of the stub.
2018-09-12 10:26:21 -07:00
/// </summary>
/// <value>The type of the stub.</value>
2020-11-01 02:47:31 -07:00
public string? StubType { get; set; }
2019-05-10 11:37:42 -07:00
2018-09-12 10:26:21 -07:00
/// <summary>
2020-03-25 13:31:03 -07:00
/// Gets or sets a value indicating whether this instance is a directory.
2018-09-12 10:26:21 -07:00
/// </summary>
/// <value>The type.</value>
public bool IsDirectory { get; set; }
2019-05-10 11:37:42 -07:00
2018-09-12 10:26:21 -07:00
/// <summary>
2020-03-25 13:31:03 -07:00
/// Gets the file name without extension.
2018-09-12 10:26:21 -07:00
/// </summary>
/// <value>The file name without extension.</value>
2020-03-25 09:53:03 -07:00
public string FileNameWithoutExtension => !IsDirectory
? System.IO.Path.GetFileNameWithoutExtension(Path)
: System.IO.Path.GetFileName(Path);
2018-09-12 10:26:21 -07:00
/// <inheritdoc />
2018-09-12 10:26:21 -07:00
public override string ToString()
{
2020-11-05 08:59:15 -07:00
return "VideoFileInfo(Name: '" + Name + "')";
2018-09-12 10:26:21 -07:00
}
}
}