Make author stuff optional

This commit is contained in:
Starbeamrainbowlabs 2019-08-05 01:05:49 +01:00
parent 54ab735562
commit 78fc03c7c6
Signed by: sbrl
GPG Key ID: 1BE5172E637709C2
1 changed files with 13 additions and 7 deletions

View File

@ -123,14 +123,20 @@ namespace PolyFeed
else // It requires one, apparently
nextItem.LastUpdated = DateTimeOffset.Now;
SyndicationPerson author = new SyndicationPerson(
nextNode.QuerySelectorAttributeOrText(source.Entries.AuthorName).Trim(),
""
);
if(source.Entries.AuthorUrl != null)
author.Uri = nextNode.QuerySelectorAttributeOrText(source.Entries.AuthorUrl);
nextItem.AddContributor(author);
if (source.Entries.AuthorName != null) {
SyndicationPerson author = new SyndicationPerson(
nextNode.QuerySelectorAttributeOrText(source.Entries.AuthorName).Trim(),
""
);
if (source.Entries.AuthorUrl != null)
author.Uri = nextNode.QuerySelectorAttributeOrText(source.Entries.AuthorUrl);
nextItem.AddContributor(author);
}
else
nextItem.AddContributor(new SyndicationPerson("Unknown", ""));
await feed.Write(nextItem);