private async Task Push(PushbulletNotificationSettings settings, string message, string title) { try { var result = await PushbulletApi.PushAsync(settings.AccessToken, title, message, settings.DeviceIdentifier); if (result != null) { Log.Error("Pushbullet api returned a null value, the notification did not get pushed"); } } catch (Exception e) { Log.Error(e); } }
protected override async Task Send(NotificationMessage model, PushbulletNotificationSettings settings) { try { var result = await PushbulletApi.PushAsync(settings.AccessToken, model.Subject, model.Message, settings.DeviceIdentifier); if (result != null) { Log.Error("Pushbullet api returned a null value, the notification did not get pushed"); } } catch (Exception e) { Log.Error(e); } }
private async Task PushTestAsync(NotificationModel model, PushbulletNotificationSettings settings) { var message = "This is just a test! Success!"; var pushTitle = "Plex Requests: Test Message!"; try { var result = await PushbulletApi.PushAsync(settings.AccessToken, pushTitle, message, settings.DeviceIdentifier); if (result != null) { Log.Error("Pushbullet api returned a null value, the notification did not get pushed"); } } catch (Exception e) { Log.Error(e); } }
private async Task PushIssueAsync(NotificationModel model, PushbulletNotificationSettings settings) { var message = $"A new issue: {model.Body} has been reported by user: {model.User} for the title: {model.Title}"; var pushTitle = $"Plex Requests: A new issue has been reported for {model.Title}"; try { var result = await PushbulletApi.PushAsync(settings.AccessToken, pushTitle, message, settings.DeviceIdentifier); if (result != null) { Log.Error("Pushbullet api returned a null value, the notification did not get pushed"); } } catch (Exception e) { Log.Error(e); } }
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) : 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; this.RequiresClaims(UserClaims.Admin); Get["/"] = _ => Admin(); Get["/authentication"] = _ => Authentication(); Post["/authentication"] = _ => SaveAuthentication(); Post["/"] = _ => SaveAdmin(); Post["/requestauth"] = _ => RequestAuthToken(); Get["/getusers"] = _ => GetUsers(); Get["/couchpotato"] = _ => CouchPotato(); Post["/couchpotato"] = _ => SaveCouchPotato(); Get["/plex"] = _ => Plex(); Post["/plex"] = _ => SavePlex(); Get["/sonarr"] = _ => Sonarr(); Post["/sonarr"] = _ => SaveSonarr(); Get["/sickrage"] = _ => Sickrage(); Post["/sickrage"] = _ => SaveSickrage(); Post["/sonarrprofiles"] = _ => GetSonarrQualityProfiles(); Post["/cpprofiles"] = _ => GetCpProfiles(); Get["/emailnotification"] = _ => EmailNotifications(); Post["/emailnotification"] = _ => SaveEmailNotifications(); Post["/testemailnotification"] = _ => TestEmailNotifications(); Get["/status"] = _ => 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(); }
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 void InitializeAlertProvider(AlertSettings settings) { this.AddAlertFunction(DefaultAlert); _api = new PushbulletApi(""); }