Added ExternalNotificationProviderBase based on IndexProviderBase.

pull/2/head
Mark McDowall 14 years ago
parent 671dcd074c
commit a36d5fae2f

@ -10,6 +10,7 @@ using MbUnit.Framework;
using Moq;
using NzbDrone.Core.Providers;
using NzbDrone.Core.Providers.Core;
using NzbDrone.Core.Providers.ExternalNotification;
using NzbDrone.Core.Providers.Indexer;
using NzbDrone.Core.Repository;
using NzbDrone.Core.Repository.Quality;
@ -151,8 +152,13 @@ namespace NzbDrone.Core.Test
public class MockIndexerProvider : IndexerProviderBase
{
public MockIndexerProvider(SeriesProvider seriesProvider, SeasonProvider seasonProvider, EpisodeProvider episodeProvider, ConfigProvider configProvider, HttpProvider httpProvider, IndexerProvider indexerProvider, HistoryProvider historyProvider, SabProvider sabProvider)
: base(seriesProvider, seasonProvider, episodeProvider, configProvider, httpProvider, indexerProvider, historyProvider, sabProvider)
public MockIndexerProvider(SeriesProvider seriesProvider, SeasonProvider seasonProvider,
EpisodeProvider episodeProvider, ConfigProvider configProvider,
HttpProvider httpProvider, IndexerProvider indexerProvider,
HistoryProvider historyProvider, SabProvider sabProvider, IEnumerable<ExternalNotificationProviderBase> externalNotificationProvider)
: base(seriesProvider, seasonProvider, episodeProvider,
configProvider, httpProvider, indexerProvider, historyProvider,
sabProvider, externalNotificationProvider)
{
}
@ -180,8 +186,13 @@ namespace NzbDrone.Core.Test
public class TestUrlIndexer : IndexerProviderBase
{
public TestUrlIndexer(SeriesProvider seriesProvider, SeasonProvider seasonProvider, EpisodeProvider episodeProvider, ConfigProvider configProvider, HttpProvider httpProvider, IndexerProvider indexerProvider, HistoryProvider historyProvider, SabProvider sabProvider)
: base(seriesProvider, seasonProvider, episodeProvider, configProvider, httpProvider, indexerProvider, historyProvider, sabProvider)
public TestUrlIndexer(SeriesProvider seriesProvider, SeasonProvider seasonProvider,
EpisodeProvider episodeProvider, ConfigProvider configProvider,
HttpProvider httpProvider, IndexerProvider indexerProvider,
HistoryProvider historyProvider, SabProvider sabProvider, IEnumerable<ExternalNotificationProviderBase> externalNotificationProvider)
: base(seriesProvider, seasonProvider, episodeProvider,
configProvider, httpProvider, indexerProvider, historyProvider,
sabProvider, externalNotificationProvider)
{
}
@ -203,8 +214,13 @@ namespace NzbDrone.Core.Test
public class CustomParserIndexer : IndexerProviderBase
{
public CustomParserIndexer(SeriesProvider seriesProvider, SeasonProvider seasonProvider, EpisodeProvider episodeProvider, ConfigProvider configProvider, HttpProvider httpProvider, IndexerProvider indexerProvider, HistoryProvider historyProvider, SabProvider sabProvider)
: base(seriesProvider, seasonProvider, episodeProvider, configProvider, httpProvider, indexerProvider, historyProvider, sabProvider)
public CustomParserIndexer(SeriesProvider seriesProvider, SeasonProvider seasonProvider,
EpisodeProvider episodeProvider, ConfigProvider configProvider,
HttpProvider httpProvider, IndexerProvider indexerProvider,
HistoryProvider historyProvider, SabProvider sabProvider, IEnumerable<ExternalNotificationProviderBase> externalNotificationProvider)
: base(seriesProvider, seasonProvider, episodeProvider,
configProvider, httpProvider, indexerProvider, historyProvider,
sabProvider, externalNotificationProvider)
{
}

@ -9,6 +9,7 @@ using NLog;
using NzbDrone.Core.Instrumentation;
using NzbDrone.Core.Providers;
using NzbDrone.Core.Providers.Core;
using NzbDrone.Core.Providers.ExternalNotification;
using NzbDrone.Core.Providers.Indexer;
using NzbDrone.Core.Providers.Jobs;
using NzbDrone.Core.Repository;
@ -112,11 +113,10 @@ namespace NzbDrone.Core
BindIndexers();
BindJobs();
BindExternalNotifications();
}
}
private static void BindIndexers()
{
_kernel.Bind<IndexerProviderBase>().To<NzbsOrgProvider>().InSingletonScope();
@ -138,6 +138,12 @@ namespace NzbDrone.Core
_kernel.Get<WebTimer>().StartTimer(30);
}
private static void BindExternalNotifications()
{
_kernel.Bind<ExternalNotificationProviderBase>().To<XbmcNotificationProvider>().InSingletonScope();
var notifiers = _kernel.GetAll<ExternalNotificationProviderBase>();
_kernel.Get<ExternalNotificationProvider>().InitializeNotifiers(notifiers.ToList());
}
private static void ForceMigration(IRepository repository)
{
@ -232,7 +238,5 @@ namespace NzbDrone.Core
repository.Update(hd);
}
}
}
}

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace NzbDrone.Core.Model
{
public enum ExternalNotificationType
{
Grab = 0,
Download = 1,
Rename = 2
}
}

