mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
Fix NFO ID parsing (#13167)
This commit is contained in:
parent
b9881b8bdf
commit
f0e9b2fb96
@ -50,23 +50,20 @@ namespace MediaBrowser.XbmcMetadata.Parsers
|
|||||||
{
|
{
|
||||||
case "id":
|
case "id":
|
||||||
{
|
{
|
||||||
// get ids from attributes
|
// Get ids from attributes
|
||||||
|
item.TrySetProviderId(MetadataProvider.Tmdb, reader.GetAttribute("TMDB"));
|
||||||
|
item.TrySetProviderId(MetadataProvider.Tvdb, reader.GetAttribute("TVDB"));
|
||||||
string? imdbId = reader.GetAttribute("IMDB");
|
string? imdbId = reader.GetAttribute("IMDB");
|
||||||
string? tmdbId = reader.GetAttribute("TMDB");
|
|
||||||
|
|
||||||
// read id from content
|
// Read id from content
|
||||||
|
// Content can be arbitrary according to Kodi wiki, so only parse if we are sure it matches a provider-specific schema
|
||||||
var contentId = reader.ReadElementContentAsString();
|
var contentId = reader.ReadElementContentAsString();
|
||||||
if (contentId.Contains("tt", StringComparison.Ordinal) && string.IsNullOrEmpty(imdbId))
|
if (string.IsNullOrEmpty(imdbId) && contentId.StartsWith("tt", StringComparison.Ordinal))
|
||||||
{
|
{
|
||||||
imdbId = contentId;
|
imdbId = contentId;
|
||||||
}
|
}
|
||||||
else if (string.IsNullOrEmpty(tmdbId))
|
|
||||||
{
|
|
||||||
tmdbId = contentId;
|
|
||||||
}
|
|
||||||
|
|
||||||
item.TrySetProviderId(MetadataProvider.Imdb, imdbId);
|
item.TrySetProviderId(MetadataProvider.Imdb, imdbId);
|
||||||
item.TrySetProviderId(MetadataProvider.Tmdb, tmdbId);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
using System;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
using Emby.Naming.TV;
|
using Emby.Naming.TV;
|
||||||
@ -48,16 +49,20 @@ namespace MediaBrowser.XbmcMetadata.Parsers
|
|||||||
{
|
{
|
||||||
case "id":
|
case "id":
|
||||||
{
|
{
|
||||||
item.TrySetProviderId(MetadataProvider.Imdb, reader.GetAttribute("IMDB"));
|
// Get ids from attributes
|
||||||
item.TrySetProviderId(MetadataProvider.Tmdb, reader.GetAttribute("TMDB"));
|
item.TrySetProviderId(MetadataProvider.Tmdb, reader.GetAttribute("TMDB"));
|
||||||
|
item.TrySetProviderId(MetadataProvider.Tvdb, reader.GetAttribute("TVDB"));
|
||||||
|
string? imdbId = reader.GetAttribute("IMDB");
|
||||||
|
|
||||||
string? tvdbId = reader.GetAttribute("TVDB");
|
// Read id from content
|
||||||
if (string.IsNullOrWhiteSpace(tvdbId))
|
// Content can be arbitrary according to Kodi wiki, so only parse if we are sure it matches a provider-specific schema
|
||||||
|
var contentId = reader.ReadElementContentAsString();
|
||||||
|
if (string.IsNullOrEmpty(imdbId) && contentId.StartsWith("tt", StringComparison.Ordinal))
|
||||||
{
|
{
|
||||||
tvdbId = reader.ReadElementContentAsString();
|
imdbId = contentId;
|
||||||
}
|
}
|
||||||
|
|
||||||
item.TrySetProviderId(MetadataProvider.Tvdb, tvdbId);
|
item.TrySetProviderId(MetadataProvider.Imdb, imdbId);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user