Added common language enum. Fixed "romaji" spelling. More UI updates.

This commit is contained in:
2025-06-08 11:13:52 -04:00
parent 70513559cb
commit b5d22c3c7e
20 changed files with 224 additions and 55 deletions

View File

@@ -1,4 +1,5 @@
using MangaReader.Core.Metadata;
using MangaReader.Core.Common;
using MangaReader.Core.Metadata;
using MangaReader.Core.Sources.MangaDex.Api;
namespace MangaReader.Core.Sources.MangaDex.Metadata;
@@ -62,11 +63,11 @@ public class MangaDexMetadataProvider(IMangaDexClient mangaDexClient) : IMangaMe
if (attributes.AltTitles == null || attributes.AltTitles.Count == 0)
return [];
Dictionary<string, SourceMangaLanguage> languageIdMap = new()
Dictionary<string, Language> languageIdMap = new()
{
{ "en", SourceMangaLanguage.English },
{ "ja", SourceMangaLanguage.Japanese },
{ "ja-ro", SourceMangaLanguage.Romanji },
{ "en", Language.English },
{ "ja", Language.Japanese },
{ "ja-ro", Language.Romaji },
};
List<SourceMangaTitle> sourceMangaTitles = [];
@@ -75,7 +76,7 @@ public class MangaDexMetadataProvider(IMangaDexClient mangaDexClient) : IMangaMe
{
foreach (string alternateTitleKey in alternateTitle.Keys)
{
if (languageIdMap.TryGetValue(alternateTitleKey, out SourceMangaLanguage language) == false)
if (languageIdMap.TryGetValue(alternateTitleKey, out Language language) == false)
continue;
SourceMangaTitle sourceMangaTitle = new()

View File

@@ -45,7 +45,7 @@ public partial class MangaDexSearchProvider(IMangaDexClient mangaDexClient) : IM
if (thing.Count > 0)
{
Guid[] mangaGuids = thing.Select(x => x.Key).ToArray();
Guid[] mangaGuids = [.. thing.Select(x => x.Key)];
var reults = await GetCoverArtFileNamesAsync(mangaGuids, cancellationToken);
//var reults = await mangaDexClient.GetCoverArtAsync(mangaGuids, cancellationToken);
}

View File

@@ -1,4 +1,5 @@
using HtmlAgilityPack;
using MangaReader.Core.Common;
using MangaReader.Core.Metadata;
using System.Text;
using System.Web;
@@ -46,7 +47,7 @@ public class MangaNatoWebCrawler : MangaWebCrawler
SourceMangaTitle sourceMangaTitle = new()
{
Title = title,
Language = SourceMangaLanguage.Unknown
Language = Language.Unknown
};
sourceMangaTitles.Add(sourceMangaTitle);

View File

@@ -23,12 +23,15 @@ public partial class NatoMangaClient(IHttpService httpService) : INatoMangaClien
{
string url = GetSearchUrl(searchWord);
string response = await httpService.GetStringAsync(url, cancellationToken);
Dictionary<string,string> requestHeader = [];
requestHeader.Add("Referer", "https://www.natomanga.com/");
string response = await httpService.GetStringAsync(url, requestHeader, cancellationToken);
return JsonSerializer.Deserialize<NatoMangaSearchResult[]>(response, _jsonSerializerOptions) ?? [];
}
protected string GetSearchUrl(string searchWord)
protected static string GetSearchUrl(string searchWord)
{
string formattedSeachWord = GetFormattedSearchWord(searchWord);