public async Task <RequestEngineResult> DenyMovieById(int modelId, string denyReason) { var request = await MovieRepository.Find(modelId); if (request == null) { return(new RequestEngineResult { ErrorMessage = "Request does not exist" }); } request.Denied = true; request.DeniedReason = denyReason; // We are denying a request await NotificationHelper.Notify(request, NotificationType.RequestDeclined); await MovieRepository.Update(request); await _mediaCacheService.Purge(); return(new RequestEngineResult { Result = true, Message = "Request successfully deleted", }); }
public async Task Execute(IJobExecutionContext job) { _log.LogInformation("Starting the Metadata refresh"); await _notification.Clients.Clients(NotificationHub.AdminConnectionIds) .SendAsync(NotificationHub.NotificationEvent, "Metadata Refresh Started"); try { var settings = await _plexSettings.GetSettingsAsync(); if (settings.Enable) { await StartPlex(); await OmbiQuartz.TriggerJob(nameof(IPlexAvailabilityChecker), "Plex"); } var embySettings = await _embySettings.GetSettingsAsync(); if (embySettings.Enable) { await StartEmby(embySettings); await OmbiQuartz.TriggerJob(nameof(IEmbyAvaliabilityChecker), "Emby"); } var jellyfinSettings = await _jellyfinSettings.GetSettingsAsync(); if (jellyfinSettings.Enable) { await StartJellyfin(jellyfinSettings); await OmbiQuartz.TriggerJob(nameof(IJellyfinAvaliabilityChecker), "Jellyfin"); } } catch (Exception e) { _log.LogError(e, $"Exception when refreshing the Metadata Refresh"); await _notification.Clients.Clients(NotificationHub.AdminConnectionIds) .SendAsync(NotificationHub.NotificationEvent, "Metadata Refresh Failed"); return; } await _mediaCacheService.Purge(); _log.LogInformation("Metadata refresh finished"); await _notification.Clients.Clients(NotificationHub.AdminConnectionIds) .SendAsync(NotificationHub.NotificationEvent, "Metadata Refresh Finished"); }
public async Task <RequestEngineResult> ApproveChildRequest(int id) { var request = await TvRepository.GetChild().FirstOrDefaultAsync(x => x.Id == id); if (request == null) { return(new RequestEngineResult { ErrorCode = ErrorCode.ChildRequestDoesNotExist, ErrorMessage = "Child Request does not exist" }); } request.Approved = true; request.Denied = false; foreach (var s in request.SeasonRequests) { foreach (var ep in s.Episodes) { ep.Approved = true; ep.Requested = true; } } await TvRepository.UpdateChild(request); await _mediaCacheService.Purge(); if (request.Approved) { var canNotify = await RunSpecificRule(request, SpecificRules.CanSendNotification, string.Empty); if (canNotify.Success) { await NotificationHelper.Notify(request, NotificationType.RequestApproved); } // Autosend await TvSender.Send(request); } return(new RequestEngineResult { Result = true }); }
public async Task Execute(IJobExecutionContext context) { JobDataMap dataMap = context.JobDetail.JobDataMap; var recentlyAddedSearch = dataMap.GetBooleanValueFromString(JobDataKeys.RecentlyAddedSearch); var plexSettings = await Plex.GetSettingsAsync(); if (!plexSettings.Enable) { return; } await NotifyClient(recentlyAddedSearch? "Plex Recently Added Sync Started" : "Plex Content Sync Started"); if (!ValidateSettings(plexSettings)) { Logger.LogError("Plex Settings are not valid"); await NotifyClient(recentlyAddedSearch? "Plex Recently Added Sync, Settings Not Valid" : "Plex Content, Settings Not Valid"); return; } var processedContent = new ProcessedContent(); Logger.LogInformation(recentlyAddedSearch ? "Starting Plex Content Cacher Recently Added Scan" : "Starting Plex Content Cacher"); try { if (recentlyAddedSearch) { processedContent = await StartTheCache(plexSettings, true); } else { await StartTheCache(plexSettings, false); } } catch (Exception e) { await NotifyClient(recentlyAddedSearch? "Plex Recently Added Sync Errored" : "Plex Content Sync Errored"); Logger.LogWarning(LoggingEvents.PlexContentCacher, e, "Exception thrown when attempting to cache the Plex Content"); } if (!recentlyAddedSearch) { await NotifyClient("Plex Sync - Starting Episode Sync"); Logger.LogInformation("Starting EP Cacher"); await OmbiQuartz.TriggerJob(nameof(IPlexEpisodeSync), "Plex"); } if ((processedContent?.HasProcessedContent ?? false) && recentlyAddedSearch) { await NotifyClient("Plex Sync - Checking if any requests are now available"); Logger.LogInformation("Kicking off Plex Availability Checker"); await _mediaCacheService.Purge(); await OmbiQuartz.TriggerJob(nameof(IPlexAvailabilityChecker), "Plex"); } var processedCont = processedContent?.Content?.Count() ?? 0; var processedEp = processedContent?.Episodes?.Count() ?? 0; Logger.LogInformation("Finished Plex Content Cacher, with processed content: {0}, episodes: {1}. Recently Added Scan: {2}", processedCont, processedEp, recentlyAddedSearch); await NotifyClient(recentlyAddedSearch?$"Plex Recently Added Sync Finished, We processed {processedCont}, and {processedEp} Episodes" : "Plex Content Sync Finished"); }