aboutsummaryrefslogtreecommitdiff
path: root/Emby.Naming/AudioBook
diff options
context:
space:
mode:
authorStepan <ste.martinek+git@gmail.com>2020-11-01 13:42:56 +0100
committerStepan <ste.martinek+git@gmail.com>2020-11-01 13:42:56 +0100
commite7a37bedfca159ab6a305833395aead07ccd872f (patch)
tree9b5b1c3710fa466e402d18ff0940d6c2acd28167 /Emby.Naming/AudioBook
parent6437cf69508076bab2d62bbe887f12b72d02f7b3 (diff)
Simplify AudioBookResolver since there is no option of passing directories into it (AudioResolver.cs:179) and handling directories were not implemented anyway
Diffstat (limited to 'Emby.Naming/AudioBook')
-rw-r--r--Emby.Naming/AudioBook/AudioBookFileInfo.cs10
-rw-r--r--Emby.Naming/AudioBook/AudioBookListResolver.cs8
-rw-r--r--Emby.Naming/AudioBook/AudioBookResolver.cs11
3 files changed, 7 insertions, 22 deletions
diff --git a/Emby.Naming/AudioBook/AudioBookFileInfo.cs b/Emby.Naming/AudioBook/AudioBookFileInfo.cs
index e5200416ee..862e396677 100644
--- a/Emby.Naming/AudioBook/AudioBookFileInfo.cs
+++ b/Emby.Naming/AudioBook/AudioBookFileInfo.cs
@@ -14,14 +14,12 @@ namespace Emby.Naming.AudioBook
/// <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>
- /// <param name="isDirectory">Indication if we are looking at file or directory.</param>
- public AudioBookFileInfo(string path, string container, int? partNumber = default, int? chapterNumber = default, bool isDirectory = default)
+ public AudioBookFileInfo(string path, string container, int? partNumber = default, int? chapterNumber = default)
{
Path = path;
Container = container;
PartNumber = partNumber;
ChapterNumber = chapterNumber;
- IsDirectory = isDirectory;
}
/// <summary>
@@ -48,12 +46,6 @@ namespace Emby.Naming.AudioBook
/// <value>The chapter number.</value>
public int? ChapterNumber { get; set; }
- /// <summary>
- /// Gets or sets a value indicating whether this instance is a directory.
- /// </summary>
- /// <value>The type.</value>
- public bool IsDirectory { get; set; }
-
/// <inheritdoc />
public int CompareTo(AudioBookFileInfo? other)
{
diff --git a/Emby.Naming/AudioBook/AudioBookListResolver.cs b/Emby.Naming/AudioBook/AudioBookListResolver.cs
index 179a3bc073..0d190c172e 100644
--- a/Emby.Naming/AudioBook/AudioBookListResolver.cs
+++ b/Emby.Naming/AudioBook/AudioBookListResolver.cs
@@ -22,21 +22,21 @@ namespace Emby.Naming.AudioBook
var audioBookResolver = new AudioBookResolver(_options);
var audiobookFileInfos = files
- .Select(i => audioBookResolver.Resolve(i.FullName, i.IsDirectory))
+ .Select(i => audioBookResolver.Resolve(i.FullName))
.OfType<AudioBookFileInfo>()
.ToList();
// 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 = false });
var stackResult = new StackResolver(_options)
- .ResolveAudioBooks(metadata);
+ .ResolveAudioBooks(audiobookFileInfos);
foreach (var stack in stackResult)
{
- var stackFiles = stack.Files.Select(i => audioBookResolver.Resolve(i, stack.IsDirectoryStack)).OfType<AudioBookFileInfo>().ToList();
+ var stackFiles = stack.Files.Select(i => audioBookResolver.Resolve(i)).OfType<AudioBookFileInfo>().ToList();
stackFiles.Sort();
// TODO nullable discover if name can be empty
var info = new AudioBookInfo(stack.Name ?? string.Empty) { Files = stackFiles };
diff --git a/Emby.Naming/AudioBook/AudioBookResolver.cs b/Emby.Naming/AudioBook/AudioBookResolver.cs
index 56442fc4ee..c9e8c76cbc 100644
--- a/Emby.Naming/AudioBook/AudioBookResolver.cs
+++ b/Emby.Naming/AudioBook/AudioBookResolver.cs
@@ -17,19 +17,13 @@ namespace Emby.Naming.AudioBook
_options = options;
}
- public AudioBookFileInfo? Resolve(string path, bool isDirectory = false)
+ public AudioBookFileInfo? Resolve(string path)
{
if (path.Length == 0)
{
throw new ArgumentException("String can't be empty.", nameof(path));
}
- // TODO
- if (isDirectory)
- {
- return null;
- }
-
var extension = Path.GetExtension(path);
// Check supported extensions
@@ -46,8 +40,7 @@ namespace Emby.Naming.AudioBook
path,
container,
chapterNumber: parsingResult.ChapterNumber,
- partNumber: parsingResult.PartNumber,
- isDirectory: isDirectory);
+ partNumber: parsingResult.PartNumber);
}
}
}