mirror of https://github.com/Radarr/Radarr
Twitter notifications working from end-to-end.
This commit is contained in:
parent
a2735d7716
commit
d9bef59ec2
|
@ -106,6 +106,7 @@ namespace NzbDrone.Core
|
|||
{
|
||||
_kernel.Bind<ExternalNotificationBase>().To<Xbmc>();
|
||||
_kernel.Bind<ExternalNotificationBase>().To<Smtp>();
|
||||
_kernel.Bind<ExternalNotificationBase>().To<Twitter>();
|
||||
|
||||
var notifiers = _kernel.GetAll<ExternalNotificationBase>();
|
||||
_kernel.Get<ExternalNotificationProvider>().InitializeNotifiers(notifiers.ToList());
|
||||
|
|
|
@ -222,6 +222,7 @@
|
|||
<Compile Include="Providers\EnviromentProvider.cs" />
|
||||
<Compile Include="Providers\Core\ConfigFileProvider.cs" />
|
||||
<Compile Include="Providers\Core\UdpProvider.cs" />
|
||||
<Compile Include="Providers\ExternalNotification\Twitter.cs" />
|
||||
<Compile Include="Providers\ExternalNotification\Smtp.cs" />
|
||||
<Compile Include="Providers\Jobs\BacklogSearchJob.cs" />
|
||||
<Compile Include="Providers\Jobs\BannerDownloadJob.cs" />
|
||||
|
|
|
@ -312,6 +312,20 @@ namespace NzbDrone.Core.Providers.Core
|
|||
set { SetValue("SmtpToAddresses", value); }
|
||||
}
|
||||
|
||||
public virtual Boolean TwitterNotifyOnGrab
|
||||
{
|
||||
get { return GetValueBoolean("TwitterNotifyOnGrab"); }
|
||||
|
||||
set { SetValue("TwitterNotifyOnGrab", value); }
|
||||
}
|
||||
|
||||
public virtual Boolean TwitterNotifyOnDownload
|
||||
{
|
||||
get { return GetValueBoolean("TwitterNotifyOnDownload"); }
|
||||
|
||||
set { SetValue("TwitterNotifyOnDownload", value); }
|
||||
}
|
||||
|
||||
public virtual string TwitterAccessToken
|
||||
{
|
||||
get { return GetValue("TwitterAccessToken", String.Empty); }
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
using System;
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
using NzbDrone.Core.Repository;
|
||||
|
||||
namespace NzbDrone.Core.Providers.ExternalNotification
|
||||
{
|
||||
public class Twitter : ExternalNotificationBase
|
||||
{
|
||||
private readonly TwitterProvider _twitterProvider;
|
||||
|
||||
public Twitter(ConfigProvider configProvider, TwitterProvider twitterProvider)
|
||||
: base(configProvider)
|
||||
{
|
||||
_twitterProvider = twitterProvider;
|
||||
}
|
||||
|
||||
public override string Name
|
||||
{
|
||||
get { return "Twitter"; }
|
||||
}
|
||||
|
||||
public override void OnGrab(string message)
|
||||
{
|
||||
if (_configProvider.TwitterNotifyOnGrab)
|
||||
{
|
||||
_logger.Trace("Sending Notification to Twitter (On Grab)");
|
||||
_twitterProvider.SendTweet("Download Started: " + message);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnDownload(string message, Series series)
|
||||
{
|
||||
if (_configProvider.TwitterNotifyOnDownload)
|
||||
{
|
||||
_logger.Trace("Sending Notification to Twitter (On Grab)");
|
||||
_twitterProvider.SendTweet("Downloaded Complete: " + message);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnRename(string message, Series series)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
|
@ -170,7 +170,10 @@ namespace NzbDrone.Web.Controllers
|
|||
SmtpUsername = _configProvider.SmtpUsername,
|
||||
SmtpPassword = _configProvider.SmtpPassword,
|
||||
SmtpFromAddress = _configProvider.SmtpFromAddress,
|
||||
SmtpToAddresses = _configProvider.SmtpToAddresses
|
||||
SmtpToAddresses = _configProvider.SmtpToAddresses,
|
||||
TwitterEnabled = _externalNotificationProvider.GetSettings(typeof(Twitter)).Enable,
|
||||
TwitterNotifyOnGrab = _configProvider.TwitterNotifyOnGrab,
|
||||
TwitterNotifyOnDownload = _configProvider.TwitterNotifyOnDownload
|
||||
};
|
||||
|
||||
return View(model);
|
||||
|
@ -449,7 +452,7 @@ namespace NzbDrone.Web.Controllers
|
|||
_externalNotificationProvider.SaveSettings(smtpSettings);
|
||||
|
||||
_configProvider.SmtpNotifyOnGrab = data.SmtpNotifyOnGrab;
|
||||
_configProvider.SmtpNotifyOnGrab = data.SmtpNotifyOnDownload;
|
||||
_configProvider.SmtpNotifyOnDownload = data.SmtpNotifyOnDownload;
|
||||
_configProvider.SmtpServer = data.SmtpServer;
|
||||
_configProvider.SmtpPort = data.SmtpPort;
|
||||
_configProvider.SmtpUseSsl = data.SmtpUseSsl;
|
||||
|
@ -458,6 +461,14 @@ namespace NzbDrone.Web.Controllers
|
|||
_configProvider.SmtpFromAddress = data.SmtpFromAddress;
|
||||
_configProvider.SmtpToAddresses = data.SmtpToAddresses;
|
||||
|
||||
//Twitter
|
||||
var twitterSettings = _externalNotificationProvider.GetSettings(typeof(Twitter));
|
||||
twitterSettings.Enable = data.TwitterEnabled;
|
||||
_externalNotificationProvider.SaveSettings(twitterSettings);
|
||||
|
||||
_configProvider.TwitterNotifyOnGrab = data.TwitterNotifyOnGrab;
|
||||
_configProvider.TwitterNotifyOnDownload = data.TwitterNotifyOnDownload;
|
||||
|
||||
return GetSuccessResult();
|
||||
}
|
||||
|
||||
|
|
|
@ -54,19 +54,19 @@
|
|||
|
||||
<div id="tabs">
|
||||
<ul>
|
||||
<li><a href="#tabs-twitter">Twitter</a></li>
|
||||
<li><a href="#tabs-xbmc">XBMC</a></li>
|
||||
<li><a href="#tabs-smtp">SMTP</a></li>
|
||||
<li><a href="#tabs-twitter">Twitter</a></li>
|
||||
</ul>
|
||||
<div id="tabs-twitter">
|
||||
@{Html.RenderPartial("Twitter", Model);}
|
||||
</div>
|
||||
<div id="tabs-xbmc">
|
||||
@{Html.RenderPartial("Xbmc", Model);}
|
||||
</div>
|
||||
<div id="tabs-smtp">
|
||||
@{Html.RenderPartial("Smtp", Model);}
|
||||
</div>
|
||||
<div id="tabs-twitter">
|
||||
@{Html.RenderPartial("Twitter", Model);}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button type="submit" id="save_button" disabled="disabled">Save</button>
|
||||
|
|
Loading…
Reference in New Issue