@ -166,8 +166,11 @@
<Compile Include="Instrumentation\SubsonicTarget.cs" />
<Compile Include="Instrumentation\ExceptioneerTarget.cs" />
<Compile Include="Instrumentation\NlogWriter.cs" />
<Compile Include="Model\ExternalNotificationType.cs" />
<Compile Include="Model\IndexerType.cs" />
<Compile Include="Model\SabnzbdInfoModel.cs" />
<Compile Include="Providers\ExternalNotification\ExternalNotificationProviderBase.cs" />
<Compile Include="Providers\ExternalNotification\XbmcNotificationProvider.cs" />
<Compile Include="Providers\Indexer\SyndicationFeedXmlReader.cs" />
<Compile Include="Providers\AutoConfigureProvider.cs" />
<Compile Include="Providers\Indexer\NzbMatrixProvider.cs" />
@ -180,6 +183,7 @@
<Compile Include="Providers\Jobs\RssSyncJob.cs" />
<Compile Include="Providers\Jobs\UpdateInfoJob.cs" />
<Compile Include="Providers\StatsProvider.cs" />
<Compile Include="Repository\ExternalNotificationSetting.cs" />
<Compile Include="Repository\JobSetting.cs" />
<Compile Include="Repository\IndexerSetting.cs" />
<Compile Include="Model\EpisodeParseResult.cs" />
@ -259,6 +263,7 @@
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

@ -120,7 +120,7 @@ namespace NzbDrone.Core
return parsedEpisode;
}
}
Logger.Debug("Unable to parse text into episode info. {0}", title);
Logger.Warn("Unable to parse text into episode info. {0}", title);
return null;
}

