| | 1 | | using System; |
| | 2 | | using MediaBrowser.Model.Entities; |
| | 3 | |
|
| | 4 | | namespace Emby.Naming.Video |
| | 5 | | { |
| | 6 | | /// <summary> |
| | 7 | | /// Represents a single video file. |
| | 8 | | /// </summary> |
| | 9 | | public class VideoFileInfo |
| | 10 | | { |
| | 11 | | /// <summary> |
| | 12 | | /// Initializes a new instance of the <see cref="VideoFileInfo"/> class. |
| | 13 | | /// </summary> |
| | 14 | | /// <param name="name">Name of file.</param> |
| | 15 | | /// <param name="path">Path to the file.</param> |
| | 16 | | /// <param name="container">Container type.</param> |
| | 17 | | /// <param name="year">Year of release.</param> |
| | 18 | | /// <param name="extraType">Extra type.</param> |
| | 19 | | /// <param name="extraRule">Extra rule.</param> |
| | 20 | | /// <param name="format3D">Format 3D.</param> |
| | 21 | | /// <param name="is3D">Is 3D.</param> |
| | 22 | | /// <param name="isStub">Is Stub.</param> |
| | 23 | | /// <param name="stubType">Stub type.</param> |
| | 24 | | /// <param name="isDirectory">Is directory.</param> |
| | 25 | | public VideoFileInfo(string name, string path, string? container, int? year = default, ExtraType? extraType = de |
| | 26 | | { |
| 251 | 27 | | Path = path; |
| 251 | 28 | | Container = container; |
| 251 | 29 | | Name = name; |
| 251 | 30 | | Year = year; |
| 251 | 31 | | ExtraType = extraType; |
| 251 | 32 | | ExtraRule = extraRule; |
| 251 | 33 | | Format3D = format3D; |
| 251 | 34 | | Is3D = is3D; |
| 251 | 35 | | IsStub = isStub; |
| 251 | 36 | | StubType = stubType; |
| 251 | 37 | | IsDirectory = isDirectory; |
| 251 | 38 | | } |
| | 39 | |
|
| | 40 | | /// <summary> |
| | 41 | | /// Gets or sets the path. |
| | 42 | | /// </summary> |
| | 43 | | /// <value>The path.</value> |
| | 44 | | public string Path { get; set; } |
| | 45 | |
|
| | 46 | | /// <summary> |
| | 47 | | /// Gets or sets the container. |
| | 48 | | /// </summary> |
| | 49 | | /// <value>The container.</value> |
| | 50 | | public string? Container { get; set; } |
| | 51 | |
|
| | 52 | | /// <summary> |
| | 53 | | /// Gets or sets the name. |
| | 54 | | /// </summary> |
| | 55 | | /// <value>The name.</value> |
| | 56 | | public string Name { get; set; } |
| | 57 | |
|
| | 58 | | /// <summary> |
| | 59 | | /// Gets or sets the year. |
| | 60 | | /// </summary> |
| | 61 | | /// <value>The year.</value> |
| | 62 | | public int? Year { get; set; } |
| | 63 | |
|
| | 64 | | /// <summary> |
| | 65 | | /// Gets or sets the type of the extra, e.g. trailer, theme song, behind the scenes, etc. |
| | 66 | | /// </summary> |
| | 67 | | /// <value>The type of the extra.</value> |
| | 68 | | public ExtraType? ExtraType { get; set; } |
| | 69 | |
|
| | 70 | | /// <summary> |
| | 71 | | /// Gets or sets the extra rule. |
| | 72 | | /// </summary> |
| | 73 | | /// <value>The extra rule.</value> |
| | 74 | | public ExtraRule? ExtraRule { get; set; } |
| | 75 | |
|
| | 76 | | /// <summary> |
| | 77 | | /// Gets or sets the format3 d. |
| | 78 | | /// </summary> |
| | 79 | | /// <value>The format3 d.</value> |
| | 80 | | public string? Format3D { get; set; } |
| | 81 | |
|
| | 82 | | /// <summary> |
| | 83 | | /// Gets or sets a value indicating whether [is3 d]. |
| | 84 | | /// </summary> |
| | 85 | | /// <value><c>true</c> if [is3 d]; otherwise, <c>false</c>.</value> |
| | 86 | | public bool Is3D { get; set; } |
| | 87 | |
|
| | 88 | | /// <summary> |
| | 89 | | /// Gets or sets a value indicating whether this instance is stub. |
| | 90 | | /// </summary> |
| | 91 | | /// <value><c>true</c> if this instance is stub; otherwise, <c>false</c>.</value> |
| | 92 | | public bool IsStub { get; set; } |
| | 93 | |
|
| | 94 | | /// <summary> |
| | 95 | | /// Gets or sets the type of the stub. |
| | 96 | | /// </summary> |
| | 97 | | /// <value>The type of the stub.</value> |
| | 98 | | public string? StubType { get; set; } |
| | 99 | |
|
| | 100 | | /// <summary> |
| | 101 | | /// Gets or sets a value indicating whether this instance is a directory. |
| | 102 | | /// </summary> |
| | 103 | | /// <value>The type.</value> |
| | 104 | | public bool IsDirectory { get; set; } |
| | 105 | |
|
| | 106 | | /// <summary> |
| | 107 | | /// Gets the file name without extension. |
| | 108 | | /// </summary> |
| | 109 | | /// <value>The file name without extension.</value> |
| 302 | 110 | | public ReadOnlySpan<char> FileNameWithoutExtension => !IsDirectory |
| 302 | 111 | | ? System.IO.Path.GetFileNameWithoutExtension(Path.AsSpan()) |
| 302 | 112 | | : System.IO.Path.GetFileName(Path.AsSpan()); |
| | 113 | |
|
| | 114 | | /// <inheritdoc /> |
| | 115 | | public override string ToString() |
| | 116 | | { |
| 48 | 117 | | return "VideoFileInfo(Name: '" + Name + "')"; |
| | 118 | | } |
| | 119 | | } |
| | 120 | | } |