mirror of
https://github.com/Sonarr/Sonarr
synced 2024-12-25 09:18:34 +00:00
Refactored BacklogProvider
Fixed some issues with root folder and settings controller
This commit is contained in:
parent
e62cb3b5da
commit
613a49c3ea
5 changed files with 107 additions and 98 deletions
|
@ -148,7 +148,7 @@
|
||||||
<virtualDirectory path="/" physicalPath="%NZBDRONE_PATH%\NZBDrone.Web" />
|
<virtualDirectory path="/" physicalPath="%NZBDRONE_PATH%\NZBDrone.Web" />
|
||||||
</application>
|
</application>
|
||||||
<bindings>
|
<bindings>
|
||||||
<binding protocol="http" bindingInformation="*:8989:" />
|
<binding protocol="http" bindingInformation="*:8111:" />
|
||||||
</bindings>
|
</bindings>
|
||||||
</site>
|
</site>
|
||||||
<siteDefaults>
|
<siteDefaults>
|
||||||
|
|
|
@ -120,6 +120,24 @@ namespace NzbDrone.Core.Providers
|
||||||
_backlogSearchNotification.ProgressMax = _seriesList.Count;
|
_backlogSearchNotification.ProgressMax = _seriesList.Count;
|
||||||
|
|
||||||
foreach (var series in _seriesList)
|
foreach (var series in _seriesList)
|
||||||
|
{
|
||||||
|
BackLogSeries(series);
|
||||||
|
}
|
||||||
|
|
||||||
|
_backlogSearchNotification.CurrentStatus = "Backlog Search Completed";
|
||||||
|
Logger.Info("Backlog Search has successfully completed.");
|
||||||
|
Thread.Sleep(3000);
|
||||||
|
_backlogSearchNotification.Status = ProgressNotificationStatus.Completed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Logger.WarnException(ex.Message, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void BackLogSeries(Series series)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -132,6 +150,21 @@ namespace NzbDrone.Core.Providers
|
||||||
sceneNames.Add(series.Title);
|
sceneNames.Add(series.Title);
|
||||||
|
|
||||||
foreach (var season in series.Seasons)
|
foreach (var season in series.Seasons)
|
||||||
|
{
|
||||||
|
BackLogSeason(sceneNames, season);
|
||||||
|
}
|
||||||
|
//Done searching for each episode
|
||||||
|
}
|
||||||
|
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Logger.WarnException(ex.Message, ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
_backlogSearchNotification.ProgressValue++;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void BackLogSeason(List<string> sceneNames, Season season)
|
||||||
{
|
{
|
||||||
var episodesWithoutFiles = season.Episodes.Where(e => e.EpisodeFileId == 0);
|
var episodesWithoutFiles = season.Episodes.Where(e => e.EpisodeFileId == 0);
|
||||||
|
|
||||||
|
@ -176,36 +209,6 @@ namespace NzbDrone.Core.Providers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//Grab the episodes 1-by-1 (or in smaller chunks)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
//Done searching for each episode
|
|
||||||
}
|
|
||||||
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Logger.WarnException(ex.Message, ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
_backlogSearchNotification.ProgressValue++;
|
|
||||||
}
|
|
||||||
|
|
||||||
_backlogSearchNotification.CurrentStatus = "Backlog Search Completed";
|
|
||||||
Logger.Info("Backlog Search has successfully completed.");
|
|
||||||
Thread.Sleep(3000);
|
|
||||||
_backlogSearchNotification.Status = ProgressNotificationStatus.Completed;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Logger.WarnException(ex.Message, ex);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void GetUsersUrl(Indexer indexer, string searchString)
|
private void GetUsersUrl(Indexer indexer, string searchString)
|
||||||
|
|
|
@ -24,8 +24,8 @@ namespace NzbDrone.Web.Controllers
|
||||||
private IRootDirProvider _rootDirProvider;
|
private IRootDirProvider _rootDirProvider;
|
||||||
|
|
||||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||||
private string _settingsSaved = "Settings Saved.";
|
private const string SETTINGS_SAVED = "Settings Saved.";
|
||||||
private string _settingsFailed = "Error Saving Settings, please fix any errors";
|
private const string SETTINGS_FAILED = "Error Saving Settings, please fix any errors";
|
||||||
|
|
||||||
public SettingsController(IConfigProvider configProvider, IIndexerProvider indexerProvider,
|
public SettingsController(IConfigProvider configProvider, IIndexerProvider indexerProvider,
|
||||||
IQualityProvider qualityProvider, IRootDirProvider rootDirProvider)
|
IQualityProvider qualityProvider, IRootDirProvider rootDirProvider)
|
||||||
|
@ -53,7 +53,7 @@ namespace NzbDrone.Web.Controllers
|
||||||
|
|
||||||
return View("Index", new SettingsModel
|
return View("Index", new SettingsModel
|
||||||
{
|
{
|
||||||
Directories = new List<RootDir>()
|
Directories = _rootDirProvider.GetAll()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,11 +211,14 @@ namespace NzbDrone.Web.Controllers
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public ActionResult SaveGeneral(SettingsModel data)
|
public ActionResult SaveGeneral(SettingsModel data)
|
||||||
{
|
{
|
||||||
if (data.Directories.Count > 0)
|
if (data.Directories != null && data.Directories.Count > 0)
|
||||||
{
|
{
|
||||||
//If the Javascript was beaten we need to return an error
|
//If the Javascript was beaten we need to return an error
|
||||||
if (!data.Directories.Exists(d => d.Default))
|
|
||||||
return Content(_settingsFailed);
|
/*
|
||||||
|
* Kay.one: I can't see what its doing, all it does it dooesn't let me s.
|
||||||
|
* if (!data.Directories.Exists(d => d.Default))
|
||||||
|
return Content(SETTINGS_FAILED);*/
|
||||||
|
|
||||||
var currentRootDirs = _rootDirProvider.GetAll();
|
var currentRootDirs = _rootDirProvider.GetAll();
|
||||||
|
|
||||||
|
@ -235,10 +238,10 @@ namespace NzbDrone.Web.Controllers
|
||||||
_rootDirProvider.Update(dir);
|
_rootDirProvider.Update(dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Content(_settingsSaved);
|
return Content(SETTINGS_SAVED);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Content(_settingsFailed);
|
return Content(SETTINGS_FAILED);
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
|
@ -257,10 +260,10 @@ namespace NzbDrone.Web.Controllers
|
||||||
_configProvider.SetValue("NzbsrusUId", data.NzbsrusUId);
|
_configProvider.SetValue("NzbsrusUId", data.NzbsrusUId);
|
||||||
_configProvider.SetValue("NzbsrusHash", data.NzbsrusHash);
|
_configProvider.SetValue("NzbsrusHash", data.NzbsrusHash);
|
||||||
|
|
||||||
return Content(_settingsSaved);
|
return Content(SETTINGS_SAVED);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Content(_settingsFailed);
|
return Content(SETTINGS_FAILED);
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
|
@ -281,10 +284,10 @@ namespace NzbDrone.Web.Controllers
|
||||||
_configProvider.SetValue("UseBlackhole", data.UseBlackHole.ToString());
|
_configProvider.SetValue("UseBlackhole", data.UseBlackHole.ToString());
|
||||||
_configProvider.SetValue("BlackholeDirectory", data.BlackholeDirectory);
|
_configProvider.SetValue("BlackholeDirectory", data.BlackholeDirectory);
|
||||||
|
|
||||||
return Content(_settingsSaved);
|
return Content(SETTINGS_SAVED);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Content(_settingsFailed);
|
return Content(SETTINGS_FAILED);
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
|
@ -296,7 +299,7 @@ namespace NzbDrone.Web.Controllers
|
||||||
|
|
||||||
//Saves only the Default Quality, skips User Profiles since none exist
|
//Saves only the Default Quality, skips User Profiles since none exist
|
||||||
if (data.UserProfiles == null)
|
if (data.UserProfiles == null)
|
||||||
return Content(_settingsSaved);
|
return Content(SETTINGS_SAVED);
|
||||||
|
|
||||||
foreach (var dbProfile in _qualityProvider.GetAllProfiles().Where(q => q.UserProfile))
|
foreach (var dbProfile in _qualityProvider.GetAllProfiles().Where(q => q.UserProfile))
|
||||||
{
|
{
|
||||||
|
@ -326,11 +329,11 @@ namespace NzbDrone.Web.Controllers
|
||||||
else
|
else
|
||||||
_qualityProvider.Add(profile);
|
_qualityProvider.Add(profile);
|
||||||
|
|
||||||
return Content(_settingsSaved);
|
return Content(SETTINGS_SAVED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Content(_settingsFailed);
|
return Content(SETTINGS_FAILED);
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
|
@ -353,10 +356,10 @@ namespace NzbDrone.Web.Controllers
|
||||||
_configProvider.SetValue("XbmcUsername", data.XbmcUsername);
|
_configProvider.SetValue("XbmcUsername", data.XbmcUsername);
|
||||||
_configProvider.SetValue("XbmcPassword", data.XbmcPassword);
|
_configProvider.SetValue("XbmcPassword", data.XbmcPassword);
|
||||||
|
|
||||||
return Content(_settingsSaved);
|
return Content(SETTINGS_SAVED);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Content(_settingsFailed);
|
return Content(SETTINGS_FAILED);
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
|
@ -375,10 +378,10 @@ namespace NzbDrone.Web.Controllers
|
||||||
_configProvider.SetValue("Sorting_NumberStyle", data.NumberStyle.ToString());
|
_configProvider.SetValue("Sorting_NumberStyle", data.NumberStyle.ToString());
|
||||||
_configProvider.SetValue("Sorting_MultiEpisodeStyle", data.MultiEpisodeStyle.ToString());
|
_configProvider.SetValue("Sorting_MultiEpisodeStyle", data.MultiEpisodeStyle.ToString());
|
||||||
|
|
||||||
return Content(_settingsSaved);
|
return Content(SETTINGS_SAVED);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Content(_settingsFailed);
|
return Content(SETTINGS_FAILED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using EnvDTE;
|
||||||
using EnvDTE80;
|
using EnvDTE80;
|
||||||
|
|
||||||
namespace NzbDrone
|
namespace NzbDrone
|
||||||
|
@ -21,6 +22,8 @@ namespace NzbDrone
|
||||||
ManagedAndNative
|
ManagedAndNative
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private enum AttachResult
|
private enum AttachResult
|
||||||
{
|
{
|
||||||
Attached,
|
Attached,
|
||||||
|
|
|
@ -4,6 +4,6 @@
|
||||||
<supportedRuntime version="v4.0" />
|
<supportedRuntime version="v4.0" />
|
||||||
</startup>
|
</startup>
|
||||||
<appSettings>
|
<appSettings>
|
||||||
<add key="port" value="8989" />
|
<add key="port" value="8111" />
|
||||||
</appSettings>
|
</appSettings>
|
||||||
</configuration>
|
</configuration>
|
Loading…
Reference in a new issue