@ -0,0 +1,70 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NLog;
using NzbDrone.Core.Model;
using NzbDrone.Core.Providers.Core;
using NzbDrone.Core.Repository;
namespace NzbDrone.Core.Providers.ExternalNotification
{
public abstract class ExternalNotificationProviderBase
{
protected readonly Logger _logger;
protected readonly ConfigProvider _configProvider;
protected readonly ExternalNotificationProvider _externalNotificationProvider;
public ExternalNotificationProviderBase(ConfigProvider configProvider, ExternalNotificationProvider externalNotificationProvider)
{
_configProvider = configProvider;
_externalNotificationProvider = externalNotificationProvider;
_logger = LogManager.GetLogger(GetType().ToString());
}
/// <summary>
/// Gets the name for the notification provider
/// </summary>
public abstract string Name { get; }
public ExternalNotificationSetting Settings
{
get
{
return _externalNotificationProvider.GetSettings(GetType());
}
}
public virtual void Notify(ExternalNotificationType type, string message, int seriesId = 0)
{
if (type == ExternalNotificationType.Grab)
OnGrab(message);
else if (type == ExternalNotificationType.Download)
OnDownload(message, seriesId);
else if (type == ExternalNotificationType.Rename)
OnRename(message, seriesId);
}
/// <summary>
/// Performs the on grab action
/// </summary>
/// <param name = "message">The message to send to the receiver</param>
public abstract void OnGrab(string message);
/// <summary>
/// Performs the on download action
/// </summary>
/// <param name = "message">The message to send to the receiver</param>
/// <param name = "seriesId">The Series ID for the new download</param>
public abstract void OnDownload(string message, int seriesId);
/// <summary>
/// Performs the on rename action
/// </summary>
/// <param name = "message">The message to send to the receiver</param>
/// <param name = "seriesId">The Series ID for the new download</param>
public abstract void OnRename(string message, int seriesId);
}
}

@ -0,0 +1,97 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NLog;
using NzbDrone.Core.Helpers;
using NzbDrone.Core.Providers.Core;
namespace NzbDrone.Core.Providers.ExternalNotification
{
public class XbmcNotificationProvider : ExternalNotificationProviderBase
{
private readonly Logger _logger;
private readonly XbmcProvider _xbmcProvider;
public XbmcNotificationProvider(ConfigProvider configProvider, XbmcProvider xbmcProvider,
ExternalNotificationProvider externalNotificationProvider) : base(configProvider, externalNotificationProvider)
{
_xbmcProvider = xbmcProvider;
_logger = LogManager.GetLogger(GetType().ToString());
}
public override string Name
{
get { return "XBMC"; }
}
public override void OnGrab(string message)
{
var header = "NzbDrone [TV] - Grabbed";
if (Convert.ToBoolean(_configProvider.GetValue("XbmcEnabled", false, true)))
{
if (Convert.ToBoolean(_configProvider.GetValue("XbmcNotifyOnGrab", false, true)))
{
_logger.Trace("Sending Notifcation to XBMC");
_xbmcProvider.Notify(header, message);
return;
}
_logger.Trace("XBMC NotifyOnGrab is not enabled");
}
_logger.Trace("XBMC Notifier is not enabled");
}
public override void OnDownload(string message, int seriesId)
{
var header = "NzbDrone [TV] - Downloaded";
if (Convert.ToBoolean(_configProvider.GetValue("XbmcEnabled", false, true)))
{
if (Convert.ToBoolean(_configProvider.GetValue("XbmcNotifyOnDownload", false, true)))
{
_logger.Trace("Sending Notifcation to XBMC");
_xbmcProvider.Notify(header, message);
}
if (Convert.ToBoolean(_configProvider.GetValue("XbmcUpdateOnDownload", false, true)))
{
_logger.Trace("Sending Update Request to XBMC");
_xbmcProvider.Update(seriesId);
}
if (Convert.ToBoolean(_configProvider.GetValue("XbmcCleanOnDownload", false, true)))
{
_logger.Trace("Sending Clean DB Request to XBMC");
_xbmcProvider.Clean();
}
}
_logger.Trace("XBMC Notifier is not enabled");
}
public override void OnRename(string message, int seriesId)
{
var header = "NzbDrone [TV] - Renamed";
if (Convert.ToBoolean(_configProvider.GetValue("XbmcNotifyOnRename", false, true)))
{
_logger.Trace("Sending Notifcation to XBMC");
_xbmcProvider.Notify(header, message);
}
if (Convert.ToBoolean(_configProvider.GetValue("XbmcUpdateOnRename", false, true)))
{
_logger.Trace("Sending Update Request to XBMC");
_xbmcProvider.Update(seriesId);
}
if (Convert.ToBoolean(_configProvider.GetValue("XbmcCleanOnRename", false, true)))
{
_logger.Trace("Sending Clean DB Request to XBMC");
_xbmcProvider.Clean();
}
}
}
}

