diff --git a/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs b/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs
index a675173a92..3e12c57576 100644
--- a/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs
+++ b/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs
@@ -63,14 +63,14 @@ namespace MediaBrowser.XbmcMetadata.Parsers
/// metadataFile is null or empty.
public void Fetch(MetadataResult item, string metadataFile, CancellationToken cancellationToken)
{
- if (item == null)
+ if (item.Item == null)
{
- throw new ArgumentNullException(nameof(item));
+ throw new ArgumentException("Item can't be null.", nameof(item));
}
if (string.IsNullOrEmpty(metadataFile))
{
- throw new ArgumentException("The metadata file was empty or null.", nameof(metadataFile));
+ throw new ArgumentException("The metadata filepath was empty.", nameof(metadataFile));
}
_validProviderIds = new Dictionary(StringComparer.OrdinalIgnoreCase);
@@ -270,17 +270,13 @@ namespace MediaBrowser.XbmcMetadata.Parsers
if (!string.IsNullOrWhiteSpace(val))
{
- if (DateTime.TryParseExact(val, BaseNfoSaver.DateAddedFormat, CultureInfo.InvariantCulture, DateTimeStyles.AssumeLocal, out var added))
- {
- item.DateCreated = added.ToUniversalTime();
- }
- else if (DateTime.TryParse(val, CultureInfo.InvariantCulture, DateTimeStyles.AssumeLocal, out added))
+ if (DateTime.TryParse(val, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal, out var added))
{
item.DateCreated = added.ToUniversalTime();
}
else
{
- Logger.LogWarning("Invalid Added value found: " + val);
+ Logger.LogWarning("Invalid Added value found: {Value}", val);
}
}
@@ -384,16 +380,8 @@ namespace MediaBrowser.XbmcMetadata.Parsers
}
case "tagline":
- {
- var val = reader.ReadElementContentAsString();
-
- if (!string.IsNullOrWhiteSpace(val))
- {
- item.Tagline = val;
- }
-
- break;
- }
+ item.Tagline = reader.ReadElementContentAsString();
+ break;
case "country":
{
@@ -710,6 +698,24 @@ namespace MediaBrowser.XbmcMetadata.Parsers
break;
}
+ case "uniqueid":
+ {
+ if (reader.IsEmptyElement)
+ {
+ reader.Read();
+ break;
+ }
+
+ var provider = reader.GetAttribute("type");
+ var id = reader.ReadElementContentAsString();
+ if (!string.IsNullOrWhiteSpace(provider) && !string.IsNullOrWhiteSpace(id))
+ {
+ item.SetProviderId(provider, id);
+ }
+
+ break;
+ }
+
default:
string readerName = reader.Name;
if (_validProviderIds.TryGetValue(readerName, out string? providerIdValue))
diff --git a/tests/Jellyfin.XbmcMetadata.Tests/Parsers/MovieNfoParserTests.cs b/tests/Jellyfin.XbmcMetadata.Tests/Parsers/MovieNfoParserTests.cs
index 7d6b70f939..7651653a1b 100644
--- a/tests/Jellyfin.XbmcMetadata.Tests/Parsers/MovieNfoParserTests.cs
+++ b/tests/Jellyfin.XbmcMetadata.Tests/Parsers/MovieNfoParserTests.cs
@@ -16,8 +16,9 @@ namespace Jellyfin.XbmcMetadata.Parsers.Tests
{
public class MovieNfoParserTests
{
- [Fact]
- public void Fetch_Valid_Succes()
+ private readonly MovieNfoParser _parser;
+
+ public MovieNfoParserTests()
{
var providerManager = new Mock();
providerManager.Setup(x => x.GetExternalIdInfos(It.IsAny()))
@@ -25,13 +26,18 @@ namespace Jellyfin.XbmcMetadata.Parsers.Tests
var config = new Mock();
config.Setup(x => x.GetConfiguration(It.IsAny()))
.Returns(new XbmcMetadataOptions());
- var parser = new MovieNfoParser(new NullLogger(), config.Object, providerManager.Object);
+ _parser = new MovieNfoParser(new NullLogger(), config.Object, providerManager.Object);
+ }
+ [Fact]
+ public void Fetch_Valid_Succes()
+ {
var result = new MetadataResult