From 0803a916aa0cffcbec3731036a74a8a81655b9d1 Mon Sep 17 00:00:00 2001 From: Bond_009 Date: Sun, 18 Aug 2019 19:54:07 +0200 Subject: [PATCH] Fix some documentation warnings for MediaBrowser.XbmcMetadata --- .../Configuration/NfoOptions.cs | 1 + .../Parsers/BaseNfoParser.cs | 35 +-- .../Parsers/EpisodeNfoParser.cs | 22 +- .../Parsers/MovieNfoParser.cs | 76 +++--- .../Parsers/SeasonNfoParser.cs | 16 +- .../Parsers/SeriesNfoParser.cs | 18 +- .../Providers/AlbumNfoProvider.cs | 6 +- .../Providers/ArtistNfoProvider.cs | 6 +- .../Providers/BaseNfoProvider.cs | 21 +- .../Providers/BaseVideoNfoProvider.cs | 4 +- .../Providers/EpisodeNfoProvider.cs | 9 +- .../Providers/SeasonNfoProvider.cs | 2 + .../Providers/SeriesNfoProvider.cs | 2 + .../Savers/AlbumNfoSaver.cs | 17 +- .../Savers/ArtistNfoSaver.cs | 37 ++- .../Savers/BaseNfoSaver.cs | 247 ++++++++---------- .../Savers/EpisodeNfoSaver.cs | 67 +++-- .../Savers/MovieNfoSaver.cs | 50 ++-- .../Savers/SeasonNfoSaver.cs | 35 +-- .../Savers/SeriesNfoSaver.cs | 47 ++-- 20 files changed, 332 insertions(+), 386 deletions(-) diff --git a/MediaBrowser.XbmcMetadata/Configuration/NfoOptions.cs b/MediaBrowser.XbmcMetadata/Configuration/NfoOptions.cs index f631439de..60dcde4db 100644 --- a/MediaBrowser.XbmcMetadata/Configuration/NfoOptions.cs +++ b/MediaBrowser.XbmcMetadata/Configuration/NfoOptions.cs @@ -6,6 +6,7 @@ namespace MediaBrowser.XbmcMetadata.Configuration { public class ConfigurationFactory : IConfigurationFactory { + /// public IEnumerable GetConfigurations() { return new[] diff --git a/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs b/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs index 5896497ab..091c60fc9 100644 --- a/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs +++ b/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs @@ -22,13 +22,6 @@ namespace MediaBrowser.XbmcMetadata.Parsers public class BaseNfoParser where T : BaseItem { - /// - /// The logger - /// - protected ILogger Logger { get; private set; } - protected IProviderManager ProviderManager { get; private set; } - - private readonly CultureInfo _usCulture = new CultureInfo("en-US"); private readonly IConfigurationManager _config; private Dictionary _validProviderIds; @@ -42,6 +35,20 @@ namespace MediaBrowser.XbmcMetadata.Parsers ProviderManager = providerManager; } + protected CultureInfo UsCulture { get; } = new CultureInfo("en-US"); + + /// + /// Gets the logger. + /// + protected ILogger Logger { get; } + + protected IProviderManager ProviderManager { get; } + + protected virtual bool SupportsUrlAfterClosingXmlTag => false; + + protected virtual string MovieDbParserSearchString => "themoviedb.org/movie/"; + + /// /// Fetches metadata for an item from one xml file /// @@ -83,8 +90,6 @@ namespace MediaBrowser.XbmcMetadata.Parsers Fetch(item, metadataFile, GetXmlReaderSettings(), cancellationToken); } - protected virtual bool SupportsUrlAfterClosingXmlTag => false; - /// /// Fetches the specified item. /// @@ -198,8 +203,6 @@ namespace MediaBrowser.XbmcMetadata.Parsers } } - protected virtual string MovieDbParserSearchString => "themoviedb.org/movie/"; - protected void ParseProviderLinks(T item, string xml) { //Look for a match for the Regex pattern "tt" followed by 7 digits @@ -219,7 +222,7 @@ namespace MediaBrowser.XbmcMetadata.Parsers var tmdbId = xml.Substring(index + srch.Length).TrimEnd('/').Split('-')[0]; if (!string.IsNullOrWhiteSpace(tmdbId) && int.TryParse(tmdbId, NumberStyles.Integer, CultureInfo.InvariantCulture, out var value)) { - item.SetProviderId(MetadataProviders.Tmdb, value.ToString(_usCulture)); + item.SetProviderId(MetadataProviders.Tmdb, value.ToString(UsCulture)); } } @@ -234,7 +237,7 @@ namespace MediaBrowser.XbmcMetadata.Parsers var tvdbId = xml.Substring(index + srch.Length).TrimEnd('/'); if (!string.IsNullOrWhiteSpace(tvdbId) && int.TryParse(tvdbId, NumberStyles.Integer, CultureInfo.InvariantCulture, out var value)) { - item.SetProviderId(MetadataProviders.Tvdb, value.ToString(_usCulture)); + item.SetProviderId(MetadataProviders.Tvdb, value.ToString(UsCulture)); } } } @@ -291,7 +294,7 @@ namespace MediaBrowser.XbmcMetadata.Parsers if (!string.IsNullOrEmpty(text)) { - if (float.TryParse(text, NumberStyles.Any, _usCulture, out var value)) + if (float.TryParse(text, NumberStyles.Any, UsCulture, out var value)) { item.CriticRating = value; } @@ -417,7 +420,7 @@ namespace MediaBrowser.XbmcMetadata.Parsers if (!string.IsNullOrWhiteSpace(text)) { - if (int.TryParse(text.Split(' ')[0], NumberStyles.Integer, _usCulture, out var runtime)) + if (int.TryParse(text.Split(' ')[0], NumberStyles.Integer, UsCulture, out var runtime)) { item.RunTimeTicks = TimeSpan.FromMinutes(runtime).Ticks; } @@ -870,7 +873,7 @@ namespace MediaBrowser.XbmcMetadata.Parsers if (!string.IsNullOrWhiteSpace(val)) { - if (int.TryParse(val, NumberStyles.Integer, _usCulture, out var intVal)) + if (int.TryParse(val, NumberStyles.Integer, UsCulture, out var intVal)) { sortOrder = intVal; } diff --git a/MediaBrowser.XbmcMetadata/Parsers/EpisodeNfoParser.cs b/MediaBrowser.XbmcMetadata/Parsers/EpisodeNfoParser.cs index 7f4224076..82ac6c548 100644 --- a/MediaBrowser.XbmcMetadata/Parsers/EpisodeNfoParser.cs +++ b/MediaBrowser.XbmcMetadata/Parsers/EpisodeNfoParser.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using System.Globalization; using System.IO; using System.Text; @@ -14,16 +13,12 @@ namespace MediaBrowser.XbmcMetadata.Parsers { public class EpisodeNfoParser : BaseNfoParser { - public void Fetch(MetadataResult item, - List images, - string metadataFile, - CancellationToken cancellationToken) + public EpisodeNfoParser(ILogger logger, IConfigurationManager config, IProviderManager providerManager) + : base(logger, config, providerManager) { - Fetch(item, metadataFile, cancellationToken); } - private readonly CultureInfo UsCulture = new CultureInfo("en-US"); - + /// protected override void Fetch(MetadataResult item, string metadataFile, XmlReaderSettings settings, CancellationToken cancellationToken) { using (var fileStream = File.OpenRead(metadataFile)) @@ -73,11 +68,7 @@ namespace MediaBrowser.XbmcMetadata.Parsers } } - /// - /// Fetches the data from XML node. - /// - /// The reader. - /// The item result. + /// protected override void FetchDataFromXmlNode(XmlReader reader, MetadataResult itemResult) { var item = itemResult.Item; @@ -212,10 +203,5 @@ namespace MediaBrowser.XbmcMetadata.Parsers break; } } - - public EpisodeNfoParser(ILogger logger, IConfigurationManager config, IProviderManager providerManager) - : base(logger, config, providerManager) - { - } } } diff --git a/MediaBrowser.XbmcMetadata/Parsers/MovieNfoParser.cs b/MediaBrowser.XbmcMetadata/Parsers/MovieNfoParser.cs index 0c4de9f33..79d9111fe 100644 --- a/MediaBrowser.XbmcMetadata/Parsers/MovieNfoParser.cs +++ b/MediaBrowser.XbmcMetadata/Parsers/MovieNfoParser.cs @@ -13,13 +13,15 @@ namespace MediaBrowser.XbmcMetadata.Parsers { public class MovieNfoParser : BaseNfoParser