@ -1,98 +1,81 @@
using System;
using System.Collections.Generic;
using System.Linq;
using NLog;
using NzbDrone.Core.Helpers;
using NzbDrone.Core.Model;
using NzbDrone.Core.Providers.Core;
using NzbDrone.Core.Providers.ExternalNotification;
using NzbDrone.Core.Repository;
using SubSonic.Repository;
namespace NzbDrone.Core.Providers
{
public class ExternalNotificationProvider
{
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
private readonly ConfigProvider _configProvider;
private readonly XbmcProvider _xbmcProvider;
private readonly IRepository _repository;
public ExternalNotificationProvider(ConfigProvider configProvider, XbmcProvider xbmcProvider)
public ExternalNotificationProvider(IRepository repository)
{
_configProvider = configProvider;
_xbmcProvider = xbmcProvider;
_repository = repository;
}
public virtual void OnGrab(string message)
public ExternalNotificationProvider()
{
var header = "NzbDrone [TV] - Grabbed";
if (Convert.ToBoolean(_configProvider.GetValue("XbmcEnabled", false, true)))
{
if (Convert.ToBoolean(_configProvider.GetValue("XbmcNotifyOnGrab", false, true)))
{
Logger.Trace("Sending Notifcation to XBMC");
_xbmcProvider.Notify(header, message);
return;
}
Logger.Trace("XBMC NotifyOnGrab is not enabled");
}
Logger.Trace("XBMC Notifier is not enabled");
}
public virtual void OnDownload(EpisodeRenameModel erm)
public virtual List<ExternalNotificationSetting> All()
{
var header = "NzbDrone [TV] - Downloaded";
var message = EpisodeRenameHelper.GetNewName(erm);
return _repository.All<ExternalNotificationSetting>().ToList();
}
if (Convert.ToBoolean(_configProvider.GetValue("XbmcEnabled", false, true)))
public virtual void SaveSettings(ExternalNotificationSetting settings)
{
if (settings.Id == 0)
{
if (Convert.ToBoolean(_configProvider.GetValue("XbmcNotifyOnDownload", false, true)))
{
Logger.Trace("Sending Notifcation to XBMC");
_xbmcProvider.Notify(header, message);
}
if (Convert.ToBoolean(_configProvider.GetValue("XbmcUpdateOnDownload", false, true)))
{
Logger.Trace("Sending Update Request to XBMC");
_xbmcProvider.Update(erm.EpisodeFile.SeriesId);
}
if (Convert.ToBoolean(_configProvider.GetValue("XbmcCleanOnDownload", false, true)))
{
Logger.Trace("Sending Clean DB Request to XBMC");
_xbmcProvider.Clean();
}
Logger.Debug("Adding External Notification settings for {0}", settings.Name);
_repository.Add(settings);
}
else
{
Logger.Debug("Updating External Notification settings for {0}", settings.Name);
_repository.Update(settings);
}
}
Logger.Trace("XBMC Notifier is not enabled");
throw new NotImplementedException();
public virtual ExternalNotificationSetting GetSettings(Type type)
{
return _repository.Single<ExternalNotificationSetting>(s => s.NotifierName == type.ToString());
}
public virtual void OnRename(EpisodeRenameModel erm)
public virtual ExternalNotificationSetting GetSettings(int id)
{
var header = "NzbDrone [TV] - Renamed";
var message = EpisodeRenameHelper.GetNewName(erm);
return _repository.Single<ExternalNotificationSetting>(s => s.Id == id);
}
if (Convert.ToBoolean(_configProvider.GetValue("XbmcNotifyOnRename", false, true)))
{
Logger.Trace("Sending Notifcation to XBMC");
_xbmcProvider.Notify(header, message);
}
public virtual void InitializeNotifiers(IList<ExternalNotificationProviderBase> notifiers)
{
Logger.Info("Initializing notifiers. Count {0}", notifiers.Count);
if (Convert.ToBoolean(_configProvider.GetValue("XbmcUpdateOnRename", false, true)))
{
Logger.Trace("Sending Update Request to XBMC");
_xbmcProvider.Update(erm.EpisodeFile.SeriesId);
}
var currentNotifiers = All();
if (Convert.ToBoolean(_configProvider.GetValue("XbmcCleanOnRename", false, true)))
foreach (var feedProvider in notifiers)
{
Logger.Trace("Sending Clean DB Request to XBMC");
_xbmcProvider.Clean();
ExternalNotificationProviderBase externalNotificationProviderLocal = feedProvider;
if (!currentNotifiers.Exists(c => c.NotifierName == externalNotificationProviderLocal.GetType().ToString()))
{
var settings = new ExternalNotificationSetting()
{
Enabled = false,
NotifierName = externalNotificationProviderLocal.GetType().ToString(),
Name = externalNotificationProviderLocal.Name
};
SaveSettings(settings);
}
}
throw new NotImplementedException();
}
}
}

