From ac4023ed47f35a6b90d0689ab205810c5e4acfcf Mon Sep 17 00:00:00 2001 From: softworkz Date: Tue, 23 Aug 2016 03:26:34 +0200 Subject: [PATCH] Core server preparation for new "TV Maze Provider Plugin" --- MediaBrowser.Controller/Providers/BaseItemXmlParser.cs | 9 +++++++++ MediaBrowser.LocalMetadata/Savers/XmlSaverHelpers.cs | 7 +++++++ MediaBrowser.Model/Entities/MetadataProviders.cs | 3 ++- MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs | 9 +++++++++ MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs | 6 ++++++ 5 files changed, 33 insertions(+), 1 deletion(-) diff --git a/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs b/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs index a783910e3..c0912708c 100644 --- a/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs +++ b/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs @@ -724,6 +724,15 @@ namespace MediaBrowser.Controller.Providers } break; } + case "TvMazeId": + { + var id = reader.ReadElementContentAsString(); + if (!string.IsNullOrWhiteSpace(id)) + { + item.SetProviderId(MetadataProviders.TvMaze, id); + } + break; + } case "AudioDbArtistId": { var id = reader.ReadElementContentAsString(); diff --git a/MediaBrowser.LocalMetadata/Savers/XmlSaverHelpers.cs b/MediaBrowser.LocalMetadata/Savers/XmlSaverHelpers.cs index 2b3f53aeb..d472d4812 100644 --- a/MediaBrowser.LocalMetadata/Savers/XmlSaverHelpers.cs +++ b/MediaBrowser.LocalMetadata/Savers/XmlSaverHelpers.cs @@ -553,6 +553,13 @@ namespace MediaBrowser.LocalMetadata.Savers builder.Append("" + SecurityElement.Escape(externalId) + ""); } + externalId = item.GetProviderId(MetadataProviders.TvMaze); + + if (!string.IsNullOrEmpty(externalId)) + { + builder.Append("" + SecurityElement.Escape(externalId) + ""); + } + var hasTagline = item as IHasTaglines; if (hasTagline != null) { diff --git a/MediaBrowser.Model/Entities/MetadataProviders.cs b/MediaBrowser.Model/Entities/MetadataProviders.cs index f5ab0c1d4..1e7bde934 100644 --- a/MediaBrowser.Model/Entities/MetadataProviders.cs +++ b/MediaBrowser.Model/Entities/MetadataProviders.cs @@ -39,6 +39,7 @@ namespace MediaBrowser.Model.Entities TvRage = 15, AudioDbArtist = 16, AudioDbAlbum = 17, - MusicBrainzTrack = 18 + MusicBrainzTrack = 18, + TvMaze = 19 } } diff --git a/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs b/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs index 0c8501e62..f777ae16b 100644 --- a/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs +++ b/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs @@ -827,6 +827,15 @@ namespace MediaBrowser.XbmcMetadata.Parsers } break; } + case "tvmazeid": + { + var id = reader.ReadElementContentAsString(); + if (!string.IsNullOrWhiteSpace(id)) + { + item.SetProviderId(MetadataProviders.TvMaze, id); + } + break; + } case "audiodbartistid": { var id = reader.ReadElementContentAsString(); diff --git a/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs b/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs index 954fb2a47..c28a15a93 100644 --- a/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs +++ b/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs @@ -822,6 +822,12 @@ namespace MediaBrowser.XbmcMetadata.Savers writer.WriteElementString("tvrageid", externalId); } + externalId = item.GetProviderId(MetadataProviders.TvMaze); + if (!string.IsNullOrEmpty(externalId)) + { + writer.WriteElementString("tvmazeid", externalId); + } + if (options.SaveImagePathsInNfo) { AddImages(item, writer, libraryManager, config);