Răsfoiți Sursa

resharper suggestions in controller project

Luke Pulverenti 12 ani în urmă
părinte
comite
ff1db0a173
26 a modificat fișierele cu 80 adăugiri și 122 ștergeri
  1. 3 4
      MediaBrowser.Controller/Drawing/ImageManager.cs
  2. 6 7
      MediaBrowser.Controller/Entities/BaseItem.cs
  3. 3 9
      MediaBrowser.Controller/Entities/Folder.cs
  4. 7 9
      MediaBrowser.Controller/Entities/Movies/Movie.cs
  5. 1 2
      MediaBrowser.Controller/Entities/User.cs
  6. 1 0
      MediaBrowser.Controller/IServerApplicationPaths.cs
  7. 2 3
      MediaBrowser.Controller/Library/ILibraryManager.cs
  8. 10 10
      MediaBrowser.Controller/Library/Profiler.cs
  9. 1 3
      MediaBrowser.Controller/Library/TVUtils.cs
  10. 2 5
      MediaBrowser.Controller/Localization/LocalizedStrings.cs
  11. 7 10
      MediaBrowser.Controller/Localization/Ratings.cs
  12. 0 2
      MediaBrowser.Controller/Localization/RatingsDefinition.cs
  13. 1 2
      MediaBrowser.Controller/Providers/BaseItemXmlParser.cs
  14. 1 0
      MediaBrowser.Controller/Providers/MediaInfo/FFMpegVideoImageProvider.cs
  15. 3 4
      MediaBrowser.Controller/Providers/MediaInfo/FFProbeVideoInfoProvider.cs
  16. 2 3
      MediaBrowser.Controller/Providers/Movies/FanArtMovieProvider.cs
  17. 2 1
      MediaBrowser.Controller/Providers/Movies/MovieDbProvider.cs
  18. 4 7
      MediaBrowser.Controller/Providers/Music/FanArtAlbumProvider.cs
  19. 2 4
      MediaBrowser.Controller/Providers/Music/FanArtArtistProvider.cs
  20. 1 1
      MediaBrowser.Controller/Providers/Music/LastfmAlbumProvider.cs
  21. 8 12
      MediaBrowser.Controller/Providers/Music/LastfmArtistProvider.cs
  22. 6 14
      MediaBrowser.Controller/Providers/Music/LastfmHelper.cs
  23. 5 9
      MediaBrowser.Controller/Providers/Music/MusicArtistProviderFromJson.cs
  24. 0 1
      MediaBrowser.Controller/Providers/TV/FanArtTVProvider.cs
  25. 1 0
      MediaBrowser.Controller/Providers/TV/RemoteEpisodeProvider.cs
  26. 1 0
      MediaBrowser.Controller/Providers/TV/RemoteSeriesProvider.cs

+ 3 - 4
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.Common.IO;
 using MediaBrowser.Controller.Entities;
 using MediaBrowser.Controller.Entities;
 using MediaBrowser.Controller.Entities.TV;
 using MediaBrowser.Controller.Entities.TV;
@@ -7,13 +6,13 @@ using MediaBrowser.Controller.Providers;
 using MediaBrowser.Model.Drawing;
 using MediaBrowser.Model.Drawing;
 using MediaBrowser.Model.Entities;
 using MediaBrowser.Model.Entities;
 using MediaBrowser.Model.Logging;
 using MediaBrowser.Model.Logging;
-using MediaBrowser.Model.Serialization;
 using System;
 using System;
 using System.Collections.Concurrent;
 using System.Collections.Concurrent;
 using System.Collections.Generic;
 using System.Collections.Generic;
 using System.Drawing;
 using System.Drawing;
 using System.Drawing.Drawing2D;
 using System.Drawing.Drawing2D;
 using System.Drawing.Imaging;
 using System.Drawing.Imaging;
+using System.Globalization;
 using System.IO;
 using System.IO;
 using System.Linq;
 using System.Linq;
 using System.Threading;
 using System.Threading;
@@ -208,7 +207,7 @@ namespace MediaBrowser.Controller.Drawing
 
 
                         var outputFormat = originalImage.RawFormat;
                         var outputFormat = originalImage.RawFormat;
 
 
-                        using (var memoryStream = new MemoryStream { })
+                        using (var memoryStream = new MemoryStream())
                         {
                         {
                             // Save to the memory stream
                             // Save to the memory stream
                             thumbnail.Save(outputFormat, memoryStream, quality.Value);
                             thumbnail.Save(outputFormat, memoryStream, quality.Value);

+ 6 - 7
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.Configuration;
 using MediaBrowser.Controller.IO;
 using MediaBrowser.Controller.IO;
 using MediaBrowser.Controller.Library;
 using MediaBrowser.Controller.Library;
@@ -313,7 +312,7 @@ namespace MediaBrowser.Controller.Entities
             var path = Path;
             var path = Path;
 
 
             // non file-system entries will not have a 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)
                 return new ItemResolveArgs(ConfigurationManager.ApplicationPaths)
                 {
                 {
@@ -637,12 +636,12 @@ namespace MediaBrowser.Controller.Entities
             catch (IOException ex)
             catch (IOException ex)
             {
             {
                 Logger.ErrorException("Error getting ResolveArgs for {0}", ex, Path);
                 Logger.ErrorException("Error getting ResolveArgs for {0}", ex, Path);
-                return new List<Video> { };
+                return new List<Video>();
             }
             }
 
 
             if (!resolveArgs.IsDirectory)
             if (!resolveArgs.IsDirectory)
             {
             {
-                return new List<Video> { };
+                return new List<Video>();
             }
             }
 
 
             var folder = resolveArgs.GetFileSystemEntryByName(TrailerFolderName);
             var folder = resolveArgs.GetFileSystemEntryByName(TrailerFolderName);
@@ -650,7 +649,7 @@ namespace MediaBrowser.Controller.Entities
             // Path doesn't exist. No biggie
             // Path doesn't exist. No biggie
             if (folder == null)
             if (folder == null)
             {
             {
-                return new List<Video> { };
+                return new List<Video>();
             }
             }
 
 
             IEnumerable<WIN32_FIND_DATA> files;
             IEnumerable<WIN32_FIND_DATA> files;
@@ -662,7 +661,7 @@ namespace MediaBrowser.Controller.Entities
             catch (IOException ex)
             catch (IOException ex)
             {
             {
                 Logger.ErrorException("Error loading trailers for {0}", ex, Name);
                 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 =>
             return LibraryManager.ResolvePaths<Video>(files, null).Select(video =>

+ 3 - 9
MediaBrowser.Controller/Entities/Folder.cs

@@ -4,7 +4,6 @@ using MediaBrowser.Controller.IO;
 using MediaBrowser.Controller.Library;
 using MediaBrowser.Controller.Library;
 using MediaBrowser.Controller.Localization;
 using MediaBrowser.Controller.Localization;
 using MediaBrowser.Controller.Resolvers;
 using MediaBrowser.Controller.Resolvers;
-using MediaBrowser.Controller.Sorting;
 using MediaBrowser.Model.Entities;
 using MediaBrowser.Model.Entities;
 using System;
 using System;
 using System.Collections.Concurrent;
 using System.Collections.Concurrent;
@@ -714,7 +713,7 @@ namespace MediaBrowser.Controller.Entities
             catch (IOException ex)
             catch (IOException ex)
             {
             {
                 Logger.ErrorException("Error getting ResolveArgs for {0}", ex, Path);
                 Logger.ErrorException("Error getting ResolveArgs for {0}", ex, Path);
-                return new List<BaseItem> { };
+                return new List<BaseItem>();
             }
             }
 
 
             return LibraryManager.ResolvePaths<BaseItem>(fileSystemChildren, this);
             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 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>
         /// <summary>
@@ -799,7 +793,7 @@ namespace MediaBrowser.Controller.Entities
         {
         {
             await base.ChangedExternally().ConfigureAwait(false);
             await base.ChangedExternally().ConfigureAwait(false);
 
 
-            var progress = new Progress<double> { };
+            var progress = new Progress<double>();
 
 
             await ValidateChildren(progress, CancellationToken.None).ConfigureAwait(false);
             await ValidateChildren(progress, CancellationToken.None).ConfigureAwait(false);
         }
         }

+ 7 - 9
MediaBrowser.Controller/Entities/Movies/Movie.cs

@@ -118,14 +118,12 @@ namespace MediaBrowser.Controller.Entities.Movies
             cancellationToken.ThrowIfCancellationRequested();
             cancellationToken.ThrowIfCancellationRequested();
 
 
             return result;
             return result;
-        }      
-        
+        }
+
         /// <summary>
         /// <summary>
-        /// Loads special features from the file system
+        /// Loads the special features.
         /// </summary>
         /// </summary>
-        /// <param name="entity">The entity.</param>
-        /// <returns>List{Video}.</returns>
-        /// <exception cref="System.ArgumentNullException"></exception>
+        /// <returns>IEnumerable{Video}.</returns>
         private IEnumerable<Video> LoadSpecialFeatures()
         private IEnumerable<Video> LoadSpecialFeatures()
         {
         {
             WIN32_FIND_DATA? folder;
             WIN32_FIND_DATA? folder;
@@ -137,13 +135,13 @@ namespace MediaBrowser.Controller.Entities.Movies
             catch (IOException ex)
             catch (IOException ex)
             {
             {
                 Logger.ErrorException("Error getting ResolveArgs for {0}", ex, Path);
                 Logger.ErrorException("Error getting ResolveArgs for {0}", ex, Path);
-                return new List<Video> { };
+                return new List<Video>();
             }
             }
 
 
             // Path doesn't exist. No biggie
             // Path doesn't exist. No biggie
             if (folder == null)
             if (folder == null)
             {
             {
-                return new List<Video> { };
+                return new List<Video>();
             }
             }
 
 
             IEnumerable<WIN32_FIND_DATA> files;
             IEnumerable<WIN32_FIND_DATA> files;
@@ -155,7 +153,7 @@ namespace MediaBrowser.Controller.Entities.Movies
             catch (IOException ex)
             catch (IOException ex)
             {
             {
                 Logger.ErrorException("Error loading trailers for {0}", ex, Name);
                 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 =>
             return LibraryManager.ResolvePaths<Video>(files, null).Select(video =>

+ 1 - 2
MediaBrowser.Controller/Entities/User.cs

@@ -5,7 +5,6 @@ using MediaBrowser.Model.Configuration;
 using MediaBrowser.Model.Serialization;
 using MediaBrowser.Model.Serialization;
 using System;
 using System;
 using System.IO;
 using System.IO;
-using System.Linq;
 using System.Runtime.Serialization;
 using System.Runtime.Serialization;
 using System.Threading;
 using System.Threading;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
@@ -266,7 +265,7 @@ namespace MediaBrowser.Controller.Entities
             RootFolder = null;
             RootFolder = null;
 
 
             // Kick off a task to validate the media library
             // 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);
             return RefreshMetadata(CancellationToken.None, forceSave: true, forceRefresh: true);
         }
         }

+ 1 - 0
MediaBrowser.Controller/IServerApplicationPaths.cs

@@ -76,6 +76,7 @@ namespace MediaBrowser.Controller
         /// <value>The FF MPEG stream cache path.</value>
         /// <value>The FF MPEG stream cache path.</value>
         string EncodedMediaCachePath { get; }
         string EncodedMediaCachePath { get; }
 
 
+        /// <summary>
         /// Gets the downloaded images data path.
         /// Gets the downloaded images data path.
         /// </summary>
         /// </summary>
         /// <value>The downloaded images data path.</value>
         /// <value>The downloaded images data path.</value>

+ 2 - 3
MediaBrowser.Controller/Library/ILibraryManager.cs

@@ -1,6 +1,5 @@
 using MediaBrowser.Controller.Entities;
 using MediaBrowser.Controller.Entities;
 using MediaBrowser.Controller.IO;
 using MediaBrowser.Controller.IO;
-using MediaBrowser.Controller.Persistence;
 using MediaBrowser.Controller.Resolvers;
 using MediaBrowser.Controller.Resolvers;
 using MediaBrowser.Controller.Sorting;
 using MediaBrowser.Controller.Sorting;
 using MediaBrowser.Model.Entities;
 using MediaBrowser.Model.Entities;
@@ -20,9 +19,9 @@ namespace MediaBrowser.Controller.Library
         event EventHandler<ChildrenChangedEventArgs> LibraryChanged;
         event EventHandler<ChildrenChangedEventArgs> LibraryChanged;
 
 
         /// <summary>
         /// <summary>
-        /// Raises the <see cref="E:LibraryChanged" /> event.
+        /// Reports the library changed.
         /// </summary>
         /// </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);
         void ReportLibraryChanged(ChildrenChangedEventArgs args);
 
 
         /// <summary>
         /// <summary>

+ 10 - 10
MediaBrowser.Controller/Library/Profiler.cs

@@ -12,16 +12,16 @@ namespace MediaBrowser.Controller.Library
         /// <summary>
         /// <summary>
         /// The name
         /// The name
         /// </summary>
         /// </summary>
-        readonly string name;
+        readonly string _name;
         /// <summary>
         /// <summary>
         /// The stopwatch
         /// The stopwatch
         /// </summary>
         /// </summary>
-        readonly Stopwatch stopwatch;
+        readonly Stopwatch _stopwatch;
 
 
         /// <summary>
         /// <summary>
         /// The _logger
         /// The _logger
         /// </summary>
         /// </summary>
-        private ILogger _logger;
+        private readonly ILogger _logger;
 
 
         /// <summary>
         /// <summary>
         /// Initializes a new instance of the <see cref="Profiler" /> class.
         /// Initializes a new instance of the <see cref="Profiler" /> class.
@@ -30,12 +30,12 @@ namespace MediaBrowser.Controller.Library
         /// <param name="logger">The logger.</param>
         /// <param name="logger">The logger.</param>
         public Profiler(string name, ILogger logger)
         public Profiler(string name, ILogger logger)
         {
         {
-            this.name = name;
+            this._name = name;
 
 
             _logger = logger;
             _logger = logger;
 
 
-            stopwatch = new Stopwatch();
-            stopwatch.Start();
+            _stopwatch = new Stopwatch();
+            _stopwatch.Start();
         }
         }
         #region IDisposable Members
         #region IDisposable Members
 
 
@@ -56,17 +56,17 @@ namespace MediaBrowser.Controller.Library
         {
         {
             if (dispose)
             if (dispose)
             {
             {
-                stopwatch.Stop();
+                _stopwatch.Stop();
                 string message;
                 string message;
-                if (stopwatch.ElapsedMilliseconds > 300000)
+                if (_stopwatch.ElapsedMilliseconds > 300000)
                 {
                 {
                     message = string.Format("{0} took {1} minutes.",
                     message = string.Format("{0} took {1} minutes.",
-                        name, ((float)stopwatch.ElapsedMilliseconds / 60000).ToString("F"));
+                        _name, ((float)_stopwatch.ElapsedMilliseconds / 60000).ToString("F"));
                 }
                 }
                 else
                 else
                 {
                 {
                     message = string.Format("{0} took {1} seconds.",
                     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);
                 _logger.Info(message);
             }
             }

+ 1 - 3
MediaBrowser.Controller/Library/TVUtils.cs

@@ -277,9 +277,7 @@ namespace MediaBrowser.Controller.Library
                                };
                                };
                 }
                 }
 
 
-                return new List<DayOfWeek>
-                               {
-                               };
+                return new List<DayOfWeek>();
             }
             }
             return null;
             return null;
         }
         }

+ 2 - 5
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.Collections.Concurrent;
 using System.Globalization;
 using System.Globalization;
 using System.IO;
 using System.IO;
 using System.Linq;
 using System.Linq;
 using System.Reflection;
 using System.Reflection;
-using System.Xml.Serialization;
 
 
 namespace MediaBrowser.Controller.Localization
 namespace MediaBrowser.Controller.Localization
 {
 {
@@ -30,7 +27,7 @@ namespace MediaBrowser.Controller.Localization
         /// </summary>
         /// </summary>
         private static LocalizedStrings _instance;
         private static LocalizedStrings _instance;
 
 
-        private IServerApplicationPaths _appPaths;
+        private readonly IServerApplicationPaths _appPaths;
 
 
         /// <summary>
         /// <summary>
         /// Gets the instance.
         /// Gets the instance.

+ 7 - 10
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.Collections.Generic;
 using System.IO;
 using System.IO;
 using System.Linq;
 using System.Linq;
@@ -44,17 +42,16 @@ namespace MediaBrowser.Controller.Localization
         /// <param name="key">The key.</param>
         /// <param name="key">The key.</param>
         /// <param name="value">The value.</param>
         /// <param name="value">The value.</param>
         /// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
         /// <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))
             if (dictionary.ContainsKey(key))
             {
             {
-                return false;
+                return;
             }
             }
 
 
             dictionary.Add(key, value);
             dictionary.Add(key, value);
-            return true;
         }
         }
-        
+
         /// <summary>
         /// <summary>
         /// Initializes the specified block unrated.
         /// Initializes the specified block unrated.
         /// </summary>
         /// </summary>
@@ -65,7 +62,7 @@ namespace MediaBrowser.Controller.Localization
             //build our ratings dictionary from the combined local one and us one
             //build our ratings dictionary from the combined local one and us one
             ratingsDef = new RatingsDefinition(Path.Combine(configurationManager.ApplicationPaths.LocalizationPath, "Ratings-" + configurationManager.Configuration.MetadataCountryCode + ".txt"), configurationManager);
             ratingsDef = new RatingsDefinition(Path.Combine(configurationManager.ApplicationPaths.LocalizationPath, "Ratings-" + configurationManager.Configuration.MetadataCountryCode + ".txt"), configurationManager);
             //global value of None
             //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)
             foreach (var pair in ratingsDef.RatingsDict)
             {
             {
                 TryAdd(dict, pair.Key, pair.Value);
                 TryAdd(dict, pair.Key, pair.Value);
@@ -85,7 +82,7 @@ namespace MediaBrowser.Controller.Localization
             //and rating reverse lookup dictionary (non-redundant ones)
             //and rating reverse lookup dictionary (non-redundant ones)
             ratingsStrings.Clear();
             ratingsStrings.Clear();
             var lastLevel = -10;
             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))
             foreach (var pair in ratingsDef.RatingsDict.OrderBy(p => p.Value))
             {
             {
                 if (pair.Value > lastLevel)
                 if (pair.Value > lastLevel)
@@ -147,7 +144,7 @@ namespace MediaBrowser.Controller.Localization
         public static string ToString(int level)
         public static string ToString(int level)
         {
         {
             //return the closest one
             //return the closest one
-            while (level > 0) 
+            while (level > 0)
             {
             {
                 if (ratingsStrings.ContainsKey(level))
                 if (ratingsStrings.ContainsKey(level))
                     return ratingsStrings[level];
                     return ratingsStrings[level];

+ 0 - 2
MediaBrowser.Controller/Localization/RatingsDefinition.cs

@@ -1,5 +1,4 @@
 using MediaBrowser.Controller.Configuration;
 using MediaBrowser.Controller.Configuration;
-using MediaBrowser.Model.Logging;
 using System;
 using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
 using System.IO;
 using System.IO;
@@ -15,7 +14,6 @@ namespace MediaBrowser.Controller.Localization
         /// Initializes a new instance of the <see cref="RatingsDefinition" /> class.
         /// Initializes a new instance of the <see cref="RatingsDefinition" /> class.
         /// </summary>
         /// </summary>
         /// <param name="file">The file.</param>
         /// <param name="file">The file.</param>
-        /// <param name="logger">The logger.</param>
         /// <param name="configurationManager">The configuration manager.</param>
         /// <param name="configurationManager">The configuration manager.</param>
         public RatingsDefinition(string file, IServerConfigurationManager configurationManager)
         public RatingsDefinition(string file, IServerConfigurationManager configurationManager)
         {
         {

+ 1 - 2
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.Entities;
 using MediaBrowser.Model.Logging;
 using MediaBrowser.Model.Logging;
 using System;
 using System;

+ 1 - 0
MediaBrowser.Controller/Providers/MediaInfo/FFMpegVideoImageProvider.cs

@@ -27,6 +27,7 @@ namespace MediaBrowser.Controller.Providers.MediaInfo
         /// <param name="isoManager">The iso manager.</param>
         /// <param name="isoManager">The iso manager.</param>
         /// <param name="logManager">The log manager.</param>
         /// <param name="logManager">The log manager.</param>
         /// <param name="configurationManager">The configuration 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)
         public FfMpegVideoImageProvider(IIsoManager isoManager, ILogManager logManager, IServerConfigurationManager configurationManager, IMediaEncoder mediaEncoder)
             : base(logManager, configurationManager, mediaEncoder)
             : base(logManager, configurationManager, mediaEncoder)
         {
         {

+ 3 - 4
MediaBrowser.Controller/Providers/MediaInfo/FFProbeVideoInfoProvider.cs

@@ -309,7 +309,7 @@ namespace MediaBrowser.Controller.Providers.MediaInfo
             long currentChapterTicks = 0;
             long currentChapterTicks = 0;
             var index = 1;
             var index = 1;
 
 
-            var chapters = new List<ChapterInfo> { };
+            var chapters = new List<ChapterInfo>();
 
 
             while (currentChapterTicks < runtime)
             while (currentChapterTicks < runtime)
             {
             {
@@ -372,7 +372,7 @@ namespace MediaBrowser.Controller.Providers.MediaInfo
             }
             }
 
 
             // Fill video properties from the BDInfo result
             // Fill video properties from the BDInfo result
-            Fetch(video, inputPath, result);
+            Fetch(video, result);
 
 
             videoStream = video.MediaStreams.FirstOrDefault(s => s.Type == MediaStreamType.Video);
             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
         /// Fills video properties from the VideoStream of the largest playlist
         /// </summary>
         /// </summary>
         /// <param name="video">The video.</param>
         /// <param name="video">The video.</param>
-        /// <param name="inputPath">The input path.</param>
         /// <param name="stream">The stream.</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/zero
             // Check all input for null/empty/zero
 
 

+ 2 - 3
MediaBrowser.Controller/Providers/Movies/FanArtMovieProvider.cs

@@ -19,8 +19,6 @@ namespace MediaBrowser.Controller.Providers.Movies
     /// </summary>
     /// </summary>
     class FanArtMovieProvider : FanartBaseProvider, IDisposable
     class FanArtMovieProvider : FanartBaseProvider, IDisposable
     {
     {
-        internal static FanArtMovieProvider Current { get; private set; }
-
         /// <summary>
         /// <summary>
         /// Gets the HTTP client.
         /// Gets the HTTP client.
         /// </summary>
         /// </summary>
@@ -28,13 +26,14 @@ namespace MediaBrowser.Controller.Providers.Movies
         protected IHttpClient HttpClient { get; private set; }
         protected IHttpClient HttpClient { get; private set; }
 
 
         private readonly IProviderManager _providerManager;
         private readonly IProviderManager _providerManager;
-        
+
         /// <summary>
         /// <summary>
         /// Initializes a new instance of the <see cref="FanArtMovieProvider" /> class.
         /// Initializes a new instance of the <see cref="FanArtMovieProvider" /> class.
         /// </summary>
         /// </summary>
         /// <param name="httpClient">The HTTP client.</param>
         /// <param name="httpClient">The HTTP client.</param>
         /// <param name="logManager">The log manager.</param>
         /// <param name="logManager">The log manager.</param>
         /// <param name="configurationManager">The configuration manager.</param>
         /// <param name="configurationManager">The configuration manager.</param>
+        /// <param name="providerManager">The provider manager.</param>
         /// <exception cref="System.ArgumentNullException">httpClient</exception>
         /// <exception cref="System.ArgumentNullException">httpClient</exception>
         public FanArtMovieProvider(IHttpClient httpClient, ILogManager logManager, IServerConfigurationManager configurationManager, IProviderManager providerManager)
         public FanArtMovieProvider(IHttpClient httpClient, ILogManager logManager, IServerConfigurationManager configurationManager, IProviderManager providerManager)
             : base(logManager, configurationManager)
             : base(logManager, configurationManager)

+ 2 - 1
MediaBrowser.Controller/Providers/Movies/MovieDbProvider.cs

@@ -60,6 +60,7 @@ namespace MediaBrowser.Controller.Providers.Movies
         /// <param name="configurationManager">The configuration manager.</param>
         /// <param name="configurationManager">The configuration manager.</param>
         /// <param name="jsonSerializer">The json serializer.</param>
         /// <param name="jsonSerializer">The json serializer.</param>
         /// <param name="httpClient">The HTTP client.</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)
         public MovieDbProvider(ILogManager logManager, IServerConfigurationManager configurationManager, IJsonSerializer jsonSerializer, IHttpClient httpClient, IProviderManager providerManager)
             : base(logManager, configurationManager)
             : base(logManager, configurationManager)
         {
         {
@@ -157,7 +158,7 @@ namespace MediaBrowser.Controller.Providers.Movies
         {
         {
             try
             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);
                     return jsonSerializer.DeserializeFromStream<TmdbSettingsResult>(json);
                 }
                 }

+ 4 - 7
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.Configuration;
 using MediaBrowser.Controller.Entities;
 using MediaBrowser.Controller.Entities;
 using MediaBrowser.Controller.Entities.Audio;
 using MediaBrowser.Controller.Entities.Audio;
 using MediaBrowser.Model.Entities;
 using MediaBrowser.Model.Entities;
 using MediaBrowser.Model.Logging;
 using MediaBrowser.Model.Logging;
-using MediaBrowser.Common.Extensions;
+using System;
+using System.Threading;
+using System.Threading.Tasks;
 
 
 namespace MediaBrowser.Controller.Providers.Music
 namespace MediaBrowser.Controller.Providers.Music
 {
 {

+ 2 - 4
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.Common.Net;
 using MediaBrowser.Controller.Configuration;
 using MediaBrowser.Controller.Configuration;
 using MediaBrowser.Controller.Entities;
 using MediaBrowser.Controller.Entities;
 using MediaBrowser.Controller.Entities.Audio;
 using MediaBrowser.Controller.Entities.Audio;
-using MediaBrowser.Controller.Entities.Movies;
 using MediaBrowser.Model.Entities;
 using MediaBrowser.Model.Entities;
 using MediaBrowser.Model.Logging;
 using MediaBrowser.Model.Logging;
 using MediaBrowser.Model.Net;
 using MediaBrowser.Model.Net;
 using System;
 using System;
+using System.Collections.Generic;
 using System.IO;
 using System.IO;
 using System.Threading;
 using System.Threading;
 using System.Threading.Tasks;
 using System.Threading.Tasks;

+ 1 - 1
MediaBrowser.Controller/Providers/Music/LastfmAlbumProvider.cs

@@ -36,7 +36,7 @@ namespace MediaBrowser.Controller.Providers.Music
             // Get albu info using artist and album name
             // Get albu info using artist and album name
             var url = RootUrl + string.Format("method=album.getInfo&artist={0}&album={1}&api_key={2}&format=json", UrlEncode(item.Parent.Name), UrlEncode(item.Name), ApiKey);
             var 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
             try
             {
             {

+ 8 - 12
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.Controller.Configuration;
-using MediaBrowser.Model.Entities;
 using MediaBrowser.Controller.Entities;
 using MediaBrowser.Controller.Entities;
 using MediaBrowser.Controller.Entities.Audio;
 using MediaBrowser.Controller.Entities.Audio;
 using MediaBrowser.Model.Logging;
 using MediaBrowser.Model.Logging;
 using MediaBrowser.Model.Net;
 using MediaBrowser.Model.Net;
 using MediaBrowser.Model.Serialization;
 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
 namespace MediaBrowser.Controller.Providers.Music
 {
 {
@@ -28,7 +24,7 @@ namespace MediaBrowser.Controller.Providers.Music
             LocalMetaFileName = LastfmHelper.LocalArtistMetaFileName;
             LocalMetaFileName = 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 want
             //Execute the Artist search against our name and assume first one is the one we want
             var url = RootUrl + string.Format("method=artist.search&artist={0}&api_key={1}&format=json", UrlEncode(item.Name), ApiKey);
             var 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;
             return item is MusicArtist;
         }
         }

+ 6 - 14
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 MediaBrowser.Model.Entities;
 using System;
 using System;
 
 
@@ -17,19 +16,12 @@ namespace MediaBrowser.Controller.Providers.Music
             artist.Overview = overview;
             artist.Overview = overview;
 
 
             var yearFormed = 0;
             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.PremiereDate = yearFormed > 0 ? new DateTime(yearFormed, 1,1) : DateTime.MinValue;
             artist.ProductionYear = yearFormed;
             artist.ProductionYear = yearFormed;
             if (data.tags != null)
             if (data.tags != null)
@@ -46,7 +38,7 @@ namespace MediaBrowser.Controller.Providers.Music
 
 
             item.Overview = overview;
             item.Overview = overview;
 
 
-            var release = DateTime.MinValue;
+            DateTime release;
             DateTime.TryParse(data.releasedate, out release);
             DateTime.TryParse(data.releasedate, out release);
             item.PremiereDate = release;
             item.PremiereDate = release;
             item.ProductionYear = release.Year;
             item.ProductionYear = release.Year;

+ 5 - 9
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;
 using MediaBrowser.Controller.Entities.Audio;
 using MediaBrowser.Controller.Entities.Audio;
 using MediaBrowser.Model.Entities;
 using MediaBrowser.Model.Entities;
 using MediaBrowser.Model.Logging;
 using MediaBrowser.Model.Logging;
 using MediaBrowser.Model.Serialization;
 using MediaBrowser.Model.Serialization;
+using System;
+using System.IO;
+using System.Threading;
+using System.Threading.Tasks;
 
 
 namespace MediaBrowser.Controller.Providers.Music
 namespace MediaBrowser.Controller.Providers.Music
 {
 {

+ 0 - 1
MediaBrowser.Controller/Providers/TV/FanArtTVProvider.cs

@@ -3,7 +3,6 @@ using MediaBrowser.Common.Net;
 using MediaBrowser.Controller.Configuration;
 using MediaBrowser.Controller.Configuration;
 using MediaBrowser.Controller.Entities;
 using MediaBrowser.Controller.Entities;
 using MediaBrowser.Controller.Entities.TV;
 using MediaBrowser.Controller.Entities.TV;
-using MediaBrowser.Controller.Providers.Movies;
 using MediaBrowser.Model.Entities;
 using MediaBrowser.Model.Entities;
 using MediaBrowser.Model.Logging;
 using MediaBrowser.Model.Logging;
 using MediaBrowser.Model.Net;
 using MediaBrowser.Model.Net;

+ 1 - 0
MediaBrowser.Controller/Providers/TV/RemoteEpisodeProvider.cs

@@ -148,6 +148,7 @@ namespace MediaBrowser.Controller.Providers.TV
         /// </summary>
         /// </summary>
         /// <param name="episode">The episode.</param>
         /// <param name="episode">The episode.</param>
         /// <param name="seriesId">The series id.</param>
         /// <param name="seriesId">The series id.</param>
+        /// <param name="cancellationToken">The cancellation token.</param>
         /// <returns>Task{System.Boolean}.</returns>
         /// <returns>Task{System.Boolean}.</returns>
         private async Task<bool> FetchEpisodeData(Episode episode, string seriesId, CancellationToken cancellationToken)
         private async Task<bool> FetchEpisodeData(Episode episode, string seriesId, CancellationToken cancellationToken)
         {
         {

+ 1 - 0
MediaBrowser.Controller/Providers/TV/RemoteSeriesProvider.cs

@@ -45,6 +45,7 @@ namespace MediaBrowser.Controller.Providers.TV
         /// <param name="httpClient">The HTTP client.</param>
         /// <param name="httpClient">The HTTP client.</param>
         /// <param name="logManager">The log manager.</param>
         /// <param name="logManager">The log manager.</param>
         /// <param name="configurationManager">The configuration manager.</param>
         /// <param name="configurationManager">The configuration manager.</param>
+        /// <param name="providerManager">The provider manager.</param>
         /// <exception cref="System.ArgumentNullException">httpClient</exception>
         /// <exception cref="System.ArgumentNullException">httpClient</exception>
         public RemoteSeriesProvider(IHttpClient httpClient, ILogManager logManager, IServerConfigurationManager configurationManager, IProviderManager providerManager)
         public RemoteSeriesProvider(IHttpClient httpClient, ILogManager logManager, IServerConfigurationManager configurationManager, IProviderManager providerManager)
             : base(logManager, configurationManager)
             : base(logManager, configurationManager)