@ -3,10 +3,12 @@ using System.Collections.Generic;
using System.IO;
using System.Net;
using System.ServiceModel.Syndication;
using System.Linq;
using NLog;
using NzbDrone.Core.Helpers;
using NzbDrone.Core.Model;
using NzbDrone.Core.Providers.Core;
using NzbDrone.Core.Providers.ExternalNotification;
using NzbDrone.Core.Repository;
namespace NzbDrone.Core.Providers.Indexer
@ -22,11 +24,13 @@ namespace NzbDrone.Core.Providers.Indexer
protected readonly SeasonProvider _seasonProvider;
protected readonly SeriesProvider _seriesProvider;
protected readonly SabProvider _sabProvider;
protected readonly IEnumerable<ExternalNotificationProviderBase> _externalNotificationProvider;
protected IndexerProviderBase(SeriesProvider seriesProvider, SeasonProvider seasonProvider,
EpisodeProvider episodeProvider, ConfigProvider configProvider,
HttpProvider httpProvider, IndexerProvider indexerProvider,
HistoryProvider historyProvider, SabProvider sabProvider)
HistoryProvider historyProvider, SabProvider sabProvider,
IEnumerable<ExternalNotificationProviderBase> externalNotificationProvider)
{
_seriesProvider = seriesProvider;
_seasonProvider = seasonProvider;
@ -37,6 +41,7 @@ namespace NzbDrone.Core.Providers.Indexer
_historyProvider = historyProvider;
_sabProvider = sabProvider;
_logger = LogManager.GetLogger(GetType().ToString());
_externalNotificationProvider = externalNotificationProvider;
}
/// <summary>
@ -191,6 +196,12 @@ namespace NzbDrone.Core.Providers.Indexer
Indexer = GetIndexerType()
});
}
//Notify!
foreach (var notification in _externalNotificationProvider.Where(n => n.Settings.Enabled))
{
notification.OnGrab(sabTitle);
}
}
}

