public bool OnJobStatusChanged(IJobRecord record) { bool hasChanges = false; for (int i = 0; i < criteria.Count;) { if (criteria[i].Item1 == record.ID) { if (criteria[i].Item2 <= record.Status) { criteria.RemoveAt(i); hasChanges = true; } else if (criteria[i].Item2 < 0) // Job failed { result = false; criteria.RemoveAt(i); hasChanges = true; } else { i++; } } else { i++; } } return(hasChanges); }
public RadarrCacher(ISettingsService <RadarrSettings> radarrService, IRadarrApi radarrApi, ICacheProvider cache, IJobRecord rec) { RadarrSettings = radarrService; RadarrApi = radarrApi; Job = rec; Cache = cache; }
private void OnJobStarted(IJobRecord record) { var nj = new NodeJob(record, this); jobs.Add(nj); Task.Factory.StartNew(() => { try { nj.Record.Action(nj).ContinueWith(t => { switch (t.Status) { case TaskStatus.Canceled: case TaskStatus.Faulted: nj.Status = -1; break; case TaskStatus.RanToCompletion: nj.Status = Int32.MaxValue; break; } }); } catch { nj.Status = -1; } }, TaskCreationOptions.LongRunning); UpdateNodeStatus(); }
public FaultQueueHandler(IJobRecord record, IRepository <RequestQueue> repo, ISonarrApi sonarrApi, ISickRageApi srApi, ISettingsService <SonarrSettings> sonarrSettings, ISettingsService <SickRageSettings> srSettings, ICouchPotatoApi cpApi, ISettingsService <CouchPotatoSettings> cpsettings, IRequestService requestService, ISettingsService <HeadphonesSettings> hpSettings, IHeadphonesApi headphonesApi, ISettingsService <PlexRequestSettings> prSettings, ISecurityExtensions security, IMovieSender movieSender, ICacheProvider cache) { Record = record; Repo = repo; SonarrApi = sonarrApi; SrApi = srApi; CpApi = cpApi; HpApi = headphonesApi; RequestService = requestService; SickrageSettings = srSettings; SonarrSettings = sonarrSettings; CpSettings = cpsettings; HeadphoneSettings = hpSettings; Security = security; PrSettings = prSettings.GetSettings(); MovieSender = movieSender; Cache = cache; }
public CouchPotatoCacher(ISettingsService <CouchPotatoSettings> cpSettings, ICouchPotatoApi cpApi, ICacheProvider cache, IJobRecord rec) { CpSettings = cpSettings; CpApi = cpApi; Cache = cache; Job = rec; }
public SickRageCacher(ISettingsService <SickRageSettings> srSettings, ISickRageApi srApi, ICacheProvider cache, IJobRecord rec) { SrSettings = srSettings; SrApi = srApi; Cache = cache; Job = rec; }
private void OnJobStatusChanged(IJobRecord record) { // Unblock potential waitings foreach (var j in jobs) { j.OnJobStatusChanged(record); } // Remove records for finished or failed tasks var nj = jobs.FirstOrDefault(j => j.ID == record.ID); if (nj != null && (record.Status == JobStatus.RanToCompletion || record.Status <= JobStatus.Faulted)) { jobs.Remove(nj); } // Unblock potential external waiters for (int i = 0; i < extWaitings.Count;) { extWaitings[i].OnJobStatusChanged(record); if (extWaitings[i].IsComplete) { extWaitings[i].Unblock(); extWaitings.RemoveAt(i); } else { i++; } } // Take more jobs if it is possible TrySchedule(); }
public SonarrCacher(ISettingsService <SonarrSettings> sonarrSettings, ISonarrApi sonarrApi, ICacheProvider cache, IJobRecord rec) { SonarrSettings = sonarrSettings; SonarrApi = sonarrApi; Job = rec; Cache = cache; }
public WatcherCacher( ISettingsService <WatcherSettings> watcher, IWatcherApi watcherApi, ICacheProvider cache, IJobRecord rec) { WatcherSettings = watcher; WatcherApi = watcherApi; Cache = cache; Job = rec; }
public EmbyEpisodeCacher(ISettingsService <EmbySettings> embySettings, IEmbyApi emby, ICacheProvider cache, IJobRecord rec, IRepository <EmbyEpisodes> repo, ISettingsService <ScheduledJobsSettings> jobs) { Emby = embySettings; EmbyApi = emby; Cache = cache; Job = rec; Repo = repo; Jobs = jobs; }
public LayoutModule(ICacheProvider provider, ISettingsService <PlexRequestSettings> pr, ISettingsService <SystemSettings> settings, IJobRecord rec, ISecurityExtensions security) : base("layout", pr, security) { Cache = provider; SystemSettings = settings; Job = rec; Get["/", true] = async(x, ct) => await CheckLatestVersion(); Get["/cacher", true] = async(x, ct) => await CacherRunning(); }
public PlexEpisodeCacher(ISettingsService <PlexSettings> plexSettings, IPlexApi plex, ICacheProvider cache, IJobRecord rec, IRepository <PlexEpisodes> repo, ISettingsService <ScheduledJobsSettings> jobs) { Plex = plexSettings; PlexApi = plex; Cache = cache; Job = rec; Repo = repo; Jobs = jobs; }
public EmbyContentCacher(ISettingsService <EmbySettings> embySettings, IRequestService request, IEmbyApi emby, ICacheProvider cache, IJobRecord rec, IRepository <EmbyEpisodes> repo, IRepository <EmbyContent> content) { Emby = embySettings; RequestService = request; EmbyApi = emby; Cache = cache; Job = rec; EpisodeRepo = repo; EmbyContent = content; }
public PlexUserChecker(IPlexUserRepository plexUsers, IPlexApi plexAPi, IJobRecord rec, ISettingsService <PlexSettings> plexSettings, ISettingsService <PlexRequestSettings> prSettings, ISettingsService <UserManagementSettings> umSettings, IRequestService requestService, IUserRepository localUser) { Repo = plexUsers; JobRecord = rec; PlexApi = plexAPi; PlexSettings = plexSettings; PlexRequestSettings = prSettings; UserManagementSettings = umSettings; RequestService = requestService; LocalUserRepository = localUser; }
public RecentlyAdded(IPlexApi api, ISettingsService <PlexSettings> plexSettings, ISettingsService <EmailNotificationSettings> email, IJobRecord rec, ISettingsService <NewletterSettings> newsletter, IPlexReadOnlyDatabase db) { JobRecord = rec; Api = api; PlexSettings = plexSettings; EmailSettings = email; NewsletterSettings = newsletter; PlexDb = db; }
public PlexAvailabilityChecker(ISettingsService<PlexSettings> plexSettings, ISettingsService<AuthenticationSettings> auth, IRequestService request, IPlexApi plex, ICacheProvider cache, INotificationService notify, IJobRecord rec, IRepository<UsersToNotify> users) { Plex = plexSettings; Auth = auth; RequestService = request; PlexApi = plex; Cache = cache; Notification = notify; Job = rec; UserNotifyRepo = users; }
public EmbyUserChecker(IExternalUserRepository <EmbyUsers> plexUsers, IEmbyApi embyApi, IJobRecord rec, ISettingsService <EmbySettings> embyS, ISettingsService <PlexRequestSettings> prSettings, ISettingsService <UserManagementSettings> umSettings, IRequestService requestService, IUserRepository localUser) { Repo = plexUsers; JobRecord = rec; EmbyApi = embyApi; EmbySettings = embyS; PlexRequestSettings = prSettings; UserManagementSettings = umSettings; RequestService = requestService; LocalUserRepository = localUser; }
public PlexAvailabilityChecker(ISettingsService <PlexSettings> plexSettings, IRequestService request, IPlexApi plex, ICacheProvider cache, INotificationService notify, IJobRecord rec, IRepository <UsersToNotify> users, IRepository <PlexEpisodes> repo, INotificationEngine e) { Plex = plexSettings; RequestService = request; PlexApi = plex; Cache = cache; Notification = notify; Job = rec; UserNotifyRepo = users; EpisodeRepo = repo; NotificationEngine = e; }
public EmbyAvailabilityChecker(ISettingsService <EmbySettings> embySettings, IRequestService request, IEmbyApi emby, ICacheProvider cache, INotificationService notify, IJobRecord rec, IRepository <UsersToNotify> users, IRepository <EmbyEpisodes> repo, IEmbyNotificationEngine e, IRepository <EmbyContent> content) { Emby = embySettings; RequestService = request; EmbyApi = emby; Cache = cache; Notification = notify; Job = rec; UserNotifyRepo = users; EpisodeRepo = repo; NotificationEngine = e; EmbyContent = content; }
public void OnJobStatusChanged(IJobRecord record) { if (JobStatus == NodeJobStatus.Blocked) { bool hasChanges = false; foreach (var w in Waitings) { hasChanges = hasChanges || w.OnJobStatusChanged(record); } if (Waitings.All(w => w.IsComplete) && IOs.All(i => i.IsComplete)) { JobStatus = NodeJobStatus.Ready; ReadyTime = DateTime.Now; } } }
public RecentlyAddedNewsletter(IPlexApi api, ISettingsService <PlexSettings> plexSettings, ISettingsService <EmailNotificationSettings> email, IJobRecord rec, ISettingsService <NewletterSettings> newsletter, IUserHelper userHelper, IEmbyAddedNewsletter embyNews, ISettingsService <EmbySettings> embyS, IPlexNewsletter plex) { JobRecord = rec; Api = api; PlexSettings = plexSettings; EmailSettings = email; NewsletterSettings = newsletter; UserHelper = userHelper; EmbyNewsletter = embyNews; EmbySettings = embyS; PlexNewsletter = plex; }
public void SetJobStatus(int id, int status) { IJobRecord changedJob = null; lock (this) { var job = jobs.FirstOrDefault(j => j.ID == id); if (job != null) { if (job.Status != status) { job.Status = status; changedJob = job; } job.AccessTime = DateTime.Now; } } if (changedJob != null) { jobStatusChanged.OnNext(changedJob); } }
private Job(IJobRecord record, IJobDatabase database, bool needDispose) { this.record = record; this.database = database; }
public AdminModule(ISettingsService <PlexRequestSettings> prService, ISettingsService <CouchPotatoSettings> cpService, ISettingsService <AuthenticationSettings> auth, ISettingsService <PlexSettings> plex, ISettingsService <SonarrSettings> sonarr, ISettingsService <SickRageSettings> sickrage, ISonarrApi sonarrApi, ISettingsService <EmailNotificationSettings> email, IPlexApi plexApi, ISettingsService <PushbulletNotificationSettings> pbSettings, PushbulletApi pbApi, ICouchPotatoApi cpApi, ISettingsService <PushoverNotificationSettings> pushoverSettings, IPushoverApi pushoverApi, IRepository <LogEntity> logsRepo, INotificationService notify, ISettingsService <HeadphonesSettings> headphones, ISettingsService <LogSettings> logs, ICacheProvider cache, ISettingsService <SlackNotificationSettings> slackSettings, ISlackApi slackApi, ISettingsService <LandingPageSettings> lp, ISettingsService <ScheduledJobsSettings> scheduler, IJobRecord rec, IAnalytics analytics) : base("admin", prService) { PrService = prService; CpService = cpService; AuthService = auth; PlexService = plex; SonarrService = sonarr; SonarrApi = sonarrApi; EmailService = email; PlexApi = plexApi; PushbulletService = pbSettings; PushbulletApi = pbApi; CpApi = cpApi; SickRageService = sickrage; LogsRepo = logsRepo; PushoverService = pushoverSettings; PushoverApi = pushoverApi; NotificationService = notify; HeadphonesService = headphones; LogService = logs; Cache = cache; SlackSettings = slackSettings; SlackApi = slackApi; LandingSettings = lp; ScheduledJobSettings = scheduler; JobRecorder = rec; Analytics = analytics; this.RequiresClaims(UserClaims.Admin); Get["/"] = _ => Admin(); Get["/authentication", true] = async(x, ct) => await Authentication(); Post["/authentication", true] = async(x, ct) => await SaveAuthentication(); Post["/", true] = async(x, ct) => await SaveAdmin(); Post["/requestauth"] = _ => RequestAuthToken(); Get["/getusers"] = _ => GetUsers(); Get["/couchpotato"] = _ => CouchPotato(); Post["/couchpotato"] = _ => SaveCouchPotato(); Get["/plex"] = _ => Plex(); Post["/plex", true] = async(x, ct) => await SavePlex(); Get["/sonarr"] = _ => Sonarr(); Post["/sonarr"] = _ => SaveSonarr(); Get["/sickrage"] = _ => Sickrage(); Post["/sickrage"] = _ => SaveSickrage(); Post["/sonarrprofiles"] = _ => GetSonarrQualityProfiles(); Post["/cpprofiles", true] = async(x, ct) => await GetCpProfiles(); Post["/cpapikey"] = x => GetCpApiKey(); Get["/emailnotification"] = _ => EmailNotifications(); Post["/emailnotification"] = _ => SaveEmailNotifications(); Post["/testemailnotification"] = _ => TestEmailNotifications(); Get["/status", true] = async(x, ct) => await Status(); Get["/pushbulletnotification"] = _ => PushbulletNotifications(); Post["/pushbulletnotification"] = _ => SavePushbulletNotifications(); Post["/testpushbulletnotification"] = _ => TestPushbulletNotifications(); Get["/pushovernotification"] = _ => PushoverNotifications(); Post["/pushovernotification"] = _ => SavePushoverNotifications(); Post["/testpushovernotification"] = _ => TestPushoverNotifications(); Get["/logs"] = _ => Logs(); Get["/loglevel"] = _ => GetLogLevels(); Post["/loglevel"] = _ => UpdateLogLevels(Request.Form.level); Get["/loadlogs"] = _ => LoadLogs(); Get["/headphones"] = _ => Headphones(); Post["/headphones"] = _ => SaveHeadphones(); Post["/createapikey"] = x => CreateApiKey(); Post["/autoupdate"] = x => AutoUpdate(); Post["/testslacknotification"] = _ => TestSlackNotification(); Get["/slacknotification"] = _ => SlackNotifications(); Post["/slacknotification"] = _ => SaveSlackNotifications(); Get["/landingpage", true] = async(x, ct) => await LandingPage(); Post["/landingpage", true] = async(x, ct) => await SaveLandingPage(); Get["/scheduledjobs", true] = async(x, ct) => await GetScheduledJobs(); Post["/scheduledjobs", true] = async(x, ct) => await SaveScheduledJobs(); Post["/clearlogs", true] = async(x, ct) => await ClearLogs(); }
public UserRequestLimitResetter(IJobRecord record, IRepository <RequestLimit> repo, ISettingsService <PlexRequestSettings> settings) { Record = record; Repo = repo; Settings = settings; }
public StoreBackup(ISqliteConfiguration sql, IJobRecord rec) { Sql = sql; JobRecord = rec; }
public Job(IJobRecord record, IJobDatabase database) : this(record, database, true) { }
public NodeJob(IJobRecord record, NodeJobManager manager) : base(record, manager.database) { this.manager = manager; }
public AdminModule(ISettingsService <PlexRequestSettings> prService, ISettingsService <CouchPotatoSettings> cpService, ISettingsService <AuthenticationSettings> auth, ISettingsService <PlexSettings> plex, ISettingsService <SonarrSettings> sonarr, ISettingsService <SickRageSettings> sickrage, ISonarrApi sonarrApi, ISettingsService <EmailNotificationSettings> email, IPlexApi plexApi, ISettingsService <PushbulletNotificationSettings> pbSettings, PushbulletApi pbApi, ICouchPotatoApi cpApi, ISettingsService <PushoverNotificationSettings> pushoverSettings, ISettingsService <NewletterSettings> newsletter, IPushoverApi pushoverApi, IRepository <LogEntity> logsRepo, INotificationService notify, ISettingsService <HeadphonesSettings> headphones, ISettingsService <LogSettings> logs, ICacheProvider cache, ISettingsService <SlackNotificationSettings> slackSettings, ISlackApi slackApi, ISettingsService <LandingPageSettings> lp, ISettingsService <ScheduledJobsSettings> scheduler, IJobRecord rec, IAnalytics analytics, ISettingsService <NotificationSettingsV2> notifyService, IRecentlyAdded recentlyAdded, ISettingsService <WatcherSettings> watcherSettings , ISecurityExtensions security) : base("admin", prService, security) { PrService = prService; CpService = cpService; AuthService = auth; PlexService = plex; SonarrService = sonarr; SonarrApi = sonarrApi; EmailService = email; PlexApi = plexApi; PushbulletService = pbSettings; PushbulletApi = pbApi; CpApi = cpApi; SickRageService = sickrage; LogsRepo = logsRepo; PushoverService = pushoverSettings; PushoverApi = pushoverApi; NotificationService = notify; HeadphonesService = headphones; NewsLetterService = newsletter; LogService = logs; Cache = cache; SlackSettings = slackSettings; SlackApi = slackApi; LandingSettings = lp; ScheduledJobSettings = scheduler; JobRecorder = rec; Analytics = analytics; NotifySettings = notifyService; RecentlyAdded = recentlyAdded; WatcherSettings = watcherSettings; Before += (ctx) => Security.AdminLoginRedirect(Permissions.Administrator, ctx); Get["/"] = _ => Admin(); Get["/authentication", true] = async(x, ct) => await Authentication(); Post["/authentication", true] = async(x, ct) => await SaveAuthentication(); Post["/", true] = async(x, ct) => await SaveAdmin(); Post["/requestauth"] = _ => RequestAuthToken(); Get["/getusers"] = _ => GetUsers(); Get["/couchpotato"] = _ => CouchPotato(); Post["/couchpotato"] = _ => SaveCouchPotato(); Get["/plex"] = _ => Plex(); Post["/plex", true] = async(x, ct) => await SavePlex(); Get["/sonarr"] = _ => Sonarr(); Post["/sonarr"] = _ => SaveSonarr(); Get["/sickrage"] = _ => Sickrage(); Post["/sickrage"] = _ => SaveSickrage(); Post["/sonarrprofiles"] = _ => GetSonarrQualityProfiles(); Post["/cpprofiles", true] = async(x, ct) => await GetCpProfiles(); Post["/cpapikey"] = x => GetCpApiKey(); Get["/emailnotification"] = _ => EmailNotifications(); Post["/emailnotification"] = _ => SaveEmailNotifications(); Post["/testemailnotification", true] = async(x, ct) => await TestEmailNotifications(); Get["/pushbulletnotification"] = _ => PushbulletNotifications(); Post["/pushbulletnotification"] = _ => SavePushbulletNotifications(); Post["/testpushbulletnotification", true] = async(x, ct) => await TestPushbulletNotifications(); Get["/pushovernotification"] = _ => PushoverNotifications(); Post["/pushovernotification"] = _ => SavePushoverNotifications(); Post["/testpushovernotification", true] = async(x, ct) => await TestPushoverNotifications(); Get["/logs"] = _ => Logs(); Get["/loglevel"] = _ => GetLogLevels(); Post["/loglevel"] = _ => UpdateLogLevels(Request.Form.level); Get["/loadlogs"] = _ => LoadLogs(); Get["/headphones"] = _ => Headphones(); Post["/headphones"] = _ => SaveHeadphones(); Get["/newsletter"] = _ => Newsletter(); Post["/newsletter"] = _ => SaveNewsletter(); Post["/createapikey"] = x => CreateApiKey(); Post["/testslacknotification", true] = async(x, ct) => await TestSlackNotification(); Get["/slacknotification"] = _ => SlackNotifications(); Post["/slacknotification"] = _ => SaveSlackNotifications(); Get["/landingpage", true] = async(x, ct) => await LandingPage(); Post["/landingpage", true] = async(x, ct) => await SaveLandingPage(); Get["/scheduledjobs", true] = async(x, ct) => await GetScheduledJobs(); Post["/scheduledjobs", true] = async(x, ct) => await SaveScheduledJobs(); Post["/clearlogs", true] = async(x, ct) => await ClearLogs(); Get["/notificationsettings", true] = async(x, ct) => await NotificationSettings(); Post["/notificationsettings"] = x => SaveNotificationSettings(); Post["/recentlyAddedTest"] = x => RecentlyAddedTest(); }
public StoreCleanup(IRepository <LogEntity> repo, IJobRecord rec) { Repo = repo; JobRecord = rec; }