potential fix for #1942

pull/1959/head
Jamie 7 years ago
parent c3c85b0ae0
commit e9e61153cb

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Ombi.Helpers;
using Ombi.Notifications.Models; using Ombi.Notifications.Models;
using Ombi.Settings.Settings.Models; using Ombi.Settings.Settings.Models;
using Ombi.Store.Entities; using Ombi.Store.Entities;
@ -12,7 +13,7 @@ namespace Ombi.Notifications
public void Setup(NotificationOptions opts, FullBaseRequest req, CustomizationSettings s) public void Setup(NotificationOptions opts, FullBaseRequest req, CustomizationSettings s)
{ {
ApplicationUrl = s?.ApplicationUrl; ApplicationUrl = (s?.ApplicationUrl.HasValue() ?? false) ? s.ApplicationUrl : string.Empty;
ApplicationName = string.IsNullOrEmpty(s?.ApplicationName) ? "Ombi" : s?.ApplicationName; ApplicationName = string.IsNullOrEmpty(s?.ApplicationName) ? "Ombi" : s?.ApplicationName;
RequestedUser = string.IsNullOrEmpty(req.RequestedUser.Alias) RequestedUser = string.IsNullOrEmpty(req.RequestedUser.Alias)
? req.RequestedUser.UserName ? req.RequestedUser.UserName
@ -24,12 +25,12 @@ namespace Ombi.Notifications
Year = req.ReleaseDate.Year.ToString(); Year = req.ReleaseDate.Year.ToString();
PosterImage = req.RequestType == RequestType.Movie ? PosterImage = req.RequestType == RequestType.Movie ?
$"https://image.tmdb.org/t/p/w300{req.PosterPath}" : req.PosterPath; $"https://image.tmdb.org/t/p/w300{req.PosterPath}" : req.PosterPath;
AdditionalInformation = opts.AdditionalInformation; AdditionalInformation = opts?.AdditionalInformation ?? string.Empty;
} }
public void Setup(NotificationOptions opts, ChildRequests req, CustomizationSettings s) public void Setup(NotificationOptions opts, ChildRequests req, CustomizationSettings s)
{ {
ApplicationUrl = s?.ApplicationUrl; ApplicationUrl = (s?.ApplicationUrl.HasValue() ?? false) ? s.ApplicationUrl : string.Empty;
ApplicationName = string.IsNullOrEmpty(s?.ApplicationName) ? "Ombi" : s?.ApplicationName; ApplicationName = string.IsNullOrEmpty(s?.ApplicationName) ? "Ombi" : s?.ApplicationName;
RequestedUser = string.IsNullOrEmpty(req.RequestedUser.Alias) RequestedUser = string.IsNullOrEmpty(req.RequestedUser.Alias)
? req.RequestedUser.UserName ? req.RequestedUser.UserName
@ -47,7 +48,7 @@ namespace Ombi.Notifications
public void Setup(OmbiUser user, CustomizationSettings s) public void Setup(OmbiUser user, CustomizationSettings s)
{ {
ApplicationUrl = s?.ApplicationUrl; ApplicationUrl = (s?.ApplicationUrl.HasValue() ?? false) ? s.ApplicationUrl : string.Empty;
ApplicationName = string.IsNullOrEmpty(s?.ApplicationName) ? "Ombi" : s?.ApplicationName; ApplicationName = string.IsNullOrEmpty(s?.ApplicationName) ? "Ombi" : s?.ApplicationName;
RequestedUser = user.UserName; RequestedUser = user.UserName;
} }

@ -221,6 +221,7 @@ namespace Ombi.Schedule.Jobs.Plex
//var existing = await Repo.GetByKey(movie.ratingKey); //var existing = await Repo.GetByKey(movie.ratingKey);
if (existing != null) if (existing != null)
{ {
Logger.LogInformation("We already have movie {0}", movie.title);
continue; continue;
} }

Loading…
Cancel
Save