mirror of
https://github.com/claunia/marechai.git
synced 2026-07-08 17:57:08 +00:00
Adds a platform logo enrichment stage to the IGDB pipeline (Marechai.Igdb), mirroring the existing company enrichment flow but for SoftwarePlatform's raster logo (LogoId/LogoExtension), which previously had to be uploaded manually. - IgdbPlatform gains LogoImageId, EnrichmentApplied, and EnrichedOn columns (migration AddIgdbPlatformLogoEnrichment), mirroring IgdbCompany's enrichment-tracking pattern. - PlatformMirrorService now requests platform_logo.image_id from IGDB and stores it on insert and on re-mirror. - New PlatformEnricherService: for platforms matched to an IGDB platform with no local logo yet, downloads the best available logo image and reproduces the exact originals/jpeg/webp/avif + 4k/thumbs layout and ImageMagick conversion parameters used by the manual logo upload endpoint (SoftwarePlatformsController.UploadLogoAsync), so enriched and manually-uploaded logos are indistinguishable on disk. - New IgdbImageDownloader helper, shared between company and platform enrichment: IGDB's documented image sizes top out at logo_med for logo-type images, with no documented "original" size, and any size accepts an undocumented-but-functional "_2x" retina suffix. Rather than trusting any single size identifier, it downloads each plausible candidate (logo_med_2x, logo_med, original), decodes the actual pixel dimensions of each with `magick identify`, and keeps whichever is truly largest. CompanyEnricherService.CacheLogoAsync is updated to use this helper too, replacing its previous unconditional reliance on the undocumented t_original template. - Program.cs: new `enrich-platforms` command (wired through a new AssetRootPath config key, since output goes straight into the real asset tree rather than a review cache), usage text, and a `platforms-enrichment` reset case to clear EnrichmentApplied/EnrichedOn for re-runs. Marechai.Igdb intentionally does not take a project reference on Marechai.Server (which owns the Photos helper and ASP.NET Core dependencies) to perform these image conversions; the ImageMagick subprocess invocation is duplicated in PlatformEnricherService to keep the console tool's dependency footprint small.
30 lines
638 B
C#
30 lines
638 B
C#
using System;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using Marechai.Data;
|
|
|
|
namespace Marechai.Database.Models;
|
|
|
|
public class IgdbPlatform : BaseModel<int>
|
|
{
|
|
[Required]
|
|
[StringLength(255)]
|
|
public string Name { get; set; }
|
|
|
|
[Required]
|
|
public IgdbMatchStatus MatchStatus { get; set; }
|
|
|
|
[StringLength(64)]
|
|
public string MatchType { get; set; }
|
|
|
|
public DateTime? MatchedOn { get; set; }
|
|
|
|
public ulong? SoftwarePlatformId { get; set; }
|
|
|
|
[StringLength(64)]
|
|
public string LogoImageId { get; set; }
|
|
|
|
public bool EnrichmentApplied { get; set; }
|
|
|
|
public DateTime? EnrichedOn { get; set; }
|
|
}
|