public void Setup(NotificationOptions opts, FullBaseRequest req, CustomizationSettings s) { LoadIssues(opts); string title; if (req == null) { opts.Substitutes.TryGetValue("Title", out title); } else { title = req?.Title; } ApplicationUrl = (s?.ApplicationUrl.HasValue() ?? false) ? s.ApplicationUrl : string.Empty; ApplicationName = string.IsNullOrEmpty(s?.ApplicationName) ? "Ombi" : s?.ApplicationName; RequestedUser = req?.RequestedUser?.UserName; UserName = req?.RequestedUser?.UserName; Alias = (req?.RequestedUser?.Alias.HasValue() ?? false) ? req?.RequestedUser?.Alias : req?.RequestedUser?.UserName; Title = title; RequestedDate = req?.RequestedDate.ToString("D"); Type = req?.RequestType.ToString(); Overview = req?.Overview; Year = req?.ReleaseDate.Year.ToString(); PosterImage = req?.RequestType == RequestType.Movie ? string.Format("https://image.tmdb.org/t/p/w300{0}", req?.PosterPath) : req?.PosterPath; AdditionalInformation = opts?.AdditionalInformation ?? string.Empty; }
private async Task <SenderResult> SendToCp(FullBaseRequest model, CouchPotatoSettings cpSettings, string cpSettingsDefaultProfileId) { var result = await CouchPotatoApi.AddMovie(model.ImdbId, cpSettings.ApiKey, model.Title, cpSettings.FullUri, cpSettingsDefaultProfileId); return(new SenderResult { Success = result, Sent = true }); }
public void NewRequest(FullBaseRequest model) { var notificationModel = new NotificationOptions { RequestId = model.Id, DateTime = DateTime.Now, NotificationType = NotificationType.NewRequest, RequestType = model.RequestType }; BackgroundJob.Enqueue(() => NotificationService.Publish(notificationModel)); }
public void Setup(NotificationOptions opts, FullBaseRequest req, CustomizationSettings s, UserNotificationPreferences pref) { LoadIssues(opts); RequestId = req?.Id.ToString(); string title; if (req == null) { opts.Substitutes.TryGetValue("Title", out title); } else { title = req?.Title; } ApplicationUrl = (s?.ApplicationUrl.HasValue() ?? false) ? s.ApplicationUrl : string.Empty; ApplicationName = string.IsNullOrEmpty(s?.ApplicationName) ? "Ombi" : s?.ApplicationName; RequestedUser = req?.RequestedUser?.UserName; if (UserName.IsNullOrEmpty()) { // Can be set if it's an issue UserName = req?.RequestedUser?.UserName; } Alias = (req?.RequestedUser?.Alias.HasValue() ?? false) ? req?.RequestedUser?.Alias : req?.RequestedUser?.UserName; if (pref != null) { UserPreference = pref.Value.HasValue() ? pref.Value : Alias; } Title = title; RequestedDate = req?.RequestedDate.ToString("D"); if (Type.IsNullOrEmpty()) { Type = req?.RequestType.Humanize(); } Overview = req?.Overview; Year = req?.ReleaseDate.Year.ToString(); DenyReason = req?.DeniedReason; AvailableDate = req?.MarkedAsAvailable?.ToString("D") ?? string.Empty; if (req?.RequestType == RequestType.Movie) { PosterImage = string.Format((req?.PosterPath ?? string.Empty).StartsWith("/", StringComparison.InvariantCultureIgnoreCase) ? "https://image.tmdb.org/t/p/w300{0}" : "https://image.tmdb.org/t/p/w300/{0}", req?.PosterPath); } else { PosterImage = req?.PosterPath; } AdditionalInformation = opts?.AdditionalInformation ?? string.Empty; }
public async Task NewRequest(FullBaseRequest model) { var notificationModel = new NotificationOptions { RequestId = model.Id, DateTime = DateTime.Now, NotificationType = NotificationType.NewRequest, RequestType = model.RequestType }; await OmbiQuartz.TriggerJob(nameof(INotificationService), "Notifications", new Dictionary <string, object> { { JobDataKeys.NotificationOptions, notificationModel } }); }
private async Task <DogNzbMovieAddResult> SendToDogNzb(FullBaseRequest model, DogNzbSettings settings) { var id = model.ImdbId; return(await DogNzbApi.AddMovie(settings.ApiKey, id)); }