add new notification options

pull/702/head
Luke Pulverenti 11 years ago
parent 547291f048
commit 42145c86e8

@ -225,6 +225,8 @@ namespace MediaBrowser.Model.Configuration
public double DownMixAudioBoost { get; set; } public double DownMixAudioBoost { get; set; }
public NotificationOptions NotificationOptions { get; set; }
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="ServerConfiguration" /> class. /// Initializes a new instance of the <see cref="ServerConfiguration" /> class.
/// </summary> /// </summary>
@ -288,6 +290,8 @@ namespace MediaBrowser.Model.Configuration
DlnaOptions = new DlnaOptions(); DlnaOptions = new DlnaOptions();
UICulture = "en-us"; UICulture = "en-us";
NotificationOptions = new NotificationOptions();
} }
} }
@ -315,4 +319,20 @@ namespace MediaBrowser.Model.Configuration
public string From { get; set; } public string From { get; set; }
public string To { get; set; } public string To { get; set; }
} }
public class NotificationOptions
{
public bool SendOnUpdates { get; set; }
public bool SendOnPlayback { get; set; }
public bool SendOnFailedTasks { get; set; }
public bool SendOnNewLibraryContent { get; set; }
public NotificationOptions()
{
SendOnUpdates = true;
SendOnPlayback = true;
SendOnFailedTasks = true;
SendOnNewLibraryContent = true;
}
}
} }

@ -2,6 +2,7 @@
using MediaBrowser.Common.Plugins; using MediaBrowser.Common.Plugins;
using MediaBrowser.Common.ScheduledTasks; using MediaBrowser.Common.ScheduledTasks;
using MediaBrowser.Common.Updates; using MediaBrowser.Common.Updates;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Notifications; using MediaBrowser.Controller.Notifications;
@ -27,6 +28,8 @@ namespace MediaBrowser.Server.Implementations.EntryPoints.Notifications
private readonly ITaskManager _taskManager; private readonly ITaskManager _taskManager;
private readonly INotificationManager _notificationManager; private readonly INotificationManager _notificationManager;
private IServerConfigurationManager _config;
public Notifications(IInstallationManager installationManager, IUserManager userManager, ILogger logger, ITaskManager taskManager, INotificationManager notificationManager) public Notifications(IInstallationManager installationManager, IUserManager userManager, ILogger logger, ITaskManager taskManager, INotificationManager notificationManager)
{ {
_installationManager = installationManager; _installationManager = installationManager;
@ -75,7 +78,8 @@ namespace MediaBrowser.Server.Implementations.EntryPoints.Notifications
{ {
var result = e.Argument; var result = e.Argument;
if (result.Status == TaskCompletionStatus.Failed) if (result.Status == TaskCompletionStatus.Failed &&
_config.Configuration.NotificationOptions.SendOnFailedTasks)
{ {
var userIds = _userManager var userIds = _userManager
.Users .Users
@ -130,6 +134,11 @@ namespace MediaBrowser.Server.Implementations.EntryPoints.Notifications
async void _installationManager_PackageInstallationCompleted(object sender, InstallationEventArgs e) async void _installationManager_PackageInstallationCompleted(object sender, InstallationEventArgs e)
{ {
if (!_config.Configuration.NotificationOptions.SendOnUpdates)
{
return;
}
var installationInfo = e.InstallationInfo; var installationInfo = e.InstallationInfo;
var userIds = _userManager var userIds = _userManager

@ -55,6 +55,7 @@
"TabProfile": "Profile", "TabProfile": "Profile",
"TabMetadata": "Metadata", "TabMetadata": "Metadata",
"TabImages": "Images", "TabImages": "Images",
"TabNotifications": "Notifications"
"TabCollectionTitles": "Titles", "TabCollectionTitles": "Titles",
"LabelDisplayMissingEpisodesWithinSeasons": "Display missing episodes within seasons", "LabelDisplayMissingEpisodesWithinSeasons": "Display missing episodes within seasons",
"LabelUnairedMissingEpisodesWithinSeasons": "Display unaired episodes within seasons", "LabelUnairedMissingEpisodesWithinSeasons": "Display unaired episodes within seasons",
@ -554,5 +555,11 @@
"HeaderRequireManualLogin": "Require manual username entry for:", "HeaderRequireManualLogin": "Require manual username entry for:",
"HeaderRequireManualLoginHelp": "When disabled clients may present a login screen with a visual selection of users.", "HeaderRequireManualLoginHelp": "When disabled clients may present a login screen with a visual selection of users.",
"OptionOtherApps": "Other apps", "OptionOtherApps": "Other apps",
"OptionMobileApps": "Mobile apps" "OptionMobileApps": "Mobile apps",
"HeaderEnableNotificationForEvents": "Send notifications for the following events:",
"OptionNotifyOnUpdates": "When updates are available",
"OptionNotifyOnPlayback": "When users play content",
"OptionNotifyOnFailedTasks": "When scheduled tasks fail",
"OptionNotifyOnNewLibraryContent": "When new library content is added",
"SendNotificationHelp": "Notifications are delivered to the dashboard inbox. Browse the plugin catalog to install additional notification formats such as email and text messaging."
} }

@ -597,6 +597,7 @@ namespace MediaBrowser.WebDashboard.Api
"musicrecommended.js", "musicrecommended.js",
"musicvideos.js", "musicvideos.js",
"notifications.js", "notifications.js",
"notificationsettings.js",
"playlist.js", "playlist.js",
"plugincatalogpage.js", "plugincatalogpage.js",
"pluginspage.js", "pluginspage.js",

@ -508,6 +508,9 @@
<Content Include="dashboard-ui\livetvrecordings.html"> <Content Include="dashboard-ui\livetvrecordings.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Content Include="dashboard-ui\notificationsettings.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\nowplaying.html"> <Content Include="dashboard-ui\nowplaying.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
@ -631,6 +634,9 @@
<Content Include="dashboard-ui\scripts\livetvrecordings.js"> <Content Include="dashboard-ui\scripts\livetvrecordings.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Content Include="dashboard-ui\scripts\notificationsettings.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\scripts\nowplayingbar.js"> <Content Include="dashboard-ui\scripts\nowplayingbar.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>

Loading…
Cancel
Save