diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-04-30 11:07:02 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-04-30 11:07:02 -0400 |
| commit | 98c0b28d14d68cc2989fb60fb09dde0501a8d928 (patch) | |
| tree | 82fee78dd8e0c1f003364ca1320eb1b0061e3d6b /MediaBrowser.Server.Implementations | |
| parent | e9fb806478e974b200b54f8acff5eb09bdef4c32 (diff) | |
re-enable mobile media controller
Diffstat (limited to 'MediaBrowser.Server.Implementations')
5 files changed, 69 insertions, 14 deletions
diff --git a/MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifier.cs b/MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifier.cs index 36ee4a0c9..1e3f8b0b0 100644 --- a/MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifier.cs +++ b/MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifier.cs @@ -70,7 +70,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints.Notifications _appHost.ApplicationUpdated += _appHost_ApplicationUpdated; } - async void _appHost_ApplicationUpdated(object sender, GenericEventArgs<Version> e) + async void _appHost_ApplicationUpdated(object sender, GenericEventArgs<PackageVersionInfo> e) { var type = NotificationType.ApplicationUpdateInstalled.ToString(); @@ -79,8 +79,9 @@ namespace MediaBrowser.Server.Implementations.EntryPoints.Notifications NotificationType = type }; - notification.Variables["Version"] = e.Argument.ToString(); - + notification.Variables["Version"] = e.Argument.versionStr; + notification.Variables["ReleaseNotes"] = e.Argument.description; + await SendNotification(notification).ConfigureAwait(false); } @@ -98,6 +99,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints.Notifications notification.Variables["Name"] = installationInfo.Name; notification.Variables["Version"] = installationInfo.Version.ToString(); + notification.Variables["ReleaseNotes"] = e.Argument.Item2.description; await SendNotification(notification).ConfigureAwait(false); } @@ -249,6 +251,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints.Notifications }; notification.Variables["Name"] = e.Argument.Name; + notification.Variables["ErrorMessage"] = e.Argument.ErrorMessage; await SendNotification(notification).ConfigureAwait(false); } diff --git a/MediaBrowser.Server.Implementations/Localization/Server/server.json b/MediaBrowser.Server.Implementations/Localization/Server/server.json index d453068a9..72c341057 100644 --- a/MediaBrowser.Server.Implementations/Localization/Server/server.json +++ b/MediaBrowser.Server.Implementations/Localization/Server/server.json @@ -605,6 +605,7 @@ "LetterButtonAbbreviation": "A", "TabNowPlaying": "Now Playing", "TabNavigation": "Navigation", + "TabControls": "Controls", "ButtonFullscreen": "Toggle fullscreen", "ButtonScenes": "Scenes", "ButtonSubtitles": "Subtitles", @@ -616,5 +617,8 @@ "ButtonPause": "Pause", "LabelGroupMoviesIntoCollections": "Group movies into collections", "LabelGroupMoviesIntoCollectionsHelp": "When displaying movie lists, movies belonging to a collection will be displayed as one grouped item.", - "NotificationOptionPluginError": "Plugin failure" + "NotificationOptionPluginError": "Plugin failure", + "ButtonVolumeUp": "Volume up", + "ButtonVolumeDown": "Volume down", + "ButtonMute": "Mute" }
\ No newline at end of file diff --git a/MediaBrowser.Server.Implementations/News/NewsEntryPoint.cs b/MediaBrowser.Server.Implementations/News/NewsEntryPoint.cs index 9a4783cba..eebb04031 100644 --- a/MediaBrowser.Server.Implementations/News/NewsEntryPoint.cs +++ b/MediaBrowser.Server.Implementations/News/NewsEntryPoint.cs @@ -99,7 +99,7 @@ namespace MediaBrowser.Server.Implementations.News { if (lastUpdate.HasValue) { - items = items.Where(i => i.Date.ToUniversalTime() > lastUpdate.Value) + items = items.Where(i => i.Date.ToUniversalTime() >= lastUpdate.Value) .ToList(); } diff --git a/MediaBrowser.Server.Implementations/Notifications/CoreNotificationTypes.cs b/MediaBrowser.Server.Implementations/Notifications/CoreNotificationTypes.cs index deb82c7c4..971114809 100644 --- a/MediaBrowser.Server.Implementations/Notifications/CoreNotificationTypes.cs +++ b/MediaBrowser.Server.Implementations/Notifications/CoreNotificationTypes.cs @@ -48,8 +48,9 @@ namespace MediaBrowser.Server.Implementations.Notifications new NotificationTypeInfo { Type = NotificationType.PluginError.ToString(), - DefaultTitle = "{Name} has encountered an error: {Message}", - Variables = new List<string>{"Name", "Message"} + DefaultTitle = "{Name} has encountered an error.", + DefaultDescription = "{ErrorMessage}", + Variables = new List<string>{"Name", "ErrorMessage"} }, new NotificationTypeInfo @@ -63,7 +64,8 @@ namespace MediaBrowser.Server.Implementations.Notifications { Type = NotificationType.PluginUpdateInstalled.ToString(), DefaultTitle = "{Name} was updated.", - Variables = new List<string>{"Name", "Version"} + DefaultDescription = "{ReleaseNotes}", + Variables = new List<string>{"Name", "ReleaseNotes", "Version"} }, new NotificationTypeInfo @@ -76,7 +78,8 @@ namespace MediaBrowser.Server.Implementations.Notifications { Type = NotificationType.TaskFailed.ToString(), DefaultTitle = "{Name} failed.", - Variables = new List<string>{"Name"} + DefaultDescription = "{ErrorMessage}", + Variables = new List<string>{"Name", "ErrorMessage"} }, new NotificationTypeInfo diff --git a/MediaBrowser.Server.Implementations/Notifications/NotificationManager.cs b/MediaBrowser.Server.Implementations/Notifications/NotificationManager.cs index f3183ec0b..0b3af0409 100644 --- a/MediaBrowser.Server.Implementations/Notifications/NotificationManager.cs +++ b/MediaBrowser.Server.Implementations/Notifications/NotificationManager.cs @@ -39,13 +39,14 @@ namespace MediaBrowser.Server.Implementations.Notifications _config.Configuration.NotificationOptions.GetOptions(notificationType); var users = GetUserIds(request, options) - .Except(request.UserIds) + .Except(request.ExcludeUserIds) .Select(i => _userManager.GetUserById(new Guid(i))); var title = GetTitle(request, options); + var description = GetDescription(request, options); var tasks = _services.Where(i => IsEnabled(i, notificationType)) - .Select(i => SendNotification(request, i, users, title, cancellationToken)); + .Select(i => SendNotification(request, i, users, description, title, cancellationToken)); return Task.WhenAll(tasks); } @@ -54,12 +55,13 @@ namespace MediaBrowser.Server.Implementations.Notifications INotificationService service, IEnumerable<User> users, string title, + string description, CancellationToken cancellationToken) { users = users.Where(i => IsEnabledForUser(service, i)) .ToList(); - var tasks = users.Select(i => SendNotification(request, service, title, i, cancellationToken)); + var tasks = users.Select(i => SendNotification(request, service, title, description, i, cancellationToken)); return Task.WhenAll(tasks); @@ -89,19 +91,20 @@ namespace MediaBrowser.Server.Implementations.Notifications .Select(i => i.Id.ToString("N")); } - return new List<string>(); + return request.UserIds; } private async Task SendNotification(NotificationRequest request, INotificationService service, string title, + string description, User user, CancellationToken cancellationToken) { var notification = new UserNotification { Date = request.Date, - Description = request.Description, + Description = description, Level = request.Level, Name = title, Url = request.Url, @@ -162,6 +165,48 @@ namespace MediaBrowser.Server.Implementations.Notifications return title; } + private string GetDescription(NotificationRequest request, NotificationOption options) + { + var text = request.Description; + + // If empty, grab from options + if (string.IsNullOrEmpty(text)) + { + if (!string.IsNullOrEmpty(request.NotificationType)) + { + if (options != null) + { + text = options.Title; + } + } + } + + // If still empty, grab default + if (string.IsNullOrEmpty(text)) + { + if (!string.IsNullOrEmpty(request.NotificationType)) + { + var info = GetNotificationTypes().FirstOrDefault(i => string.Equals(i.Type, request.NotificationType, StringComparison.OrdinalIgnoreCase)); + + if (info != null) + { + text = info.DefaultDescription; + } + } + } + + text = text ?? string.Empty; + + foreach (var pair in request.Variables) + { + var token = "{" + pair.Key + "}"; + + text = text.Replace(token, pair.Value, StringComparison.OrdinalIgnoreCase); + } + + return text; + } + private bool IsEnabledForUser(INotificationService service, User user) { try |
