Read date and language information from opf

This commit is contained in:
Patrick Farwick 2022-01-16 23:42:43 +00:00 committed by MinecraftPlaye
parent 8233ac6c3e
commit 91781be201

View File

@ -109,6 +109,8 @@ namespace Jellyfin.Plugin.Bookshelf.Providers
bookResult.AddPerson(person);
});
ReadStringInto("//dc:language", language => bookResult.ResultLanguage = language);
return bookResult;
}
@ -122,6 +124,20 @@ namespace Jellyfin.Plugin.Bookshelf.Providers
ReadStringInto("//dc:identifier[@opf:scheme='ISBN']", isbn => book.SetProviderId("ISBN", isbn));
ReadStringInto("//dc:identifier[@opf:scheme='AMAZON']", amazon => book.SetProviderId("Amazon", amazon));
ReadStringInto("//dc:date", date =>
{
try
{
var dateTime = DateTime.Parse(date, DateTimeFormatInfo.InvariantInfo);
book.PremiereDate = dateTime.Date;
book.ProductionYear = dateTime.Date.Year;
}
catch (Exception e)
{
_logger.LogError(e, "Error reading date");
}
});
var genresNodes = _document.SelectNodes("//dc:subject", _namespaceManager);
if (genresNodes != null && genresNodes.Count > 0)