diff --git a/PlexRequests.Services/Jobs/CouchPotatoCacher.cs b/PlexRequests.Services/Jobs/CouchPotatoCacher.cs index 3fb831b12..be36d004f 100644 --- a/PlexRequests.Services/Jobs/CouchPotatoCacher.cs +++ b/PlexRequests.Services/Jobs/CouchPotatoCacher.cs @@ -24,6 +24,8 @@ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // ************************************************************************/ #endregion + +using System; using System.Linq; using NLog; @@ -86,8 +88,18 @@ namespace PlexRequests.Services.Jobs // we do not want to set here... public int[] QueuedIds() { - var movies = Cache.Get(CacheKeys.CouchPotatoQueued); - return movies?.movies?.Select(x => x.info.tmdb_id).ToArray() ?? new int[] { }; + try + { + var movies = Cache.Get(CacheKeys.CouchPotatoQueued); + + var items = movies?.movies?.Select(x => x.info?.tmdb_id).Cast().ToArray(); + return items ?? new int[] { }; + } + catch (Exception e) + { + Log.Error(e); + return new int[] {}; + } } public void Execute(IJobExecutionContext context) diff --git a/PlexRequests.Services/Notification/EmailMessageNotification.cs b/PlexRequests.Services/Notification/EmailMessageNotification.cs index 466ff7a24..77b71e58a 100644 --- a/PlexRequests.Services/Notification/EmailMessageNotification.cs +++ b/PlexRequests.Services/Notification/EmailMessageNotification.cs @@ -120,8 +120,8 @@ namespace PlexRequests.Services.Notification { var message = new MimeMessage { - Body = new TextPart("plain") { Text = $"Hello! The user '{model.User}' has requested the {RequestTypeDisplay.Get(model.RequestType)?.ToLower()} '{model.Title}'! Please log in to approve this request. Request Date: {model.DateTime.ToString("f")}" }, - Subject = $"Plex Requests: New {RequestTypeDisplay.Get(model.RequestType)?.ToLower()} request for {model.Title}!" + Body = new TextPart("plain") { Text = $"Hello! The user '{model.User}' has requested the {model.RequestType.GetString()?.ToLower()} '{model.Title}'! Please log in to approve this request. Request Date: {model.DateTime.ToString("f")}" }, + Subject = $"Plex Requests: New {model.RequestType.GetString()?.ToLower()} request for {model.Title}!" }; message.From.Add(new MailboxAddress(settings.EmailSender, settings.EmailSender)); message.To.Add(new MailboxAddress(settings.RecipientEmail, settings.RecipientEmail)); diff --git a/PlexRequests.Services/Notification/PushbulletNotification.cs b/PlexRequests.Services/Notification/PushbulletNotification.cs index 8eda8d0b9..f6003bf1d 100644 --- a/PlexRequests.Services/Notification/PushbulletNotification.cs +++ b/PlexRequests.Services/Notification/PushbulletNotification.cs @@ -105,8 +105,8 @@ namespace PlexRequests.Services.Notification private async Task PushNewRequestAsync(NotificationModel model, PushbulletNotificationSettings settings) { - var message = $"The {RequestTypeDisplay.Get(model.RequestType)?.ToLower()} '{model.Title}' has been requested by user: {model.User}"; - var pushTitle = $"Plex Requests: The {RequestTypeDisplay.Get(model.RequestType)?.ToLower()} {model.Title} has been requested!"; + var message = $"The {model.RequestType.GetString()?.ToLower()} '{model.Title}' has been requested by user: {model.User}"; + var pushTitle = $"Plex Requests: The {model.RequestType.GetString()?.ToLower()} {model.Title} has been requested!"; await Push(settings, message, pushTitle); } diff --git a/PlexRequests.Services/Notification/PushoverNotification.cs b/PlexRequests.Services/Notification/PushoverNotification.cs index 9831e6562..b259a6faa 100644 --- a/PlexRequests.Services/Notification/PushoverNotification.cs +++ b/PlexRequests.Services/Notification/PushoverNotification.cs @@ -105,7 +105,7 @@ namespace PlexRequests.Services.Notification private async Task PushNewRequestAsync(NotificationModel model, PushoverNotificationSettings settings) { - var message = $"Plex Requests: The {RequestTypeDisplay.Get(model.RequestType)?.ToLower()} '{model.Title}' has been requested by user: {model.User}"; + var message = $"Plex Requests: The {model.RequestType.GetString()?.ToLower()} '{model.Title}' has been requested by user: {model.User}"; await Push(settings, message); } diff --git a/PlexRequests.Store/RequestedModel.cs b/PlexRequests.Store/RequestedModel.cs index 254b4f7be..b203db7d3 100644 --- a/PlexRequests.Store/RequestedModel.cs +++ b/PlexRequests.Store/RequestedModel.cs @@ -80,7 +80,7 @@ namespace PlexRequests.Store public static class RequestTypeDisplay { - public static string Get(RequestType type) + public static string GetString(this RequestType type) { switch (type) { diff --git a/PlexRequests.UI/Views/Shared/_Layout.cshtml b/PlexRequests.UI/Views/Shared/_Layout.cshtml index fee4537f8..b108cf6ce 100644 --- a/PlexRequests.UI/Views/Shared/_Layout.cshtml +++ b/PlexRequests.UI/Views/Shared/_Layout.cshtml @@ -1,157 +1,159 @@ -@using Nancy.Security -@using Nancy.Session -@using PlexRequests.UI.Helpers -@using PlexRequests.UI.Models -@inherits Nancy.ViewEngines.Razor.NancyRazorViewBase -@{ - var baseUrl = Html.GetBaseUrl(); - var url = string.Empty; - if (!string.IsNullOrEmpty(baseUrl.ToHtmlString())) - { - url = "/" + baseUrl.ToHtmlString(); - } -} - - - - Plex Requests - - - @Html.LoadAnalytics() - @Html.LoadAssets() - - - - - - -
- @RenderBody() -
-
- - - -
- - - \ No newline at end of file