VideoFileInfo.cs 4.1 KB

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