Kavita/API/Entities/MangaFile.cs
Joseph Milazzo 0be0e294aa
Metadata Optimizations (#910)
* Added a tooltip to inform user that format and collection filter selections do not only show for the selected library.

* Refactored a lot of code around when we update chapter cover images. Applied an optimization for when we re-calculate volume/series covers, such that it only occurs when the first chapter's image updates.

* Updated code to ensure only lastmodified gets refreshed in metadata since it always follows a scan

* Optimized how metadata is populated on the series. Instead of re-reading the comicInfos, instead I read the data from the underlying chapter entities. This reduces N additional reads AND enables the ability in the future to show/edit chapter level metadata.

* Spelling mistake

* Fixed a concurency issue by not selecting Genres from DB. Added a test for long paths.

* Fixed a bug in filter where collection tag wasn't populating on load

* Cleaned up the logic for changelog to better compare against the installed verison. For nightly users, show the last stable as installed.

* Removed some demo code

* SplitQuery to allow loading tags much faster for series metadata load.
2022-01-08 06:41:47 -08:00

44 lines
1.2 KiB
C#

using System;
using System.IO;
using API.Entities.Enums;
namespace API.Entities
{
/// <summary>
/// Represents a wrapper to the underlying file. This provides information around file, like number of pages, format, etc.
/// </summary>
public class MangaFile
{
public int Id { get; set; }
/// <summary>
/// Absolute path to the archive file
/// </summary>
public string FilePath { get; set; }
/// <summary>
/// Number of pages for the given file
/// </summary>
public int Pages { get; set; }
public MangaFormat Format { get; set; }
/// <summary>
/// Last time underlying file was modified
/// </summary>
/// <remarks>This gets updated anytime the file is scanned</remarks>
public DateTime LastModified { get; set; }
// Relationship Mapping
public Chapter Chapter { get; set; }
public int ChapterId { get; set; }
/// <summary>
/// Updates the Last Modified time of the underlying file to the LastWriteTime
/// </summary>
public void UpdateLastModified()
{
LastModified = File.GetLastWriteTime(FilePath);
}
}
}