@ -1,17 +1,24 @@
using System;
using System.Collections.Generic;
using System.Net;
using System.ServiceModel.Syndication;
using System.Web;
using NzbDrone.Core.Model;
using NzbDrone.Core.Providers.Core;
using NzbDrone.Core.Providers.ExternalNotification;
using SubSonic.Repository;
namespace NzbDrone.Core.Providers.Indexer
{
public class NewzbinProvider : IndexerProviderBase
{
public NewzbinProvider(SeriesProvider seriesProvider, SeasonProvider seasonProvider, EpisodeProvider episodeProvider, ConfigProvider configProvider, HttpProvider httpProvider, IndexerProvider indexerProvider, HistoryProvider historyProvider, SabProvider sabProvider)
: base(seriesProvider, seasonProvider, episodeProvider, configProvider, httpProvider, indexerProvider, historyProvider, sabProvider)
public NewzbinProvider(SeriesProvider seriesProvider, SeasonProvider seasonProvider,
EpisodeProvider episodeProvider, ConfigProvider configProvider,
HttpProvider httpProvider, IndexerProvider indexerProvider,
HistoryProvider historyProvider, SabProvider sabProvider, IEnumerable<ExternalNotificationProviderBase> externalNotificationProvider)
: base(seriesProvider, seasonProvider, episodeProvider,
configProvider, httpProvider, indexerProvider, historyProvider,
sabProvider, externalNotificationProvider)
{
}

@ -1,16 +1,23 @@
using System;
using System.Collections.Generic;
using System.Net;
using System.ServiceModel.Syndication;
using NzbDrone.Core.Model;
using NzbDrone.Core.Providers.Core;
using NzbDrone.Core.Providers.ExternalNotification;
using SubSonic.Repository;
namespace NzbDrone.Core.Providers.Indexer
{
public class NzbMatrixProvider : IndexerProviderBase
{
public NzbMatrixProvider(SeriesProvider seriesProvider, SeasonProvider seasonProvider, EpisodeProvider episodeProvider, ConfigProvider configProvider, HttpProvider httpProvider, IndexerProvider indexerProvider, HistoryProvider historyProvider, SabProvider sabProvider)
: base(seriesProvider, seasonProvider, episodeProvider, configProvider, httpProvider, indexerProvider, historyProvider, sabProvider)
public NzbMatrixProvider(SeriesProvider seriesProvider, SeasonProvider seasonProvider,
EpisodeProvider episodeProvider, ConfigProvider configProvider,
HttpProvider httpProvider, IndexerProvider indexerProvider,
HistoryProvider historyProvider, SabProvider sabProvider, IEnumerable<ExternalNotificationProviderBase> externalNotificationProvider)
: base(seriesProvider, seasonProvider, episodeProvider,
configProvider, httpProvider, indexerProvider, historyProvider,
sabProvider, externalNotificationProvider)
{
}

@ -1,15 +1,22 @@
using System.Net;
using System.Collections.Generic;
using System.Net;
using System.ServiceModel.Syndication;
using NzbDrone.Core.Model;
using NzbDrone.Core.Providers.Core;
using NzbDrone.Core.Providers.ExternalNotification;
using SubSonic.Repository;
namespace NzbDrone.Core.Providers.Indexer
{
public class NzbsOrgProvider : IndexerProviderBase
{
public NzbsOrgProvider(SeriesProvider seriesProvider, SeasonProvider seasonProvider, EpisodeProvider episodeProvider, ConfigProvider configProvider, HttpProvider httpProvider, IndexerProvider indexerProvider, HistoryProvider historyProvider, SabProvider sabProvider)
: base(seriesProvider, seasonProvider, episodeProvider, configProvider, httpProvider, indexerProvider, historyProvider, sabProvider)
public NzbsOrgProvider(SeriesProvider seriesProvider, SeasonProvider seasonProvider,
EpisodeProvider episodeProvider, ConfigProvider configProvider,
HttpProvider httpProvider, IndexerProvider indexerProvider,
HistoryProvider historyProvider, SabProvider sabProvider, IEnumerable<ExternalNotificationProviderBase> externalNotificationProvider)
: base(seriesProvider, seasonProvider, episodeProvider,
configProvider, httpProvider, indexerProvider, historyProvider,
sabProvider, externalNotificationProvider)
{
}

@ -1,15 +1,22 @@
using System.Net;
using System.Collections.Generic;
using System.Net;
using System.ServiceModel.Syndication;
using NzbDrone.Core.Model;
using NzbDrone.Core.Providers.Core;
using NzbDrone.Core.Providers.ExternalNotification;
using SubSonic.Repository;
namespace NzbDrone.Core.Providers.Indexer
{
public class NzbsRUsProvider : IndexerProviderBase
{
public NzbsRUsProvider(SeriesProvider seriesProvider, SeasonProvider seasonProvider, EpisodeProvider episodeProvider, ConfigProvider configProvider, HttpProvider httpProvider, IndexerProvider indexerProvider, HistoryProvider historyProvider, SabProvider sabProvider)
: base(seriesProvider, seasonProvider, episodeProvider, configProvider, httpProvider, indexerProvider, historyProvider, sabProvider)
public NzbsRUsProvider(SeriesProvider seriesProvider, SeasonProvider seasonProvider,
EpisodeProvider episodeProvider, ConfigProvider configProvider,
HttpProvider httpProvider, IndexerProvider indexerProvider,
HistoryProvider historyProvider, SabProvider sabProvider, IEnumerable<ExternalNotificationProviderBase> externalNotificationProvider)
: base(seriesProvider, seasonProvider, episodeProvider,
configProvider, httpProvider, indexerProvider, historyProvider,
sabProvider, externalNotificationProvider)
{
}

@ -18,7 +18,6 @@ namespace NzbDrone.Core.Providers
private readonly ConfigProvider _configProvider;
private readonly DiskProvider _diskProvider;
private readonly EpisodeProvider _episodeProvider;
private readonly ExternalNotificationProvider _externalNotificationProvider;
private readonly MediaFileProvider _mediaFileProvider;
private readonly SeasonProvider _seasonProvider;
private readonly SeriesProvider _seriesProvider;
@ -29,8 +28,7 @@ namespace NzbDrone.Core.Providers
public RenameProvider(SeriesProvider seriesProvider, SeasonProvider seasonProvider,
EpisodeProvider episodeProvider, MediaFileProvider mediaFileProvider,
DiskProvider diskProvider, ConfigProvider configProvider,
ExternalNotificationProvider extenalNotificationProvider)
DiskProvider diskProvider, ConfigProvider configProvider)
{
_seriesProvider = seriesProvider;
_seasonProvider = seasonProvider;
@ -38,7 +36,6 @@ namespace NzbDrone.Core.Providers
_mediaFileProvider = mediaFileProvider;
_diskProvider = diskProvider;
_configProvider = configProvider;
_externalNotificationProvider = extenalNotificationProvider;
}
public virtual void RenameAll()
@ -201,11 +198,7 @@ namespace NzbDrone.Core.Providers
erm.EpisodeFile.Path = newFilename;
_mediaFileProvider.Update(erm.EpisodeFile);
if (erm.NewDownload)
_externalNotificationProvider.OnDownload(erm);
else
_externalNotificationProvider.OnRename(erm);
throw new NotImplementedException("Rename File");
}
catch (Exception ex)
{

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SubSonic.SqlGeneration.Schema;
namespace NzbDrone.Core.Repository
{
public class ExternalNotificationSetting
{
[SubSonicPrimaryKey(true)]
public int Id { get; set; }
public bool Enabled { get; set; }
public string NotifierName { get; set; }
public string Name { get; set; }
}
}

@ -37,7 +37,7 @@ History
.Sortable(rows => rows.OrderBy(epSort => epSort.Add(c => c.Date).Descending()).Enabled(true))
.Pageable(
c =>
c.PageSize(50).Position(GridPagerPosition.Bottom).Style(GridPagerStyles.NextPrevious))
c.PageSize(20).Position(GridPagerPosition.Bottom).Style(GridPagerStyles.NextPrevious))
//.Filterable()
//.ClientEvents(c => c.OnRowDataBound("onRowDataBound"))
.Render();}

Loading…
Cancel
Save