Added more UI logic. Added a manga pipeline test.

This commit is contained in:
2025-06-04 02:21:30 -04:00
parent 7dbcdc6169
commit 70513559cb
21 changed files with 264 additions and 73 deletions

View File

@@ -67,6 +67,7 @@ public partial class MangaDexSearchProvider(IMangaDexClient mangaDexClient) : IM
{
Title = title,
Description = GetDescription(mangaAttributes),
Genres = GetGenres(mangaAttributes),
Url = $"https://mangadex.org/title/{mangaEntity.Id}/{slug}",
Thumbnail = GetThumbnail(mangaEntity, coverArtEntites)
};
@@ -95,9 +96,33 @@ public partial class MangaDexSearchProvider(IMangaDexClient mangaDexClient) : IM
if (attributes.Description.TryGetValue("en", out string? description))
return description;
if (attributes.Description.Count > 0)
return attributes.Description.ElementAt(0).Value;
return string.Empty;
}
private static string[] GetGenres(MangaAttributes attributes)
{
if (attributes.Tags == null || attributes.Tags.Count == 0)
return [];
List<string> tags = [];
foreach (TagEntity tagEntity in attributes.Tags)
{
if (tagEntity.Attributes == null)
continue;
if (tagEntity.Attributes.Name == null || tagEntity.Attributes.Name.Count == 0)
continue;
tags.Add(tagEntity.Attributes.Name.FirstOrDefault().Value);
}
return [.. tags];
}
public static string GenerateSlug(string title)
{
// title.ToLowerInvariant().Normalize(NormalizationForm.FormD);