Start of the metadata/filename on/off stuff.
This commit is contained in:
parent
bc41b0256e
commit
3fe5933358
8 changed files with 46 additions and 4 deletions
|
@ -938,4 +938,9 @@ public class ScannerServiceTests : AbstractDbTest
|
|||
Assert.True(sortedChapters[1].SortOrder.Is(4f));
|
||||
Assert.True(sortedChapters[2].SortOrder.Is(5f));
|
||||
}
|
||||
|
||||
#region Scanner Overhaul
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
|
|
@ -623,6 +623,9 @@ public class LibraryController : BaseApiController
|
|||
library.ManageReadingLists = dto.ManageReadingLists;
|
||||
library.AllowScrobbling = dto.AllowScrobbling;
|
||||
library.AllowMetadataMatching = dto.AllowMetadataMatching;
|
||||
library.AllowFilenameParsing = dto.AllowFilenameParsing;
|
||||
library.AllowMetadataParsing = dto.AllowMetadataParsing;
|
||||
|
||||
library.LibraryFileTypes = dto.FileGroupTypes
|
||||
.Select(t => new LibraryFileTypeGroup() {FileTypeGroup = t, LibraryId = library.Id})
|
||||
.Distinct()
|
||||
|
|
|
@ -67,4 +67,14 @@ public class LibraryDto
|
|||
/// <remarks>This does not exclude the library from being linked to wrt Series Relationships</remarks>
|
||||
/// <remarks>Requires a valid LicenseKey</remarks>
|
||||
public bool AllowMetadataMatching { get; set; } = true;
|
||||
/// <summary>
|
||||
/// Allow Kavita to parse Metadata from Files based on Filename
|
||||
/// </summary>
|
||||
/// <remarks>Cannot be false if <see cref="AllowMetadataMatching"/> is false</remarks>
|
||||
public bool AllowFilenameParsing { get; set; } = true;
|
||||
/// <summary>
|
||||
/// Allow Kavita to parse Metadata from files (ComicInfo/Epub/Pdf)
|
||||
/// </summary>
|
||||
/// <remarks>Cannot be false if <see cref="AllowFilenameParsing"/> is false</remarks>
|
||||
public bool AllowMetadataParsing { get; set; } = true;
|
||||
}
|
||||
|
|
|
@ -28,6 +28,10 @@ public class UpdateLibraryDto
|
|||
public bool AllowScrobbling { get; init; }
|
||||
[Required]
|
||||
public bool AllowMetadataMatching { get; init; }
|
||||
[Required]
|
||||
public bool AllowFilenameParsing { get; set; } = true;
|
||||
[Required]
|
||||
public bool AllowMetadataParsing { get; set; } = true;
|
||||
/// <summary>
|
||||
/// What types of files to allow the scanner to pickup
|
||||
/// </summary>
|
||||
|
|
|
@ -48,6 +48,16 @@ public class Library : IEntityDate, IHasCoverImage
|
|||
/// <remarks>This does not exclude the library from being linked to wrt Series Relationships</remarks>
|
||||
/// <remarks>Requires a valid LicenseKey</remarks>
|
||||
public bool AllowMetadataMatching { get; set; } = true;
|
||||
/// <summary>
|
||||
/// Allow Kavita to parse Metadata from Files based on Filename
|
||||
/// </summary>
|
||||
/// <remarks>Cannot be false if <see cref="AllowMetadataMatching"/> is false</remarks>
|
||||
public bool AllowFilenameParsing { get; set; } = true;
|
||||
/// <summary>
|
||||
/// Allow Kavita to parse Metadata from files (ComicInfo/Epub/Pdf)
|
||||
/// </summary>
|
||||
/// <remarks>Cannot be false if <see cref="AllowFilenameParsing"/> is false</remarks>
|
||||
public bool AllowMetadataParsing { get; set; } = true;
|
||||
|
||||
|
||||
public DateTime Created { get; set; }
|
||||
|
|
|
@ -115,4 +115,16 @@ public class LibraryBuilder : IEntityBuilder<Library>
|
|||
_library.AllowScrobbling = allowScrobbling;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LibraryBuilder WithAllowFilenameParsing(bool allow)
|
||||
{
|
||||
_library.AllowFilenameParsing = allow;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LibraryBuilder WithAllowMetadataParsing(bool allow)
|
||||
{
|
||||
_library.AllowMetadataParsing = allow;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ public class BasicParser(IDirectoryService directoryService, IDefaultParser imag
|
|||
{
|
||||
var fileName = directoryService.FileSystem.Path.GetFileNameWithoutExtension(filePath);
|
||||
// TODO: Potential Bug: This will return null, but on Image libraries, if all images, we would want to include this.
|
||||
// NOTE: This may no longer be needed as we have file type group support now, thus an image wouldn't come for a Series
|
||||
if (type != LibraryType.Image && Parser.IsCoverImage(directoryService.FileSystem.Path.GetFileName(filePath))) return null;
|
||||
|
||||
if (Parser.IsImage(filePath))
|
||||
|
|
|
@ -193,10 +193,6 @@ public class ProcessSeries : IProcessSeries
|
|||
|
||||
if (seriesAdded)
|
||||
{
|
||||
// See if any recommendations can link up to the series and pre-fetch external metadata for the series
|
||||
// BackgroundJob.Enqueue(() =>
|
||||
// _externalMetadataService.FetchSeriesMetadata(series.Id, series.Library.Type));
|
||||
|
||||
await _eventHub.SendMessageAsync(MessageFactory.SeriesAdded,
|
||||
MessageFactory.SeriesAddedEvent(series.Id, series.Name, series.LibraryId), false);
|
||||
}
|
||||
|
@ -216,6 +212,7 @@ public class ProcessSeries : IProcessSeries
|
|||
|
||||
if (seriesAdded)
|
||||
{
|
||||
// Prefetch metadata if applicable
|
||||
await _externalMetadataService.FetchSeriesMetadata(series.Id, series.Library.Type);
|
||||
}
|
||||
await _metadataService.GenerateCoversForSeries(series.LibraryId, series.Id, false, false);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue