The Free Software Media System - Server Backend & API
resharper suggestions in controller project
Luke Pulverentiff1db0a17341
diff --git a/MediaBrowser.Controller/Drawing/ImageManager.cs b/MediaBrowser.Controller/Drawing/ImageManager.csindex 7e6b65b48f..ad3f66d2c7 100644--- a/MediaBrowser.Controller/Drawing/ImageManager.cs+++ b/MediaBrowser.Controller/Drawing/ImageManager.cs@@ -1,5 +1,4 @@-using System.Globalization;-using MediaBrowser.Common.Extensions;+using MediaBrowser.Common.Extensions;using MediaBrowser.Common.IO;using MediaBrowser.Controller.Entities;using MediaBrowser.Controller.Entities.TV;@@ -7,13 +6,13 @@ using MediaBrowser.Controller.Providers;using MediaBrowser.Model.Drawing;using MediaBrowser.Model.Entities;using MediaBrowser.Model.Logging;-using MediaBrowser.Model.Serialization;using System;using System.Collections.Concurrent;using System.Collections.Generic;using System.Drawing;using System.Drawing.Drawing2D;using System.Drawing.Imaging;+using System.Globalization;using System.IO;using System.Linq;using System.Threading;@@ -208,7 +207,7 @@ namespace MediaBrowser.Controller.Drawingvar outputFormat = originalImage.RawFormat;- using (var memoryStream = new MemoryStream { })+ using (var memoryStream = new MemoryStream()){// Save to the memory streamthumbnail.Save(outputFormat, memoryStream, quality.Value);diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.csindex e8e90b97ad..4e63160fc6 100644--- a/MediaBrowser.Controller/Entities/BaseItem.cs+++ b/MediaBrowser.Controller/Entities/BaseItem.cs@@ -1,5 +1,4 @@-using MediaBrowser.Common.Configuration;-using MediaBrowser.Common.Extensions;+using MediaBrowser.Common.Extensions;using MediaBrowser.Controller.Configuration;using MediaBrowser.Controller.IO;using MediaBrowser.Controller.Library;@@ -313,7 +312,7 @@ namespace MediaBrowser.Controller.Entitiesvar path = Path;// non file-system entries will not have a path- if (this.LocationType != LocationType.FileSystem || string.IsNullOrEmpty(path))+ if (LocationType != LocationType.FileSystem || string.IsNullOrEmpty(path)){return new ItemResolveArgs(ConfigurationManager.ApplicationPaths){@@ -637,12 +636,12 @@ namespace MediaBrowser.Controller.Entitiescatch (IOException ex){Logger.ErrorException("Error getting ResolveArgs for {0}", ex, Path);- return new List<Video> { };+ return new List<Video>();}if (!resolveArgs.IsDirectory){- return new List<Video> { };+ return new List<Video>();}var folder = resolveArgs.GetFileSystemEntryByName(TrailerFolderName);@@ -650,7 +649,7 @@ namespace MediaBrowser.Controller.Entities// Path doesn't exist. No biggieif (folder == null){- return new List<Video> { };+ return new List<Video>();}IEnumerable<WIN32_FIND_DATA> files;@@ -662,7 +661,7 @@ namespace MediaBrowser.Controller.Entitiescatch (IOException ex){Logger.ErrorException("Error loading trailers for {0}", ex, Name);- return new List<Video> { };+ return new List<Video>();}return LibraryManager.ResolvePaths<Video>(files, null).Select(video =>diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.csindex d34fb75a7b..f862ce61b5 100644--- a/MediaBrowser.Controller/Entities/Folder.cs+++ b/MediaBrowser.Controller/Entities/Folder.cs@@ -4,7 +4,6 @@ using MediaBrowser.Controller.IO;using MediaBrowser.Controller.Library;using MediaBrowser.Controller.Localization;using MediaBrowser.Controller.Resolvers;-using MediaBrowser.Controller.Sorting;using MediaBrowser.Model.Entities;using System;using System.Collections.Concurrent;@@ -714,7 +713,7 @@ namespace MediaBrowser.Controller.Entitiescatch (IOException ex){Logger.ErrorException("Error getting ResolveArgs for {0}", ex, Path);- return new List<BaseItem> { };+ return new List<BaseItem>();}return LibraryManager.ResolvePaths<BaseItem>(fileSystemChildren, this);@@ -754,12 +753,7 @@ namespace MediaBrowser.Controller.Entities}// If indexed is false or the indexing function is null- if (result == null)- {- result = ActualChildren.Where(c => c.IsVisible(user));- }-- return result;+ return result ?? (ActualChildren.Where(c => c.IsVisible(user)));}/// <summary>@@ -799,7 +793,7 @@ namespace MediaBrowser.Controller.Entities{await base.ChangedExternally().ConfigureAwait(false);- var progress = new Progress<double> { };+ var progress = new Progress<double>();await ValidateChildren(progress, CancellationToken.None).ConfigureAwait(false);}diff --git a/MediaBrowser.Controller/Entities/Movies/Movie.cs b/MediaBrowser.Controller/Entities/Movies/Movie.csindex ac12abcef6..d085880775 100644--- a/MediaBrowser.Controller/Entities/Movies/Movie.cs+++ b/MediaBrowser.Controller/Entities/Movies/Movie.cs@@ -118,14 +118,12 @@ namespace MediaBrowser.Controller.Entities.MoviescancellationToken.ThrowIfCancellationRequested();return result;- }-+ }+/// <summary>- /// Loads special features from the file system+ /// Loads the special features./// </summary>- /// <param name="entity">The entity.</param>- /// <returns>List{Video}.</returns>- /// <exception cref="System.ArgumentNullException"></exception>+ /// <returns>IEnumerable{Video}.</returns>private IEnumerable<Video> LoadSpecialFeatures(){WIN32_FIND_DATA? folder;@@ -137,13 +135,13 @@ namespace MediaBrowser.Controller.Entities.Moviescatch (IOException ex){Logger.ErrorException("Error getting ResolveArgs for {0}", ex, Path);- return new List<Video> { };+ return new List<Video>();}// Path doesn't exist. No biggieif (folder == null){- return new List<Video> { };+ return new List<Video>();}IEnumerable<WIN32_FIND_DATA> files;@@ -155,7 +153,7 @@ namespace MediaBrowser.Controller.Entities.Moviescatch (IOException ex){Logger.ErrorException("Error loading trailers for {0}", ex, Name);- return new List<Video> { };+ return new List<Video>();}return LibraryManager.ResolvePaths<Video>(files, null).Select(video =>diff --git a/MediaBrowser.Controller/Entities/User.cs b/MediaBrowser.Controller/Entities/User.csindex 954dfb05f1..edca21ae7a 100644--- a/MediaBrowser.Controller/Entities/User.cs+++ b/MediaBrowser.Controller/Entities/User.cs@@ -5,7 +5,6 @@ using MediaBrowser.Model.Configuration;using MediaBrowser.Model.Serialization;using System;using System.IO;-using System.Linq;using System.Runtime.Serialization;using System.Threading;using System.Threading.Tasks;@@ -266,7 +265,7 @@ namespace MediaBrowser.Controller.EntitiesRootFolder = null;// Kick off a task to validate the media library- Task.Run(() => ValidateMediaLibrary(new Progress<double> { }, CancellationToken.None));+ Task.Run(() => ValidateMediaLibrary(new Progress<double>(), CancellationToken.None));return RefreshMetadata(CancellationToken.None, forceSave: true, forceRefresh: true);}diff --git a/MediaBrowser.Controller/IServerApplicationPaths.cs b/MediaBrowser.Controller/IServerApplicationPaths.csindex aa6ff4d97a..6b17b5d798 100644--- a/MediaBrowser.Controller/IServerApplicationPaths.cs+++ b/MediaBrowser.Controller/IServerApplicationPaths.cs@@ -76,6 +76,7 @@ namespace MediaBrowser.Controller/// <value>The FF MPEG stream cache path.</value>string EncodedMediaCachePath { get; }+ /// <summary>/// Gets the downloaded images data path./// </summary>/// <value>The downloaded images data path.</value>diff --git a/MediaBrowser.Controller/Library/ILibraryManager.cs b/MediaBrowser.Controller/Library/ILibraryManager.csindex a9b8f607d1..617a6c8182 100644--- a/MediaBrowser.Controller/Library/ILibraryManager.cs+++ b/MediaBrowser.Controller/Library/ILibraryManager.cs@@ -1,6 +1,5 @@using MediaBrowser.Controller.Entities;using MediaBrowser.Controller.IO;-using MediaBrowser.Controller.Persistence;using MediaBrowser.Controller.Resolvers;using MediaBrowser.Controller.Sorting;using MediaBrowser.Model.Entities;@@ -20,9 +19,9 @@ namespace MediaBrowser.Controller.Libraryevent EventHandler<ChildrenChangedEventArgs> LibraryChanged;/// <summary>- /// Raises the <see cref="E:LibraryChanged" /> event.+ /// Reports the library changed./// </summary>- /// <param name="args">The <see cref="ChildrenChangedEventArgs" /> instance containing the event data.</param>+ /// <param name="args">The <see cref="ChildrenChangedEventArgs"/> instance containing the event data.</param>void ReportLibraryChanged(ChildrenChangedEventArgs args);/// <summary>diff --git a/MediaBrowser.Controller/Library/Profiler.cs b/MediaBrowser.Controller/Library/Profiler.csindex 469d8ef18d..d3a754dc99 100644--- a/MediaBrowser.Controller/Library/Profiler.cs+++ b/MediaBrowser.Controller/Library/Profiler.cs@@ -12,16 +12,16 @@ namespace MediaBrowser.Controller.Library/// <summary>/// The name/// </summary>- readonly string name;+ readonly string _name;/// <summary>/// The stopwatch/// </summary>- readonly Stopwatch stopwatch;+ readonly Stopwatch _stopwatch;/// <summary>/// The _logger/// </summary>- private ILogger _logger;+ private readonly ILogger _logger;/// <summary>/// Initializes a new instance of the <see cref="Profiler" /> class.@@ -30,12 +30,12 @@ namespace MediaBrowser.Controller.Library/// <param name="logger">The logger.</param>public Profiler(string name, ILogger logger){- this.name = name;+ this._name = name;_logger = logger;- stopwatch = new Stopwatch();- stopwatch.Start();+ _stopwatch = new Stopwatch();+ _stopwatch.Start();}#region IDisposable Members@@ -56,17 +56,17 @@ namespace MediaBrowser.Controller.Library{if (dispose){- stopwatch.Stop();+ _stopwatch.Stop();string message;- if (stopwatch.ElapsedMilliseconds > 300000)+ if (_stopwatch.ElapsedMilliseconds > 300000){message = string.Format("{0} took {1} minutes.",- name, ((float)stopwatch.ElapsedMilliseconds / 60000).ToString("F"));+ _name, ((float)_stopwatch.ElapsedMilliseconds / 60000).ToString("F"));}else{message = string.Format("{0} took {1} seconds.",- name, ((float)stopwatch.ElapsedMilliseconds / 1000).ToString("#0.000"));+ _name, ((float)_stopwatch.ElapsedMilliseconds / 1000).ToString("#0.000"));}_logger.Info(message);}diff --git a/MediaBrowser.Controller/Library/TVUtils.cs b/MediaBrowser.Controller/Library/TVUtils.csindex d6a922ff47..6ddb1ba5fd 100644--- a/MediaBrowser.Controller/Library/TVUtils.cs+++ b/MediaBrowser.Controller/Library/TVUtils.cs@@ -277,9 +277,7 @@ namespace MediaBrowser.Controller.Library};}- return new List<DayOfWeek>- {- };+ return new List<DayOfWeek>();}return null;}diff --git a/MediaBrowser.Controller/Localization/LocalizedStrings.cs b/MediaBrowser.Controller/Localization/LocalizedStrings.csindex ea065b17af..31dcb2e9f4 100644--- a/MediaBrowser.Controller/Localization/LocalizedStrings.cs+++ b/MediaBrowser.Controller/Localization/LocalizedStrings.cs@@ -1,12 +1,9 @@-using MediaBrowser.Controller.Configuration;-using MediaBrowser.Model.Logging;-using System;+using System;using System.Collections.Concurrent;using System.Globalization;using System.IO;using System.Linq;using System.Reflection;-using System.Xml.Serialization;namespace MediaBrowser.Controller.Localization{@@ -30,7 +27,7 @@ namespace MediaBrowser.Controller.Localization/// </summary>private static LocalizedStrings _instance;- private IServerApplicationPaths _appPaths;+ private readonly IServerApplicationPaths _appPaths;/// <summary>/// Gets the instance.diff --git a/MediaBrowser.Controller/Localization/Ratings.cs b/MediaBrowser.Controller/Localization/Ratings.csindex 1220dd8a79..44bbb3d00e 100644--- a/MediaBrowser.Controller/Localization/Ratings.cs+++ b/MediaBrowser.Controller/Localization/Ratings.cs@@ -1,6 +1,4 @@-using MediaBrowser.Common.Extensions;-using MediaBrowser.Controller.Configuration;-using MediaBrowser.Model.Logging;+using MediaBrowser.Controller.Configuration;using System.Collections.Generic;using System.IO;using System.Linq;@@ -44,17 +42,16 @@ namespace MediaBrowser.Controller.Localization/// <param name="key">The key.</param>/// <param name="value">The value.</param>/// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>- private static bool TryAdd<TKey, TValue>(Dictionary<TKey, TValue> dictionary, TKey key, TValue value)+ private static void TryAdd<TKey, TValue>(Dictionary<TKey, TValue> dictionary, TKey key, TValue value){if (dictionary.ContainsKey(key)){- return false;+ return;}dictionary.Add(key, value);- return true;}-+/// <summary>/// Initializes the specified block unrated./// </summary>@@ -65,7 +62,7 @@ namespace MediaBrowser.Controller.Localization//build our ratings dictionary from the combined local one and us oneratingsDef = new RatingsDefinition(Path.Combine(configurationManager.ApplicationPaths.LocalizationPath, "Ratings-" + configurationManager.Configuration.MetadataCountryCode + ".txt"), configurationManager);//global value of None- var dict = new Dictionary<string, int> {{"None", -1}};+ var dict = new Dictionary<string, int> { { "None", -1 } };foreach (var pair in ratingsDef.RatingsDict){TryAdd(dict, pair.Key, pair.Value);@@ -85,7 +82,7 @@ namespace MediaBrowser.Controller.Localization//and rating reverse lookup dictionary (non-redundant ones)ratingsStrings.Clear();var lastLevel = -10;- ratingsStrings.Add(-1,LocalizedStrings.Instance.GetString("Any"));+ ratingsStrings.Add(-1, LocalizedStrings.Instance.GetString("Any"));foreach (var pair in ratingsDef.RatingsDict.OrderBy(p => p.Value)){if (pair.Value > lastLevel)@@ -147,7 +144,7 @@ namespace MediaBrowser.Controller.Localizationpublic static string ToString(int level){//return the closest one- while (level > 0)+ while (level > 0){if (ratingsStrings.ContainsKey(level))return ratingsStrings[level];diff --git a/MediaBrowser.Controller/Localization/RatingsDefinition.cs b/MediaBrowser.Controller/Localization/RatingsDefinition.csindex 1162d2389f..e5302bee67 100644--- a/MediaBrowser.Controller/Localization/RatingsDefinition.cs+++ b/MediaBrowser.Controller/Localization/RatingsDefinition.cs@@ -1,5 +1,4 @@using MediaBrowser.Controller.Configuration;-using MediaBrowser.Model.Logging;using System;using System.Collections.Generic;using System.IO;@@ -15,7 +14,6 @@ namespace MediaBrowser.Controller.Localization/// Initializes a new instance of the <see cref="RatingsDefinition" /> class./// </summary>/// <param name="file">The file.</param>- /// <param name="logger">The logger.</param>/// <param name="configurationManager">The configuration manager.</param>public RatingsDefinition(string file, IServerConfigurationManager configurationManager){diff --git a/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs b/MediaBrowser.Controller/Providers/BaseItemXmlParser.csindex 41a32d7fd4..cbee793991 100644--- a/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs+++ b/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs@@ -1,5 +1,4 @@-using MediaBrowser.Common.Extensions;-using MediaBrowser.Controller.Entities;+using MediaBrowser.Controller.Entities;using MediaBrowser.Model.Entities;using MediaBrowser.Model.Logging;using System;diff --git a/MediaBrowser.Controller/Providers/MediaInfo/FFMpegVideoImageProvider.cs b/MediaBrowser.Controller/Providers/MediaInfo/FFMpegVideoImageProvider.csindex ad81fa442f..dff4a4ea16 100644--- a/MediaBrowser.Controller/Providers/MediaInfo/FFMpegVideoImageProvider.cs+++ b/MediaBrowser.Controller/Providers/MediaInfo/FFMpegVideoImageProvider.cs@@ -27,6 +27,7 @@ namespace MediaBrowser.Controller.Providers.MediaInfo/// <param name="isoManager">The iso manager.</param>/// <param name="logManager">The log manager.</param>/// <param name="configurationManager">The configuration manager.</param>+ /// <param name="mediaEncoder">The media encoder.</param>public FfMpegVideoImageProvider(IIsoManager isoManager, ILogManager logManager, IServerConfigurationManager configurationManager, IMediaEncoder mediaEncoder): base(logManager, configurationManager, mediaEncoder){diff --git a/MediaBrowser.Controller/Providers/MediaInfo/FFProbeVideoInfoProvider.cs b/MediaBrowser.Controller/Providers/MediaInfo/FFProbeVideoInfoProvider.csindex 2fc140f2e9..1b7266d578 100644--- a/MediaBrowser.Controller/Providers/MediaInfo/FFProbeVideoInfoProvider.cs+++ b/MediaBrowser.Controller/Providers/MediaInfo/FFProbeVideoInfoProvider.cs@@ -309,7 +309,7 @@ namespace MediaBrowser.Controller.Providers.MediaInfolong currentChapterTicks = 0;var index = 1;- var chapters = new List<ChapterInfo> { };+ var chapters = new List<ChapterInfo>();while (currentChapterTicks < runtime){@@ -372,7 +372,7 @@ namespace MediaBrowser.Controller.Providers.MediaInfo}// Fill video properties from the BDInfo result- Fetch(video, inputPath, result);+ Fetch(video, result);videoStream = video.MediaStreams.FirstOrDefault(s => s.Type == MediaStreamType.Video);@@ -399,9 +399,8 @@ namespace MediaBrowser.Controller.Providers.MediaInfo/// Fills video properties from the VideoStream of the largest playlist/// </summary>/// <param name="video">The video.</param>- /// <param name="inputPath">The input path.</param>/// <param name="stream">The stream.</param>- private void Fetch(Video video, string inputPath, BlurayDiscInfo stream)+ private void Fetch(Video video, BlurayDiscInfo stream){// Check all input for null/empty/zerodiff --git a/MediaBrowser.Controller/Providers/Movies/FanArtMovieProvider.cs b/MediaBrowser.Controller/Providers/Movies/FanArtMovieProvider.csindex 7079f3330d..3152ceac93 100644--- a/MediaBrowser.Controller/Providers/Movies/FanArtMovieProvider.cs+++ b/MediaBrowser.Controller/Providers/Movies/FanArtMovieProvider.cs@@ -19,8 +19,6 @@ namespace MediaBrowser.Controller.Providers.Movies/// </summary>class FanArtMovieProvider : FanartBaseProvider, IDisposable{- internal static FanArtMovieProvider Current { get; private set; }-/// <summary>/// Gets the HTTP client./// </summary>@@ -28,13 +26,14 @@ namespace MediaBrowser.Controller.Providers.Moviesprotected IHttpClient HttpClient { get; private set; }private readonly IProviderManager _providerManager;-+/// <summary>/// Initializes a new instance of the <see cref="FanArtMovieProvider" /> class./// </summary>/// <param name="httpClient">The HTTP client.</param>/// <param name="logManager">The log manager.</param>/// <param name="configurationManager">The configuration manager.</param>+ /// <param name="providerManager">The provider manager.</param>/// <exception cref="System.ArgumentNullException">httpClient</exception>public FanArtMovieProvider(IHttpClient httpClient, ILogManager logManager, IServerConfigurationManager configurationManager, IProviderManager providerManager): base(logManager, configurationManager)diff --git a/MediaBrowser.Controller/Providers/Movies/MovieDbProvider.cs b/MediaBrowser.Controller/Providers/Movies/MovieDbProvider.csindex 68d6c197c3..ce03923e28 100644--- a/MediaBrowser.Controller/Providers/Movies/MovieDbProvider.cs+++ b/MediaBrowser.Controller/Providers/Movies/MovieDbProvider.cs@@ -60,6 +60,7 @@ namespace MediaBrowser.Controller.Providers.Movies/// <param name="configurationManager">The configuration manager.</param>/// <param name="jsonSerializer">The json serializer.</param>/// <param name="httpClient">The HTTP client.</param>+ /// <param name="providerManager">The provider manager.</param>public MovieDbProvider(ILogManager logManager, IServerConfigurationManager configurationManager, IJsonSerializer jsonSerializer, IHttpClient httpClient, IProviderManager providerManager): base(logManager, configurationManager){@@ -157,7 +158,7 @@ namespace MediaBrowser.Controller.Providers.Movies{try{- using (var json = await httpClient.Get(String.Format(TmdbConfigUrl, ApiKey), MovieDbProvider.Current.MovieDbResourcePool, CancellationToken.None).ConfigureAwait(false))+ using (var json = await httpClient.Get(String.Format(TmdbConfigUrl, ApiKey), Current.MovieDbResourcePool, CancellationToken.None).ConfigureAwait(false)){return jsonSerializer.DeserializeFromStream<TmdbSettingsResult>(json);}diff --git a/MediaBrowser.Controller/Providers/Music/FanArtAlbumProvider.cs b/MediaBrowser.Controller/Providers/Music/FanArtAlbumProvider.csindex 331bd00dab..b533848412 100644--- a/MediaBrowser.Controller/Providers/Music/FanArtAlbumProvider.cs+++ b/MediaBrowser.Controller/Providers/Music/FanArtAlbumProvider.cs@@ -1,15 +1,12 @@-using System;-using System.Collections.Generic;-using System.Linq;-using System.Text;-using System.Threading;-using System.Threading.Tasks;+using MediaBrowser.Common.Extensions;using MediaBrowser.Controller.Configuration;using MediaBrowser.Controller.Entities;using MediaBrowser.Controller.Entities.Audio;using MediaBrowser.Model.Entities;using MediaBrowser.Model.Logging;-using MediaBrowser.Common.Extensions;+using System;+using System.Threading;+using System.Threading.Tasks;namespace MediaBrowser.Controller.Providers.Music{diff --git a/MediaBrowser.Controller/Providers/Music/FanArtArtistProvider.cs b/MediaBrowser.Controller/Providers/Music/FanArtArtistProvider.csindex 4846c8fdc3..ec7a96d99d 100644--- a/MediaBrowser.Controller/Providers/Music/FanArtArtistProvider.cs+++ b/MediaBrowser.Controller/Providers/Music/FanArtArtistProvider.cs@@ -1,15 +1,13 @@-using System.Collections.Generic;-using System.Collections.Specialized;-using MediaBrowser.Common.Extensions;+using MediaBrowser.Common.Extensions;using MediaBrowser.Common.Net;using MediaBrowser.Controller.Configuration;using MediaBrowser.Controller.Entities;using MediaBrowser.Controller.Entities.Audio;-using MediaBrowser.Controller.Entities.Movies;using MediaBrowser.Model.Entities;using MediaBrowser.Model.Logging;using MediaBrowser.Model.Net;using System;+using System.Collections.Generic;using System.IO;using System.Threading;using System.Threading.Tasks;diff --git a/MediaBrowser.Controller/Providers/Music/LastfmAlbumProvider.cs b/MediaBrowser.Controller/Providers/Music/LastfmAlbumProvider.csindex 80eb20ccc7..697a6604cb 100644--- a/MediaBrowser.Controller/Providers/Music/LastfmAlbumProvider.cs+++ b/MediaBrowser.Controller/Providers/Music/LastfmAlbumProvider.cs@@ -36,7 +36,7 @@ namespace MediaBrowser.Controller.Providers.Music// Get albu info using artist and album namevar url = RootUrl + string.Format("method=album.getInfo&artist={0}&album={1}&api_key={2}&format=json", UrlEncode(item.Parent.Name), UrlEncode(item.Name), ApiKey);- LastfmGetAlbumResult result = null;+ LastfmGetAlbumResult result;try{diff --git a/MediaBrowser.Controller/Providers/Music/LastfmArtistProvider.cs b/MediaBrowser.Controller/Providers/Music/LastfmArtistProvider.csindex 016650071a..8a17bcbf6e 100644--- a/MediaBrowser.Controller/Providers/Music/LastfmArtistProvider.cs+++ b/MediaBrowser.Controller/Providers/Music/LastfmArtistProvider.cs@@ -1,19 +1,15 @@-using System;-using System.Collections.Generic;-using System.IO;-using System.Linq;-using System.Net;-using System.Text;-using System.Threading;-using System.Threading.Tasks;-using MediaBrowser.Common.Net;+using MediaBrowser.Common.Net;using MediaBrowser.Controller.Configuration;-using MediaBrowser.Model.Entities;using MediaBrowser.Controller.Entities;using MediaBrowser.Controller.Entities.Audio;using MediaBrowser.Model.Logging;using MediaBrowser.Model.Net;using MediaBrowser.Model.Serialization;+using System.IO;+using System.Linq;+using System.Net;+using System.Threading;+using System.Threading.Tasks;namespace MediaBrowser.Controller.Providers.Music{@@ -28,7 +24,7 @@ namespace MediaBrowser.Controller.Providers.MusicLocalMetaFileName = LastfmHelper.LocalArtistMetaFileName;}- protected override async Task<string> FindId(Entities.BaseItem item, System.Threading.CancellationToken cancellationToken)+ protected override async Task<string> FindId(BaseItem item, CancellationToken cancellationToken){//Execute the Artist search against our name and assume first one is the one we wantvar url = RootUrl + string.Format("method=artist.search&artist={0}&api_key={1}&format=json", UrlEncode(item.Name), ApiKey);@@ -99,7 +95,7 @@ namespace MediaBrowser.Controller.Providers.Music}}- public override bool Supports(Entities.BaseItem item)+ public override bool Supports(BaseItem item){return item is MusicArtist;}diff --git a/MediaBrowser.Controller/Providers/Music/LastfmHelper.cs b/MediaBrowser.Controller/Providers/Music/LastfmHelper.csindex 2ffdbdc6b8..842d10e4d5 100644--- a/MediaBrowser.Controller/Providers/Music/LastfmHelper.cs+++ b/MediaBrowser.Controller/Providers/Music/LastfmHelper.cs@@ -1,5 +1,4 @@-using MediaBrowser.Common.Extensions;-using MediaBrowser.Controller.Entities;+using MediaBrowser.Controller.Entities;using MediaBrowser.Model.Entities;using System;@@ -17,19 +16,12 @@ namespace MediaBrowser.Controller.Providers.Musicartist.Overview = overview;var yearFormed = 0;- try- {- yearFormed = Convert.ToInt32(data.bio.yearformed);- }- catch (FormatException)- {- }- catch (NullReferenceException)- {- }- catch (OverflowException)++ if (data.bio != null){+ Int32.TryParse(data.bio.yearformed, out yearFormed);}+artist.PremiereDate = yearFormed > 0 ? new DateTime(yearFormed, 1,1) : DateTime.MinValue;artist.ProductionYear = yearFormed;if (data.tags != null)@@ -46,7 +38,7 @@ namespace MediaBrowser.Controller.Providers.Musicitem.Overview = overview;- var release = DateTime.MinValue;+ DateTime release;DateTime.TryParse(data.releasedate, out release);item.PremiereDate = release;item.ProductionYear = release.Year;diff --git a/MediaBrowser.Controller/Providers/Music/MusicArtistProviderFromJson.cs b/MediaBrowser.Controller/Providers/Music/MusicArtistProviderFromJson.csindex 8b9b07bce8..6ff6a51829 100644--- a/MediaBrowser.Controller/Providers/Music/MusicArtistProviderFromJson.cs+++ b/MediaBrowser.Controller/Providers/Music/MusicArtistProviderFromJson.cs@@ -1,17 +1,13 @@-using System;-using System.Collections.Generic;-using System.IO;-using System.Linq;-using System.Text;-using System.Threading;-using System.Threading.Tasks;-using MediaBrowser.Common.Net;-using MediaBrowser.Controller.Configuration;+using MediaBrowser.Controller.Configuration;using MediaBrowser.Controller.Entities;using MediaBrowser.Controller.Entities.Audio;using MediaBrowser.Model.Entities;using MediaBrowser.Model.Logging;using MediaBrowser.Model.Serialization;+using System;+using System.IO;+using System.Threading;+using System.Threading.Tasks;namespace MediaBrowser.Controller.Providers.Music{diff --git a/MediaBrowser.Controller/Providers/TV/FanArtTVProvider.cs b/MediaBrowser.Controller/Providers/TV/FanArtTVProvider.csindex 982997ad3b..4d06143fce 100644--- a/MediaBrowser.Controller/Providers/TV/FanArtTVProvider.cs+++ b/MediaBrowser.Controller/Providers/TV/FanArtTVProvider.cs@@ -3,7 +3,6 @@ using MediaBrowser.Common.Net;using MediaBrowser.Controller.Configuration;using MediaBrowser.Controller.Entities;using MediaBrowser.Controller.Entities.TV;-using MediaBrowser.Controller.Providers.Movies;using MediaBrowser.Model.Entities;using MediaBrowser.Model.Logging;using MediaBrowser.Model.Net;diff --git a/MediaBrowser.Controller/Providers/TV/RemoteEpisodeProvider.cs b/MediaBrowser.Controller/Providers/TV/RemoteEpisodeProvider.csindex 46bb21c48a..6be0881b44 100644--- a/MediaBrowser.Controller/Providers/TV/RemoteEpisodeProvider.cs+++ b/MediaBrowser.Controller/Providers/TV/RemoteEpisodeProvider.cs@@ -148,6 +148,7 @@ namespace MediaBrowser.Controller.Providers.TV/// </summary>/// <param name="episode">The episode.</param>/// <param name="seriesId">The series id.</param>+ /// <param name="cancellationToken">The cancellation token.</param>/// <returns>Task{System.Boolean}.</returns>private async Task<bool> FetchEpisodeData(Episode episode, string seriesId, CancellationToken cancellationToken){diff --git a/MediaBrowser.Controller/Providers/TV/RemoteSeriesProvider.cs b/MediaBrowser.Controller/Providers/TV/RemoteSeriesProvider.csindex 8071cff640..f4e6d78930 100644--- a/MediaBrowser.Controller/Providers/TV/RemoteSeriesProvider.cs+++ b/MediaBrowser.Controller/Providers/TV/RemoteSeriesProvider.cs@@ -45,6 +45,7 @@ namespace MediaBrowser.Controller.Providers.TV/// <param name="httpClient">The HTTP client.</param>/// <param name="logManager">The log manager.</param>/// <param name="configurationManager">The configuration manager.</param>+ /// <param name="providerManager">The provider manager.</param>/// <exception cref="System.ArgumentNullException">httpClient</exception>public RemoteSeriesProvider(IHttpClient httpClient, ILogManager logManager, IServerConfigurationManager configurationManager, IProviderManager providerManager): base(logManager, configurationManager)