Removed post processor from solution

pull/2/head
kay.one 14 years ago
parent 356650a1d3
commit 45fde370d8

@ -90,7 +90,6 @@ namespace NzbDrone.Core
_kernel.Bind<RootDirProvider>().ToSelf().InSingletonScope();
_kernel.Bind<ExternalNotificationProvider>().ToSelf().InSingletonScope();
_kernel.Bind<XbmcProvider>().ToSelf().InSingletonScope();
_kernel.Bind<PostProcessingProvider>().ToSelf().InSingletonScope();
_kernel.Bind<ConfigProvider>().To<ConfigProvider>().InSingletonScope();
_kernel.Bind<SyncProvider>().ToSelf().InSingletonScope();
_kernel.Bind<RenameProvider>().ToSelf().InSingletonScope();

@ -203,7 +203,6 @@
<Compile Include="Providers\HistoryProvider.cs" />
<Compile Include="Providers\BacklogProvider.cs" />
<Compile Include="Providers\IndexerProvider.cs" />
<Compile Include="Providers\PostProcessingProvider.cs" />
<Compile Include="Providers\QualityProvider.cs" />
<Compile Include="Providers\RenameProvider.cs" />
<Compile Include="Providers\RootDirProvider.cs" />

@ -25,9 +25,7 @@ namespace NzbDrone.Core.Providers
_episodeProvider = episodeProvider;
}
public MediaFileProvider()
{
}
public MediaFileProvider() { }
/// <summary>
/// Scans the specified series folder for media files
@ -47,24 +45,6 @@ namespace NzbDrone.Core.Providers
return fileList;
}
/// <summary>
/// Scans the specified series folder for media files
/// </summary>
/// <param name = "series">The series to be scanned</param>
public List<EpisodeFile> Scan(Series series, string path)
{
var mediaFileList = GetMediaFileList(path);
var fileList = new List<EpisodeFile>();
foreach (var filePath in mediaFileList)
{
var file = ImportFile(series, filePath);
if (file != null)
fileList.Add(file);
}
return fileList;
}
public EpisodeFile ImportFile(Series series, string filePath)
{
Logger.Trace("Importing file to database [{0}]", filePath);
@ -76,10 +56,11 @@ namespace NzbDrone.Core.Providers
//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"))
{
Logger.Trace("[{0}] appears to be a sample... skipping.", filePath);
Logger.Trace("[{0}] appears to be a sample. skipping.", filePath);
return null;
}
//Check to see if file already exists in the database
if (!_repository.Exists<EpisodeFile>(e => e.Path == Parser.NormalizePath(filePath)))
{
var parseResult = Parser.ParseEpisodeInfo(filePath);
@ -90,6 +71,7 @@ namespace NzbDrone.Core.Providers
//Stores the list of episodes to add to the EpisodeFile
var episodes = new List<Episode>();
//Check for daily shows
if (parseResult.Episodes == null)
{
var episode = _episodeProvider.GetEpisode(series.SeriesId, parseResult.AirDate.Date);
@ -98,9 +80,10 @@ namespace NzbDrone.Core.Providers
{
episodes.Add(episode);
}
else
{
Logger.Warn("Unable to find '{0}' in the database. File:{1}", parseResult, filePath);
}
}
else
{
@ -113,14 +96,15 @@ namespace NzbDrone.Core.Providers
{
episodes.Add(episode);
}
else
{
Logger.Warn("Unable to find '{0}' in the database. File:{1}", parseResult, filePath);
}
}
}
//Return null if no Episodes exist in the DB for the parsed episodes from file
if (episodes.Count < 1)
if (episodes.Count <= 0)
return null;
var episodeFile = new EpisodeFile();
@ -173,16 +157,7 @@ namespace NzbDrone.Core.Providers
}
}
public void DeleteFromDb(int fileId)
{
_repository.Delete<EpisodeFile>(fileId);
}
public void DeleteFromDisk(int fileId, string path)
{
_diskProvider.DeleteFile(path);
_repository.Delete<EpisodeFile>(fileId);
}
public void Update(EpisodeFile episodeFile)
{

@ -1,35 +0,0 @@
namespace NzbDrone.Core.Providers
{
public class PostProcessingProvider
{
private readonly MediaFileProvider _mediaFileProvider;
private readonly RenameProvider _renameProvider;
private readonly SeriesProvider _seriesProvider;
public PostProcessingProvider(SeriesProvider seriesProvider,
MediaFileProvider mediaFileProvider, RenameProvider renameProvider)
{
_seriesProvider = seriesProvider;
_mediaFileProvider = mediaFileProvider;
_renameProvider = renameProvider;
}
public virtual void ProcessEpisode(string dir, string nzbName)
{
var parsedSeries = Parser.ParseSeriesName(nzbName);
var series = _seriesProvider.FindSeries(parsedSeries);
if (series == null)
return;
//Import the files, and then rename the newly added ones.
var fileList = _mediaFileProvider.Scan(series, dir);
foreach (var file in fileList)
{
//Notifications will be sent from the Renamer, depending on the bool NewDownload (which will be set to true from here), a normal rename will be treated as such.
_renameProvider.RenameEpisodeFile(file.EpisodeFileId, true);
}
}
}
}

@ -1,37 +0,0 @@
using System.Web.Mvc;
using NLog;
using NzbDrone.Core.Providers;
using NzbDrone.Core.Providers.Core;
namespace NzbDrone.Web.Controllers
{
public class ApiController : Controller
{
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
private readonly ConfigProvider _configProvider;
private readonly PostProcessingProvider _postProcessingProvider;
public ApiController(PostProcessingProvider postProcessingProvider, ConfigProvider configProvider)
{
_postProcessingProvider = postProcessingProvider;
_configProvider = configProvider;
}
public ActionResult ProcessEpisode(string apiKey, string dir, string nzbName, string category)
{
if (apiKey != _configProvider.ApiKey)
{
Logger.Warn("API Key from Post Processing Script is Invalid");
return Content("Invalid API Key");
}
if (_configProvider.SabTvCategory == category)
{
_postProcessingProvider.ProcessEpisode(dir, nzbName);
return Content("ok");
}
return Content("Category doesn't match what was configured for SAB TV Category...");
}
}
}

@ -76,7 +76,7 @@ namespace NzbDrone.Web.Controllers
SeasonNumber = s.SeasonNumber,
SeasonString = GetSeasonString(s.SeasonNumber),
Monitored = s.Monitored
}).OrderBy(s=> s.SeasonNumber).ToList();
}).OrderBy(s => s.SeasonNumber).ToList();
return View(model);
}
@ -265,8 +265,7 @@ namespace NzbDrone.Web.Controllers
public ActionResult SyncEpisodesOnDisk(int seriesId)
{
//Syncs the episodes on disk for the specified series
var series = _seriesProvider.GetSeries(seriesId);
_mediaFileProvider.Scan(series);
_jobProvider.QueueJob(typeof(MediaFileScanJob), seriesId);
return RedirectToAction("Details", new { seriesId });
}

