aboutsummaryrefslogtreecommitdiff
path: root/Emby.Naming/AudioBook/AudioBookFileInfo.cs
diff options
context:
space:
mode:
authorWWWesten <4700006+WWWesten@users.noreply.github.com>2021-11-01 23:43:29 +0500
committerGitHub <noreply@github.com>2021-11-01 23:43:29 +0500
commit0a14279e2a21bcb9654a06a2d49e1e4f0cc5329c (patch)
treee1b1bd603b011ca98e5793e356326bf4a35a7050 /Emby.Naming/AudioBook/AudioBookFileInfo.cs
parentf2817fef743eeb75a00782ceea363b2d3e7dc9f2 (diff)
parent76eeb8f655424d295e73ced8349c6fefee6ddb12 (diff)
Merge branch 'jellyfin:master' into master
Diffstat (limited to 'Emby.Naming/AudioBook/AudioBookFileInfo.cs')
-rw-r--r--Emby.Naming/AudioBook/AudioBookFileInfo.cs52
1 files changed, 41 insertions, 11 deletions
diff --git a/Emby.Naming/AudioBook/AudioBookFileInfo.cs b/Emby.Naming/AudioBook/AudioBookFileInfo.cs
index de66a5402..862e39667 100644
--- a/Emby.Naming/AudioBook/AudioBookFileInfo.cs
+++ b/Emby.Naming/AudioBook/AudioBookFileInfo.cs
@@ -3,44 +3,74 @@ using System;
namespace Emby.Naming.AudioBook
{
/// <summary>
- /// Represents a single video file
+ /// Represents a single video file.
/// </summary>
public class AudioBookFileInfo : IComparable<AudioBookFileInfo>
{
/// <summary>
+ /// Initializes a new instance of the <see cref="AudioBookFileInfo"/> class.
+ /// </summary>
+ /// <param name="path">Path to audiobook file.</param>
+ /// <param name="container">File type.</param>
+ /// <param name="partNumber">Number of part this file represents.</param>
+ /// <param name="chapterNumber">Number of chapter this file represents.</param>
+ public AudioBookFileInfo(string path, string container, int? partNumber = default, int? chapterNumber = default)
+ {
+ Path = path;
+ Container = container;
+ PartNumber = partNumber;
+ ChapterNumber = chapterNumber;
+ }
+
+ /// <summary>
/// Gets or sets the path.
/// </summary>
/// <value>The path.</value>
public string Path { get; set; }
+
/// <summary>
/// Gets or sets the container.
/// </summary>
/// <value>The container.</value>
public string Container { get; set; }
+
/// <summary>
/// Gets or sets the part number.
/// </summary>
/// <value>The part number.</value>
public int? PartNumber { get; set; }
+
/// <summary>
/// Gets or sets the chapter number.
/// </summary>
/// <value>The chapter number.</value>
public int? ChapterNumber { get; set; }
- /// <summary>
- /// Gets or sets the type.
- /// </summary>
- /// <value>The type.</value>
- public bool IsDirectory { get; set; }
- public int CompareTo(AudioBookFileInfo other)
+ /// <inheritdoc />
+ public int CompareTo(AudioBookFileInfo? other)
{
- if (ReferenceEquals(this, other)) return 0;
- if (ReferenceEquals(null, other)) return 1;
+ if (ReferenceEquals(this, other))
+ {
+ return 0;
+ }
+
+ if (ReferenceEquals(null, other))
+ {
+ return 1;
+ }
+
var chapterNumberComparison = Nullable.Compare(ChapterNumber, other.ChapterNumber);
- if (chapterNumberComparison != 0) return chapterNumberComparison;
+ if (chapterNumberComparison != 0)
+ {
+ return chapterNumberComparison;
+ }
+
var partNumberComparison = Nullable.Compare(PartNumber, other.PartNumber);
- if (partNumberComparison != 0) return partNumberComparison;
+ if (partNumberComparison != 0)
+ {
+ return partNumberComparison;
+ }
+
return string.Compare(Path, other.Path, StringComparison.Ordinal);
}
}