Added English voice work updater.
This commit is contained in:
@@ -3,26 +3,51 @@ using JSMR.Application.Integrations.DLSite.Models;
|
||||
|
||||
namespace JSMR.Application.Scanning.Contracts;
|
||||
|
||||
public record VoiceWorkIngest(DLSiteWork Work, VoiceWorkDetails? Details)
|
||||
public sealed record VoiceWorkIngest
|
||||
{
|
||||
public string MakerId { get; init; } = Work.MakerId;
|
||||
public string MakerName { get; init; } = Work.Maker;
|
||||
public string ProductId { get; init; } = Work.ProductId;
|
||||
public string Title { get; init; } = Work.ProductName;
|
||||
public string? Description { get; init; } = Work.Description;
|
||||
public ICollection<string> Tags { get; init; } = Work.Tags;
|
||||
public ICollection<string> Creators { get; init; } = Work.Creators;
|
||||
public int WishlistCount { get; init; } = Details?.WishlistCount ?? 0;
|
||||
public int Downloads { get; init; } = Math.Max(Work.Downloads, Details?.DownloadCount ?? 0);
|
||||
public bool HasTrial { get; init; } = Work.HasTrial || (Details?.HasTrial ?? false);
|
||||
public bool HasDLPlay { get; init; } = Details?.HasDLPlay ?? false;
|
||||
public byte? StarRating { get; init; } = Work.StarRating;
|
||||
public int? Votes { get; init; } = Work.Votes;
|
||||
public AgeRating AgeRating { get; init; } = Details?.AgeRating ?? Work.AgeRating;
|
||||
public bool HasImage { get; init; } = Work.ImageUrl.Contains("no_img") == false;
|
||||
public ICollection<ISupportedLanguage> SupportedLanguages { get; init; } = Details?.SupportedLanguages ?? [];
|
||||
public DateOnly? ExpectedDate { get; init; } = Work.ExpectedDate;
|
||||
public DateOnly? SalesDate { get; init; } = Work.SalesDate;
|
||||
public DateTime? RegistrationDate { get; init; } = Details?.RegistrationDate;
|
||||
// TODO: Other properties
|
||||
public required string MakerId { get; init; }
|
||||
public required string MakerName { get; init; }
|
||||
public required string ProductId { get; init; }
|
||||
public required string Title { get; init; }
|
||||
public required string Description { get; init; }
|
||||
public ICollection<string> Tags { get; init; } = [];
|
||||
public ICollection<string> Creators { get; init; } = [];
|
||||
public int WishlistCount { get; init; }
|
||||
public int Downloads { get; init; }
|
||||
public bool HasTrial { get; init; }
|
||||
public bool HasDLPlay { get; init; }
|
||||
public byte? StarRating { get; init; }
|
||||
public int? Votes { get; init; }
|
||||
public AgeRating AgeRating { get; init; }
|
||||
public bool HasImage { get; init; }
|
||||
public ICollection<ISupportedLanguage> SupportedLanguages { get; init; } = [];
|
||||
public DateOnly? ExpectedDate { get; init; }
|
||||
public DateOnly? SalesDate { get; init; }
|
||||
public DateTime? RegistrationDate { get; init; }
|
||||
|
||||
public static VoiceWorkIngest From(DLSiteWork work, VoiceWorkDetails? details)
|
||||
{
|
||||
return new VoiceWorkIngest()
|
||||
{
|
||||
MakerId = work.MakerId,
|
||||
MakerName = work.Maker,
|
||||
ProductId = work.ProductId,
|
||||
Title = work.ProductName,
|
||||
Description = work.Description ?? string.Empty,
|
||||
Tags = work.Tags,
|
||||
Creators = work.Creators,
|
||||
WishlistCount = details?.WishlistCount ?? 0,
|
||||
Downloads = Math.Max(work.Downloads, details?.DownloadCount ?? 0),
|
||||
HasTrial = work.HasTrial || (details?.HasTrial ?? false),
|
||||
HasDLPlay = details?.HasDLPlay ?? false,
|
||||
StarRating = work.StarRating,
|
||||
Votes = work.Votes,
|
||||
AgeRating = details?.AgeRating ?? work.AgeRating,
|
||||
HasImage = !string.IsNullOrEmpty(work.ImageUrl) && !work.ImageUrl.Contains("no_img", StringComparison.OrdinalIgnoreCase),
|
||||
SupportedLanguages = details?.SupportedLanguages ?? [],
|
||||
ExpectedDate = work.ExpectedDate,
|
||||
SalesDate = work.SalesDate,
|
||||
RegistrationDate = details?.RegistrationDate
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user