Send better data to Kavita+ related to AltNames and Year.
Fixed a localization issue which prevented issue count showing on Series Match Result.
This commit is contained in:
parent
66f78aa859
commit
519cf60fc8
4 changed files with 32 additions and 7 deletions
|
|
@ -200,6 +200,9 @@ public class ExternalMetadataService : IExternalMetadataService
|
|||
/// <summary>
|
||||
/// Returns the match results for a Series from UI Flow
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Will extract alternative names like Localized name, year will send as ReleaseYear but fallback to Comic Vine syntax if applicable
|
||||
/// </remarks>
|
||||
/// <param name="dto"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<IList<ExternalSeriesMatchDto>> MatchSeries(MatchSeriesDto dto)
|
||||
|
|
@ -212,19 +215,22 @@ public class ExternalMetadataService : IExternalMetadataService
|
|||
var potentialAnilistId = ScrobblingService.ExtractId<int?>(dto.Query, ScrobblingService.AniListWeblinkWebsite);
|
||||
var potentialMalId = ScrobblingService.ExtractId<long?>(dto.Query, ScrobblingService.MalWeblinkWebsite);
|
||||
|
||||
List<string> altNames = [series.LocalizedName, series.OriginalName];
|
||||
if (potentialAnilistId == null && potentialMalId == null && !string.IsNullOrEmpty(dto.Query))
|
||||
var format = series.Library.Type.ConvertToPlusMediaFormat(series.Format);
|
||||
var otherNames = ExtractAlternativeNames(dto, series);
|
||||
|
||||
var year = series.Metadata.ReleaseYear;
|
||||
if (year == 0 && format == PlusMediaFormat.Comic)
|
||||
{
|
||||
altNames.Add(dto.Query);
|
||||
year = int.Parse(Parser.ParseYear(series.Name));
|
||||
}
|
||||
|
||||
var matchRequest = new MatchSeriesRequestDto()
|
||||
{
|
||||
Format = series.Library.Type.ConvertToPlusMediaFormat(series.Format),
|
||||
Format = format,
|
||||
Query = dto.Query,
|
||||
SeriesName = series.Name,
|
||||
AlternativeNames = altNames.Where(s => !string.IsNullOrEmpty(s)).ToList(),
|
||||
Year = series.Metadata.ReleaseYear,
|
||||
AlternativeNames = otherNames,
|
||||
Year = year,
|
||||
AniListId = potentialAnilistId ?? ScrobblingService.GetAniListId(series),
|
||||
MalId = potentialMalId ?? ScrobblingService.GetMalId(series)
|
||||
};
|
||||
|
|
@ -254,6 +260,18 @@ public class ExternalMetadataService : IExternalMetadataService
|
|||
return ArraySegment<ExternalSeriesMatchDto>.Empty;
|
||||
}
|
||||
|
||||
private static List<string> ExtractAlternativeNames(MatchSeriesDto dto, Series series)
|
||||
{
|
||||
List<string> altNames = [series.LocalizedName, series.OriginalName];
|
||||
// if (potentialAnilistId == null && potentialMalId == null && !string.IsNullOrEmpty(dto.Query))
|
||||
// {
|
||||
// altNames.Add(dto.Query);
|
||||
// }
|
||||
|
||||
var otherNames = altNames.Where(s => !string.IsNullOrEmpty(s)).Distinct().ToList();
|
||||
return otherNames;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves Metadata about a Recommended External Series
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue