From 8b7c624d09f533e12c786709d44b0325832596ce Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Sun, 19 Jun 2011 20:25:04 -0700 Subject: [PATCH] Reformated some files --- NzbDrone.Core/Providers/DiskScanProvider.cs | 35 +++++++------------- NzbDrone.Core/Providers/MediaFileProvider.cs | 28 ++++------------ 2 files changed, 19 insertions(+), 44 deletions(-) diff --git a/NzbDrone.Core/Providers/DiskScanProvider.cs b/NzbDrone.Core/Providers/DiskScanProvider.cs index 996be81b7..49a491129 100644 --- a/NzbDrone.Core/Providers/DiskScanProvider.cs +++ b/NzbDrone.Core/Providers/DiskScanProvider.cs @@ -2,33 +2,28 @@ using System.Collections.Generic; using System.IO; using System.Linq; -using System.Text; using Ninject; using NLog; -using NzbDrone.Core.Helpers; -using NzbDrone.Core.Model.Notification; using NzbDrone.Core.Providers.Core; using NzbDrone.Core.Repository; -using NzbDrone.Core.Repository.Quality; using PetaPoco; namespace NzbDrone.Core.Providers { public class DiskScanProvider { - private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); - private static readonly string[] MediaExtentions = new[] { ".mkv", ".avi", ".wmv", ".mp4" }; + private static readonly string[] MediaExtentions = new[] {".mkv", ".avi", ".wmv", ".mp4"}; + private readonly IDatabase _database; private readonly DiskProvider _diskProvider; private readonly EpisodeProvider _episodeProvider; - private readonly SeriesProvider _seriesProvider; private readonly MediaFileProvider _mediaFileProvider; - private readonly IDatabase _database; + private readonly SeriesProvider _seriesProvider; [Inject] public DiskScanProvider(DiskProvider diskProvider, EpisodeProvider episodeProvider, - SeriesProvider seriesProvider, MediaFileProvider mediaFileProvider, - IDatabase database) + SeriesProvider seriesProvider, MediaFileProvider mediaFileProvider, + IDatabase database) { _diskProvider = diskProvider; _episodeProvider = episodeProvider; @@ -40,7 +35,6 @@ namespace NzbDrone.Core.Providers public DiskScanProvider() { - } /// @@ -92,7 +86,7 @@ namespace NzbDrone.Core.Providers return null; } - var size = _diskProvider.GetSize(filePath); + long size = _diskProvider.GetSize(filePath); //If Size is less than 50MB and contains sample. Check for Size to ensure its not an episode with sample in the title if (size < 40000000 && filePath.ToLower().Contains("sample")) @@ -106,7 +100,7 @@ namespace NzbDrone.Core.Providers if (parseResult == null) return null; - parseResult.CleanTitle = series.Title;//replaces the nasty path as title to help with logging + parseResult.CleanTitle = series.Title; //replaces the nasty path as title to help with logging //Stores the list of episodes to add to the EpisodeFile var episodes = new List(); @@ -155,7 +149,7 @@ namespace NzbDrone.Core.Providers episodeFile.Quality = parseResult.Quality.QualityType; episodeFile.Proper = parseResult.Quality.Proper; episodeFile.SeasonNumber = parseResult.SeasonNumber; - var fileId = Convert.ToInt32(_database.Insert(episodeFile)); + int fileId = Convert.ToInt32(_database.Insert(episodeFile)); //This is for logging + updating the episodes that are linked to this EpisodeFile string episodeList = String.Empty; @@ -169,21 +163,18 @@ namespace NzbDrone.Core.Providers episodeList); return episodeFile; - } - - public virtual bool RenameEpisodeFile(EpisodeFile episodeFile) { if (episodeFile == null) throw new ArgumentNullException("episodeFile"); var series = _seriesProvider.GetSeries(episodeFile.SeriesId); - var ext = _diskProvider.GetExtension(episodeFile.Path); + string ext = _diskProvider.GetExtension(episodeFile.Path); var episodes = _episodeProvider.GetEpisodesByFileId(episodeFile.EpisodeFileId); - var newFileName = _mediaFileProvider.GetNewFilename(episodes, series.Title, episodeFile.Quality); + string newFileName = _mediaFileProvider.GetNewFilename(episodes, series.Title, episodeFile.Quality); var newFile = _mediaFileProvider.CalculateFilePath(series, episodes.First().SeasonNumber, newFileName, ext); @@ -199,9 +190,8 @@ namespace NzbDrone.Core.Providers } - /// - /// Removes files that no longer exist from the database + /// Removes files that no longer exist on disk from the database /// /// list of files to verify public virtual void CleanUp(List files) @@ -238,6 +228,5 @@ namespace NzbDrone.Core.Providers Logger.Debug("{0} media files were found in {1}", mediaFileList.Count, path); return mediaFileList; } - } -} +} \ No newline at end of file diff --git a/NzbDrone.Core/Providers/MediaFileProvider.cs b/NzbDrone.Core/Providers/MediaFileProvider.cs index d510949cb..732d3a18d 100644 --- a/NzbDrone.Core/Providers/MediaFileProvider.cs +++ b/NzbDrone.Core/Providers/MediaFileProvider.cs @@ -5,7 +5,6 @@ using System.Linq; using Ninject; using NLog; using NzbDrone.Core.Helpers; -using NzbDrone.Core.Model.Notification; using NzbDrone.Core.Providers.Core; using NzbDrone.Core.Repository; using NzbDrone.Core.Repository.Quality; @@ -16,9 +15,9 @@ namespace NzbDrone.Core.Providers public class MediaFileProvider { private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); - private readonly EpisodeProvider _episodeProvider; private readonly ConfigProvider _configProvider; private readonly IDatabase _database; + private readonly EpisodeProvider _episodeProvider; [Inject] public MediaFileProvider(EpisodeProvider episodeProvider, ConfigProvider configProvider, IDatabase database) @@ -28,15 +27,9 @@ namespace NzbDrone.Core.Providers _database = database; } - public MediaFileProvider() { } - - - - - - - - + public MediaFileProvider() + { + } public virtual void Update(EpisodeFile episodeFile) { @@ -70,7 +63,7 @@ namespace NzbDrone.Core.Providers public virtual FileInfo CalculateFilePath(Series series, int seasonNumber, string fileName, string extention) { - var path = series.Path; + string path = series.Path; if (series.SeasonFolder) { path = Path.Combine(path, "Season " + seasonNumber); @@ -81,15 +74,14 @@ namespace NzbDrone.Core.Providers return new FileInfo(path); } - public virtual string GetNewFilename(IList episodes, string seriesTitle, QualityTypes quality) { var separatorStyle = EpisodeSortingHelper.GetSeparatorStyle(_configProvider.SeparatorStyle); var numberStyle = EpisodeSortingHelper.GetNumberStyle(_configProvider.NumberStyle); - var episodeNames = episodes[0].Title; + string episodeNames = episodes[0].Title; - var result = String.Empty; + string result = String.Empty; if (_configProvider.SeriesName) { @@ -139,11 +131,5 @@ namespace NzbDrone.Core.Providers Logger.Debug("New File Name is: {0}", result.Trim()); return result.Trim(); } - - - - - - } } \ No newline at end of file