Ensure all people from upstream are Trimmed in case of bad data.

This commit is contained in:
Joseph Milazzo 2025-05-10 14:13:08 -05:00
parent 09dbdaa41d
commit ff12abfa99
2 changed files with 6 additions and 7 deletions

View file

@ -638,8 +638,8 @@ public class ExternalMetadataService : IExternalMetadataService
var nameMappings = staff.Select(s => new var nameMappings = staff.Select(s => new
{ {
Staff = s, Staff = s,
PreferredName = settings.FirstLastPeopleNaming ? $"{s.FirstName} {s.LastName}" : $"{s.LastName} {s.FirstName}", PreferredName = settings.FirstLastPeopleNaming ? $"{s.FirstName} {s.LastName}".Trim() : $"{s.LastName} {s.FirstName}".Trim(),
AlternativeName = !settings.FirstLastPeopleNaming ? $"{s.FirstName} {s.LastName}" : $"{s.LastName} {s.FirstName}" AlternativeName = !settings.FirstLastPeopleNaming ? $"{s.FirstName} {s.LastName}".Trim() : $"{s.LastName} {s.FirstName}.Trim()"
}).ToList(); }).ToList();
var preferredNames = nameMappings.Select(n => n.PreferredName.ToNormalized()).Distinct().ToList(); var preferredNames = nameMappings.Select(n => n.PreferredName.ToNormalized()).Distinct().ToList();
@ -792,7 +792,7 @@ public class ExternalMetadataService : IExternalMetadataService
var characters = externalCharacters var characters = externalCharacters
.Select(w => new PersonDto() .Select(w => new PersonDto()
{ {
Name = w.Name, Name = w.Name.Trim(),
AniListId = ScrobblingService.ExtractId<int>(w.Url, ScrobblingService.AniListCharacterWebsite), AniListId = ScrobblingService.ExtractId<int>(w.Url, ScrobblingService.AniListCharacterWebsite),
Description = StringHelper.CorrectUrls(StringHelper.RemoveSourceInDescription(StringHelper.SquashBreaklines(w.Description))), Description = StringHelper.CorrectUrls(StringHelper.RemoveSourceInDescription(StringHelper.SquashBreaklines(w.Description))),
}) })
@ -873,7 +873,7 @@ public class ExternalMetadataService : IExternalMetadataService
var artists = upstreamArtists var artists = upstreamArtists
.Select(w => new PersonDto() .Select(w => new PersonDto()
{ {
Name = w.Name, Name = w.Name.Trim(),
AniListId = ScrobblingService.ExtractId<int>(w.Url, ScrobblingService.AniListStaffWebsite), AniListId = ScrobblingService.ExtractId<int>(w.Url, ScrobblingService.AniListStaffWebsite),
Description = StringHelper.CorrectUrls(StringHelper.RemoveSourceInDescription(StringHelper.SquashBreaklines(w.Description))), Description = StringHelper.CorrectUrls(StringHelper.RemoveSourceInDescription(StringHelper.SquashBreaklines(w.Description))),
}) })
@ -929,7 +929,7 @@ public class ExternalMetadataService : IExternalMetadataService
var writers = upstreamWriters var writers = upstreamWriters
.Select(w => new PersonDto() .Select(w => new PersonDto()
{ {
Name = w.Name, Name = w.Name.Trim(),
AniListId = ScrobblingService.ExtractId<int>(w.Url, ScrobblingService.AniListStaffWebsite), AniListId = ScrobblingService.ExtractId<int>(w.Url, ScrobblingService.AniListStaffWebsite),
Description = StringHelper.CorrectUrls(StringHelper.RemoveSourceInDescription(StringHelper.SquashBreaklines(w.Description))), Description = StringHelper.CorrectUrls(StringHelper.RemoveSourceInDescription(StringHelper.SquashBreaklines(w.Description))),
}) })
@ -1353,7 +1353,7 @@ public class ExternalMetadataService : IExternalMetadataService
var people = staff! var people = staff!
.Select(w => new PersonDto() .Select(w => new PersonDto()
{ {
Name = w, Name = w.Trim(),
}) })
.Concat(chapter.People .Concat(chapter.People
.Where(p => p.Role == role) .Where(p => p.Role == role)

View file

@ -31,7 +31,6 @@
</ng-template> </ng-template>
<ng-template #noData> <ng-template #noData>
<!-- TODO: Come back and figure this out -->
{{t('common.no-data')}} {{t('common.no-data')}}
</ng-template> </ng-template>
</app-card-detail-layout> </app-card-detail-layout>