@ -214,7 +214,6 @@
<DesignTime>True</DesignTime>
<DependentUpon>UploadLocalization.en-US.resx</DependentUpon>
</Compile>
<Compile Include="Controllers\ApiController.cs" />
<Compile Include="Controllers\HistoryController.cs" />
<Compile Include="Controllers\LogController.cs" />
<Compile Include="Controllers\AddSeriesController.cs" />

@ -11,8 +11,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NzbDrone.Core.Test", "NzbDr
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{57A04B72-8088-4F75-A582-1158CF8291F7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NzbDrone.PostProcessor", "NzbDrone.PostProcessor\NzbDrone.PostProcessor.csproj", "{0C679573-736D-4F77-B934-FD8931AC1AA1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -79,17 +77,6 @@ Global
{193ADD3B-792B-4173-8E4C-5A3F8F0237F0}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{193ADD3B-792B-4173-8E4C-5A3F8F0237F0}.Release|x64.ActiveCfg = Release|Any CPU
{193ADD3B-792B-4173-8E4C-5A3F8F0237F0}.Release|x86.ActiveCfg = Release|Any CPU
{0C679573-736D-4F77-B934-FD8931AC1AA1}.Debug|Any CPU.ActiveCfg = Debug|x86
{0C679573-736D-4F77-B934-FD8931AC1AA1}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{0C679573-736D-4F77-B934-FD8931AC1AA1}.Debug|x64.ActiveCfg = Debug|x86
{0C679573-736D-4F77-B934-FD8931AC1AA1}.Debug|x86.ActiveCfg = Debug|x86
{0C679573-736D-4F77-B934-FD8931AC1AA1}.Debug|x86.Build.0 = Debug|x86
{0C679573-736D-4F77-B934-FD8931AC1AA1}.Release|Any CPU.ActiveCfg = Release|x86
{0C679573-736D-4F77-B934-FD8931AC1AA1}.Release|Mixed Platforms.ActiveCfg = Release|x86
{0C679573-736D-4F77-B934-FD8931AC1AA1}.Release|Mixed Platforms.Build.0 = Release|x86
{0C679573-736D-4F77-B934-FD8931AC1AA1}.Release|x64.ActiveCfg = Release|x86
{0C679573-736D-4F77-B934-FD8931AC1AA1}.Release|x86.ActiveCfg = Release|x86
{0C679573-736D-4F77-B934-FD8931AC1AA1}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

Loading…
Cancel
Save