mirror of https://github.com/Sonarr/Sonarr
Attach to debugger is a lot more reliable.
Added system/config ui rss job only runs enabled jobs fixed wrong mappings for indexers in settingscontroller
This commit is contained in:
parent
8ec72ed432
commit
fd32a04d45
|
@ -1,4 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Core.Repository;
|
using NzbDrone.Core.Repository;
|
||||||
using SubSonic.Repository;
|
using SubSonic.Repository;
|
||||||
|
@ -15,6 +17,11 @@ namespace NzbDrone.Core.Providers.Core
|
||||||
_sonicRepo = dataRepository;
|
_sonicRepo = dataRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IList<Config> All()
|
||||||
|
{
|
||||||
|
return _sonicRepo.All<Config>().ToList();
|
||||||
|
}
|
||||||
|
|
||||||
public ConfigProvider()
|
public ConfigProvider()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ namespace NzbDrone.Core.Providers.Indexer
|
||||||
protected abstract string[] Urls { get; }
|
protected abstract string[] Urls { get; }
|
||||||
|
|
||||||
|
|
||||||
protected IndexerSetting Settings
|
public IndexerSetting Settings
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
|
|
@ -30,7 +30,7 @@ namespace NzbDrone.Core.Providers.Jobs
|
||||||
|
|
||||||
public void Start(ProgressNotification notification, int targetId)
|
public void Start(ProgressNotification notification, int targetId)
|
||||||
{
|
{
|
||||||
foreach (var indexer in _indexers)
|
foreach (var indexer in _indexers.Where(i => i.Settings.Enable))
|
||||||
{
|
{
|
||||||
indexer.Fetch();
|
indexer.Fetch();
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,11 +66,11 @@ namespace NzbDrone.Web.Controllers
|
||||||
NzbMatrixApiKey =
|
NzbMatrixApiKey =
|
||||||
_configProvider.GetValue("NzbMatrixApiKey", String.Empty, true),
|
_configProvider.GetValue("NzbMatrixApiKey", String.Empty, true),
|
||||||
|
|
||||||
NzbsrusUId = _configProvider.GetValue("NzbsrusUId", String.Empty, true),
|
NzbsrusUId = _configProvider.NzbsrusUId,
|
||||||
NzbsrusHash = _configProvider.GetValue("NzbsrusHash", String.Empty, true),
|
NzbsrusHash = _configProvider.NzbsrusHash,
|
||||||
|
|
||||||
NzbsOrgHash = _configProvider.NzbsrusHash,
|
NzbsOrgHash = _configProvider.NzbsOrgHash,
|
||||||
NzbsOrgUId = _configProvider.NzbsrusUId,
|
NzbsOrgUId = _configProvider.NzbsOrgUId,
|
||||||
|
|
||||||
NewzbinUsername = _configProvider.NewzbinUsername,
|
NewzbinUsername = _configProvider.NewzbinUsername,
|
||||||
NewzbinPassword = _configProvider.NewzbinPassword,
|
NewzbinPassword = _configProvider.NewzbinPassword,
|
||||||
|
@ -214,7 +214,7 @@ namespace NzbDrone.Web.Controllers
|
||||||
{
|
{
|
||||||
Name = "New Profile",
|
Name = "New Profile",
|
||||||
UserProfile = true,
|
UserProfile = true,
|
||||||
Allowed = new List<QualityTypes> {QualityTypes.Unknown},
|
Allowed = new List<QualityTypes> { QualityTypes.Unknown },
|
||||||
Cutoff = QualityTypes.Unknown,
|
Cutoff = QualityTypes.Unknown,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -272,7 +272,7 @@ namespace NzbDrone.Web.Controllers
|
||||||
{
|
{
|
||||||
return new JsonResult { Data = "failed" };
|
return new JsonResult { Data = "failed" };
|
||||||
}
|
}
|
||||||
|
|
||||||
return new JsonResult { Data = "ok" };
|
return new JsonResult { Data = "ok" };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -333,14 +333,14 @@ namespace NzbDrone.Web.Controllers
|
||||||
newzbinSettings.Enable = data.NewzbinEnabled;
|
newzbinSettings.Enable = data.NewzbinEnabled;
|
||||||
_indexerProvider.SaveSettings(newzbinSettings);
|
_indexerProvider.SaveSettings(newzbinSettings);
|
||||||
|
|
||||||
_configProvider.NzbsrusHash = data.NzbsOrgHash;
|
|
||||||
_configProvider.NzbsOrgUId = data.NzbsOrgUId;
|
_configProvider.NzbsOrgUId = data.NzbsOrgUId;
|
||||||
|
_configProvider.NzbsOrgHash = data.NzbsOrgHash;
|
||||||
|
|
||||||
_configProvider.NzbMatrixUsername = data.NzbMatrixUsername;
|
_configProvider.NzbMatrixUsername = data.NzbMatrixUsername;
|
||||||
_configProvider.NzbMatrixApiKey = data.NzbMatrixApiKey;
|
_configProvider.NzbMatrixApiKey = data.NzbMatrixApiKey;
|
||||||
|
|
||||||
_configProvider.NzbsrusUId = data.NzbsrusUId;
|
_configProvider.NzbsrusUId = data.NzbsrusUId;
|
||||||
_configProvider.NzbsOrgUId = data.NzbsrusHash;
|
_configProvider.NzbsrusHash = data.NzbsrusHash;
|
||||||
|
|
||||||
_configProvider.NewzbinUsername = data.NewzbinUsername;
|
_configProvider.NewzbinUsername = data.NewzbinUsername;
|
||||||
_configProvider.NewzbinPassword = data.NewzbinPassword;
|
_configProvider.NewzbinPassword = data.NewzbinPassword;
|
||||||
|
@ -402,7 +402,7 @@ namespace NzbDrone.Web.Controllers
|
||||||
return Content("Error Saving Settings, please fix any errors");
|
return Content("Error Saving Settings, please fix any errors");
|
||||||
//profile.Cutoff = profile.Allowed.Last();
|
//profile.Cutoff = profile.Allowed.Last();
|
||||||
|
|
||||||
_qualityProvider.Update(profile);
|
_qualityProvider.Update(profile);
|
||||||
}
|
}
|
||||||
return Content(SETTINGS_SAVED);
|
return Content(SETTINGS_SAVED);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ using System.Linq;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
using NzbDrone.Core.Providers;
|
using NzbDrone.Core.Providers;
|
||||||
|
using NzbDrone.Core.Providers.Core;
|
||||||
using NzbDrone.Core.Providers.Jobs;
|
using NzbDrone.Core.Providers.Jobs;
|
||||||
|
|
||||||
namespace NzbDrone.Web.Controllers
|
namespace NzbDrone.Web.Controllers
|
||||||
|
@ -12,11 +13,13 @@ namespace NzbDrone.Web.Controllers
|
||||||
{
|
{
|
||||||
private readonly JobProvider _jobProvider;
|
private readonly JobProvider _jobProvider;
|
||||||
private readonly IndexerProvider _indexerProvider;
|
private readonly IndexerProvider _indexerProvider;
|
||||||
|
private readonly ConfigProvider _configProvider;
|
||||||
|
|
||||||
public SystemController(JobProvider jobProvider, IndexerProvider indexerProvider)
|
public SystemController(JobProvider jobProvider, IndexerProvider indexerProvider, ConfigProvider configProvider)
|
||||||
{
|
{
|
||||||
_jobProvider = jobProvider;
|
_jobProvider = jobProvider;
|
||||||
_indexerProvider = indexerProvider;
|
_indexerProvider = indexerProvider;
|
||||||
|
_configProvider = configProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ActionResult Jobs()
|
public ActionResult Jobs()
|
||||||
|
@ -30,5 +33,11 @@ namespace NzbDrone.Web.Controllers
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public ActionResult Config()
|
||||||
|
{
|
||||||
|
return View(_configProvider.All());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -683,6 +683,7 @@
|
||||||
<Content Include="Views\Shared\Error.cshtml" />
|
<Content Include="Views\Shared\Error.cshtml" />
|
||||||
<Content Include="Views\Settings\UserProfileSection.cshtml" />
|
<Content Include="Views\Settings\UserProfileSection.cshtml" />
|
||||||
<Content Include="Views\System\Indexers.cshtml" />
|
<Content Include="Views\System\Indexers.cshtml" />
|
||||||
|
<Content Include="Views\System\Config.cshtml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="App_Data\" />
|
<Folder Include="App_Data\" />
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
@model IEnumerable<NzbDrone.Core.Repository.Config>
|
||||||
|
@section TitleContent{
|
||||||
|
Config
|
||||||
|
}
|
||||||
|
@section MainContent{
|
||||||
|
@{Html.Telerik().Grid(Model).Name("Grid")
|
||||||
|
.TableHtmlAttributes(new { @class = "Grid" })
|
||||||
|
.Render();}
|
||||||
|
}
|
|
@ -10,31 +10,27 @@ using System.Collections.Generic;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using EnvDTE;
|
using EnvDTE;
|
||||||
using EnvDTE80;
|
using EnvDTE80;
|
||||||
|
using NLog;
|
||||||
using Thread = System.Threading.Thread;
|
using Thread = System.Threading.Thread;
|
||||||
|
|
||||||
namespace NzbDrone
|
namespace NzbDrone
|
||||||
{
|
{
|
||||||
public class ProcessAttacher
|
public class ProcessAttacher
|
||||||
{
|
{
|
||||||
|
|
||||||
|
private static readonly Logger Logger = LogManager.GetLogger("Application");
|
||||||
|
|
||||||
|
|
||||||
public static void Attach()
|
public static void Attach()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 10; i++)
|
DTE2 dte2;
|
||||||
{
|
dte2 = (DTE2)Marshal.
|
||||||
try
|
GetActiveObject("VisualStudio.DTE.10.0");
|
||||||
{
|
|
||||||
DTE2 dte2;
|
var pa = new ProcessAttacher(dte2, "iisexpress", 10);
|
||||||
dte2 = (DTE2)Marshal.
|
pa.PessimisticAttachManaged();
|
||||||
GetActiveObject("VisualStudio.DTE.10.0");
|
return;
|
||||||
|
|
||||||
var pa = new ProcessAttacher(dte2, "iisexpress", 10);
|
|
||||||
pa.PessimisticAttachManaged();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
Thread.Sleep(500);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Get an instance of the currently running Visual Studio IDE.
|
// Get an instance of the currently running Visual Studio IDE.
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,22 +30,16 @@ namespace NzbDrone
|
||||||
IISController.StopServer();
|
IISController.StopServer();
|
||||||
IISController.StartServer();
|
IISController.StartServer();
|
||||||
|
|
||||||
Process.Start(IISController.AppUrl);
|
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
//Manually Attach debugger to IISExpress
|
Attach();
|
||||||
if (Debugger.IsAttached)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
ProcessAttacher.Attach();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Logger.Warn("Unable to attach to debugger", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Process.Start(IISController.AppUrl);
|
||||||
|
|
||||||
|
IISController.IISProcess.WaitForExit();
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -54,6 +48,38 @@ namespace NzbDrone
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void Attach()
|
||||||
|
{
|
||||||
|
if (Debugger.IsAttached)
|
||||||
|
{
|
||||||
|
Logger.Info("Trying to attach to debugger");
|
||||||
|
|
||||||
|
var count = 0;
|
||||||
|
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ProcessAttacher.Attach();
|
||||||
|
Logger.Info("Debugger Attached");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
count++;
|
||||||
|
if (count > 20)
|
||||||
|
{
|
||||||
|
Logger.WarnException("Unable to attach to debugger", e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Thread.Sleep(100);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private static void AppDomainException(object excepion)
|
private static void AppDomainException(object excepion)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue