mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-01-15 15:48:03 +00:00
Backport pull request #13167 from jellyfin/release-10.10.z
Fix NFO ID parsing
Original-merge: f0e9b2fb96
Merged-by: crobibero <cody@robibe.ro>
Backported-by: Bond_009 <bond.009@outlook.com>
This commit is contained in:
@@ -50,23 +50,20 @@ namespace MediaBrowser.XbmcMetadata.Parsers
|
||||
{
|
||||
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? 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();
|
||||
if (contentId.Contains("tt", StringComparison.Ordinal) && string.IsNullOrEmpty(imdbId))
|
||||
if (string.IsNullOrEmpty(imdbId) && contentId.StartsWith("tt", StringComparison.Ordinal))
|
||||
{
|
||||
imdbId = contentId;
|
||||
}
|
||||
else if (string.IsNullOrEmpty(tmdbId))
|
||||
{
|
||||
tmdbId = contentId;
|
||||
}
|
||||
|
||||
item.TrySetProviderId(MetadataProvider.Imdb, imdbId);
|
||||
item.TrySetProviderId(MetadataProvider.Tmdb, tmdbId);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Xml;
|
||||
using Emby.Naming.TV;
|
||||
@@ -48,16 +49,20 @@ namespace MediaBrowser.XbmcMetadata.Parsers
|
||||
{
|
||||
case "id":
|
||||
{
|
||||
item.TrySetProviderId(MetadataProvider.Imdb, reader.GetAttribute("IMDB"));
|
||||
// Get ids from attributes
|
||||
item.TrySetProviderId(MetadataProvider.Tmdb, reader.GetAttribute("TMDB"));
|
||||
item.TrySetProviderId(MetadataProvider.Tvdb, reader.GetAttribute("TVDB"));
|
||||
string? imdbId = reader.GetAttribute("IMDB");
|
||||
|
||||
string? tvdbId = reader.GetAttribute("TVDB");
|
||||
if (string.IsNullOrWhiteSpace(tvdbId))
|
||||
// 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();
|
||||
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user