diff --git a/frontend/src/Settings/Metadata/Metadata/EditMetadataModalContent.js b/frontend/src/Settings/Metadata/Metadata/EditMetadataModalContent.js index 96bbb4b83..b1d66e127 100644 --- a/frontend/src/Settings/Metadata/Metadata/EditMetadataModalContent.js +++ b/frontend/src/Settings/Metadata/Metadata/EditMetadataModalContent.js @@ -15,6 +15,7 @@ import ProviderFieldFormGroup from 'Components/Form/ProviderFieldFormGroup'; function EditMetadataModalContent(props) { const { + advancedSettings, isSaving, saveError, item, @@ -56,6 +57,7 @@ function EditMetadataModalContent(props) { return ( state.settings.advancedSettings, (state, { id }) => id, (state) => state.settings.metadata, - (id, metadata) => { + (advancedSettings, id, metadata) => { const { isSaving, saveError, @@ -22,6 +23,7 @@ function createMapStateToProps() { const settings = selectSettings(_.find(items, { id }), pendingChanges, saveError); return { + advancedSettings, id, isSaving, saveError, diff --git a/src/NzbDrone.Core/Extras/Metadata/Consumers/Xbmc/XbmcMetadata.cs b/src/NzbDrone.Core/Extras/Metadata/Consumers/Xbmc/XbmcMetadata.cs index 4d1ec02a6..19e3de9f1 100644 --- a/src/NzbDrone.Core/Extras/Metadata/Consumers/Xbmc/XbmcMetadata.cs +++ b/src/NzbDrone.Core/Extras/Metadata/Consumers/Xbmc/XbmcMetadata.cs @@ -137,87 +137,97 @@ namespace NzbDrone.Core.Extras.Metadata.Consumers.Xbmc public override MetadataFileResult SeriesMetadata(Series series) { - if (!Settings.SeriesMetadata) + var xmlResult = string.Empty; + + if (Settings.SeriesMetadata) { - return null; - } + _logger.Debug("Generating Series Metadata for: {0}", series.Title); + var sb = new StringBuilder(); + var xws = new XmlWriterSettings(); + xws.OmitXmlDeclaration = true; + xws.Indent = false; - _logger.Debug("Generating tvshow.nfo for: {0}", series.Title); - var sb = new StringBuilder(); - var xws = new XmlWriterSettings(); - xws.OmitXmlDeclaration = true; - xws.Indent = false; - - using (var xw = XmlWriter.Create(sb, xws)) - { - var tvShow = new XElement("tvshow"); - - tvShow.Add(new XElement("title", series.Title)); - - if (series.Ratings != null && series.Ratings.Votes > 0) + using (var xw = XmlWriter.Create(sb, xws)) { - tvShow.Add(new XElement("rating", series.Ratings.Value)); - } + var tvShow = new XElement("tvshow"); - tvShow.Add(new XElement("plot", series.Overview)); - tvShow.Add(new XElement("mpaa", series.Certification)); - tvShow.Add(new XElement("id", series.TvdbId)); + tvShow.Add(new XElement("title", series.Title)); - var uniqueId = new XElement("uniqueid", series.TvdbId); - uniqueId.SetAttributeValue("type", "tvdb"); - uniqueId.SetAttributeValue("default", true); - tvShow.Add(uniqueId); - - if (series.ImdbId.IsNotNullOrWhiteSpace()) - { - var imdbId = new XElement("uniqueid", series.ImdbId); - imdbId.SetAttributeValue("type", "imdb"); - tvShow.Add(imdbId); - } - - foreach (var genre in series.Genres) - { - tvShow.Add(new XElement("genre", genre)); - } - - if (series.Tags.Any()) - { - var tags = _tagService.GetTags(series.Tags); - - foreach (var tag in tags) + if (series.Ratings != null && series.Ratings.Votes > 0) { - tvShow.Add(new XElement("tag", tag.Label)); - } - } - - if (series.FirstAired.HasValue) - { - tvShow.Add(new XElement("premiered", series.FirstAired.Value.ToString("yyyy-MM-dd"))); - } - - tvShow.Add(new XElement("studio", series.Network)); - - foreach (var actor in series.Actors) - { - var xmlActor = new XElement("actor", - new XElement("name", actor.Name), - new XElement("role", actor.Character)); - - if (actor.Images.Any()) - { - xmlActor.Add(new XElement("thumb", actor.Images.First().Url)); + tvShow.Add(new XElement("rating", series.Ratings.Value)); } - tvShow.Add(xmlActor); + tvShow.Add(new XElement("plot", series.Overview)); + tvShow.Add(new XElement("mpaa", series.Certification)); + tvShow.Add(new XElement("id", series.TvdbId)); + + var uniqueId = new XElement("uniqueid", series.TvdbId); + uniqueId.SetAttributeValue("type", "tvdb"); + uniqueId.SetAttributeValue("default", true); + tvShow.Add(uniqueId); + + if (series.ImdbId.IsNotNullOrWhiteSpace()) + { + var imdbId = new XElement("uniqueid", series.ImdbId); + imdbId.SetAttributeValue("type", "imdb"); + tvShow.Add(imdbId); + } + + foreach (var genre in series.Genres) + { + tvShow.Add(new XElement("genre", genre)); + } + + if (series.Tags.Any()) + { + var tags = _tagService.GetTags(series.Tags); + + foreach (var tag in tags) + { + tvShow.Add(new XElement("tag", tag.Label)); + } + } + + if (series.FirstAired.HasValue) + { + tvShow.Add(new XElement("premiered", series.FirstAired.Value.ToString("yyyy-MM-dd"))); + } + + tvShow.Add(new XElement("studio", series.Network)); + + foreach (var actor in series.Actors) + { + var xmlActor = new XElement("actor", + new XElement("name", actor.Name), + new XElement("role", actor.Character)); + + if (actor.Images.Any()) + { + xmlActor.Add(new XElement("thumb", actor.Images.First().Url)); + } + + tvShow.Add(xmlActor); + } + + var doc = new XDocument(tvShow); + doc.Save(xw); + + xmlResult += doc.ToString(); + } + } + + if (Settings.SeriesMetadataUrl) + { + if (Settings.SeriesMetadata) + { + xmlResult += Environment.NewLine; } - var doc = new XDocument(tvShow); - doc.Save(xw); - - _logger.Debug("Saving tvshow.nfo for {0}", series.Title); - - return new MetadataFileResult("tvshow.nfo", doc.ToString()); + xmlResult += "https://www.thetvdb.com/?tab=series&id=" + series.TvdbId; } + + return xmlResult == string.Empty ? null : new MetadataFileResult("tvshow.nfo", xmlResult); } public override MetadataFileResult EpisodeMetadata(Series series, EpisodeFile episodeFile) diff --git a/src/NzbDrone.Core/Extras/Metadata/Consumers/Xbmc/XbmcMetadataSettings.cs b/src/NzbDrone.Core/Extras/Metadata/Consumers/Xbmc/XbmcMetadataSettings.cs index 29de3512d..b51deae48 100644 --- a/src/NzbDrone.Core/Extras/Metadata/Consumers/Xbmc/XbmcMetadataSettings.cs +++ b/src/NzbDrone.Core/Extras/Metadata/Consumers/Xbmc/XbmcMetadataSettings.cs @@ -19,25 +19,29 @@ namespace NzbDrone.Core.Extras.Metadata.Consumers.Xbmc public XbmcMetadataSettings() { SeriesMetadata = true; + SeriesMetadataUrl = false; EpisodeMetadata = true; SeriesImages = true; SeasonImages = true; EpisodeImages = true; } - [FieldDefinition(0, Label = "Series Metadata", Type = FieldType.Checkbox, Section = MetadataSectionType.Metadata, HelpText = "tvshow.nfo")] + [FieldDefinition(0, Label = "Series Metadata", Type = FieldType.Checkbox, Section = MetadataSectionType.Metadata, HelpText = "tvshow.nfo with full series metadata")] public bool SeriesMetadata { get; set; } - [FieldDefinition(1, Label = "Episode Metadata", Type = FieldType.Checkbox, Section = MetadataSectionType.Metadata, HelpText = ".nfo")] + [FieldDefinition(1, Label = "Series Metadata URL", Type = FieldType.Checkbox, Section = MetadataSectionType.Metadata, HelpText = "tvshow.nfo with TheTVDB show URL (can be combined with 'Series Metadata')", Advanced = true)] + public bool SeriesMetadataUrl { get; set; } + + [FieldDefinition(2, Label = "Episode Metadata", Type = FieldType.Checkbox, Section = MetadataSectionType.Metadata, HelpText = ".nfo")] public bool EpisodeMetadata { get; set; } - [FieldDefinition(2, Label = "Series Images", Type = FieldType.Checkbox, Section = MetadataSectionType.Image, HelpText = "fanart.jpg, poster.jpg, banner.jpg")] + [FieldDefinition(3, Label = "Series Images", Type = FieldType.Checkbox, Section = MetadataSectionType.Image, HelpText = "fanart.jpg, poster.jpg, banner.jpg")] public bool SeriesImages { get; set; } - [FieldDefinition(3, Label = "Season Images", Type = FieldType.Checkbox, Section = MetadataSectionType.Image, HelpText = "season##-poster.jpg, season##-banner.jpg, season-specials-poster.jpg, season-specials-banner.jpg")] + [FieldDefinition(4, Label = "Season Images", Type = FieldType.Checkbox, Section = MetadataSectionType.Image, HelpText = "season##-poster.jpg, season##-banner.jpg, season-specials-poster.jpg, season-specials-banner.jpg")] public bool SeasonImages { get; set; } - [FieldDefinition(4, Label = "Episode Images", Type = FieldType.Checkbox, Section = MetadataSectionType.Image, HelpText = "-thumb.jpg")] + [FieldDefinition(5, Label = "Episode Images", Type = FieldType.Checkbox, Section = MetadataSectionType.Image, HelpText = "-thumb.jpg")] public bool EpisodeImages { get; set; } public bool IsValid => true;