Metadata Downloading (#3525)

This commit is contained in:
Joe Milazzo 2025-02-05 16:16:44 -06:00 committed by GitHub
parent eb66763078
commit f4fd7230ea
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
108 changed files with 6296 additions and 484 deletions

View file

@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using API.DTOs.KavitaPlus.Metadata;
using API.DTOs.Scrobbling;
using API.Services.Plus;
namespace API.DTOs.Recommendation;
#nullable enable
/// <summary>
/// This is AniListSeries
/// </summary>
public class ExternalSeriesDetailDto
{
public string Name { get; set; }
public int? AniListId { get; set; }
public long? MALId { get; set; }
public IList<string> Synonyms { get; set; }
public PlusMediaFormat PlusMediaFormat { get; set; }
public string? SiteUrl { get; set; }
public string? CoverUrl { get; set; }
public IList<string> Genres { get; set; }
public IList<SeriesStaffDto> Staff { get; set; }
public IList<MetadataTagDto> Tags { get; set; }
public string? Summary { get; set; }
public ScrobbleProvider Provider { get; set; } = ScrobbleProvider.AniList;
public DateTime? StartDate { get; set; }
public DateTime? EndDate { get; set; }
public int AverageScore { get; set; }
public int Chapters { get; set; }
public int Volumes { get; set; }
public IList<SeriesRelationship>? Relations { get; set; }
public IList<SeriesCharacter>? Characters { get; set; }
}

View file

@ -0,0 +1,22 @@
using API.Entities.Enums;
namespace API.DTOs.KavitaPlus.Metadata;
public class MetadataFieldMappingDto
{
public int Id { get; set; }
public MetadataFieldType SourceType { get; set; }
public MetadataFieldType DestinationType { get; set; }
/// <summary>
/// The string in the source
/// </summary>
public string SourceValue { get; set; }
/// <summary>
/// Write the string as this in the Destination (can also just be the Source)
/// </summary>
public string DestinationValue { get; set; }
/// <summary>
/// If true, the tag will be Moved over vs Copied over
/// </summary>
public bool ExcludeFromSource { get; set; }
}

View file

@ -0,0 +1,70 @@
using System.Collections.Generic;
using API.Entities;
using API.Entities.Enums;
namespace API.DTOs.KavitaPlus.Metadata;
public class MetadataSettingsDto
{
/// <summary>
/// If writing any sort of metadata from upstream (AniList, Hardcover) source is allowed
/// </summary>
public bool Enabled { get; set; }
/// <summary>
/// Allow the Summary to be written
/// </summary>
public bool EnableSummary { get; set; }
/// <summary>
/// Allow Publication status to be derived and updated
/// </summary>
public bool EnablePublicationStatus { get; set; }
/// <summary>
/// Allow Relationships between series to be set
/// </summary>
public bool EnableRelationships { get; set; }
/// <summary>
/// Allow People to be created (including downloading images)
/// </summary>
public bool EnablePeople { get; set; }
/// <summary>
/// Allow Start date to be set within the Series
/// </summary>
public bool EnableStartDate { get; set; }
/// <summary>
/// Allow setting the Localized name
/// </summary>
public bool EnableLocalizedName { get; set; }
// Need to handle the Genre/tags stuff
public bool EnableGenres { get; set; } = true;
public bool EnableTags { get; set; } = true;
/// <summary>
/// For Authors and Writers, how should names be stored (Exclusively applied for AniList). This does not affect Character names.
/// </summary>
public bool FirstLastPeopleNaming { get; set; }
/// <summary>
/// Any Genres or Tags that if present, will trigger an Age Rating Override. Highest rating will be prioritized for matching.
/// </summary>
public Dictionary<string, AgeRating> AgeRatingMappings { get; set; }
/// <summary>
/// A list of rules that allow mapping a genre/tag to another genre/tag
/// </summary>
public List<MetadataFieldMappingDto> FieldMappings { get; set; }
/// <summary>
/// Do not allow any Genre/Tag in this list to be written to Kavita
/// </summary>
public List<string> Blacklist { get; set; }
/// <summary>
/// Only allow these Tags to be written to Kavita
/// </summary>
public List<string> Whitelist { get; set; }
/// <summary>
/// Which Roles to allow metadata downloading for
/// </summary>
public List<PersonRole> PersonRoles { get; set; }
}

View file

@ -0,0 +1,9 @@
namespace API.DTOs.KavitaPlus.Metadata;
public class SeriesCharacter
{
public string Name { get; set; }
public required string Description { get; set; }
public required string Url { get; set; }
public string? ImageUrl { get; set; }
}

View file

@ -0,0 +1,24 @@
using API.DTOs.Scrobbling;
using API.Entities.Enums;
using API.Entities.Metadata;
using API.Services.Plus;
namespace API.DTOs.KavitaPlus.Metadata;
public class ALMediaTitle
{
public string? EnglishTitle { get; set; }
public string RomajiTitle { get; set; }
public string NativeTitle { get; set; }
public string PreferredTitle { get; set; }
}
public class SeriesRelationship
{
public int AniListId { get; set; }
public int? MalId { get; set; }
public ALMediaTitle SeriesName { get; set; }
public RelationKind Relation { get; set; }
public ScrobbleProvider Provider { get; set; }
public PlusMediaFormat PlusMediaFormat { get; set; } = PlusMediaFormat.Manga;
}