diff --git a/NfoMetadata/Parsers/BaseNfoParser.cs b/NfoMetadata/Parsers/BaseNfoParser.cs index cc41516..f2744bf 100644 --- a/NfoMetadata/Parsers/BaseNfoParser.cs +++ b/NfoMetadata/Parsers/BaseNfoParser.cs @@ -860,6 +860,21 @@ private static bool IsProviderIdValid(string value) return true; } + private static bool IsValidHttpUrl(string value) + { + if (string.IsNullOrWhiteSpace(value)) + { + return false; + } + + if (Uri.TryCreate(value, UriKind.Absolute, out var uriResult)) + { + return uriResult.Scheme == Uri.UriSchemeHttp || uriResult.Scheme == Uri.UriSchemeHttps; + } + + return false; + } + private void AddProductionLocations(BaseItem item, string[] locations) { foreach (var name in locations) @@ -1156,6 +1171,7 @@ private async Task GetPersonFromXmlNode(XmlReader reader) var name = string.Empty; var type = PersonType.Actor; // If type is not specified assume actor var role = string.Empty; + var thumb = string.Empty; int? sortOrder = null; var providerIds = new ProviderIdDictionary(); @@ -1193,6 +1209,16 @@ private async Task GetPersonFromXmlNode(XmlReader reader) } break; } + case "thumb": + { + var val = await reader.ReadElementContentAsStringAsync().ConfigureAwait(false); + + if (IsValidHttpUrl(val)) + { + thumb = val; + } + break; + } case "sortorder": { var val = await reader.ReadElementContentAsStringAsync().ConfigureAwait(false); @@ -1233,6 +1259,7 @@ private async Task GetPersonFromXmlNode(XmlReader reader) Name = name.Trim(), Role = role, Type = type, + ImageUrl = thumb, ProviderIds = providerIds }; }