Пример #1
0
        private void CreateDefaultSettingsPage(string baseUrl)
        {
            var defaultUserSettings = new UserManagementSettings
            {
                RequestMovies  = true,
                RequestTvShows = true,
                ReportIssues   = true,
            };
            var defaultSettings = new PlexRequestSettings
            {
                SearchForMovies     = true,
                SearchForTvShows    = true,
                SearchForActors     = true,
                BaseUrl             = baseUrl ?? string.Empty,
                CollectAnalyticData = true,
            };
            var ctor = new SettingsJsonRepository(new DbConfiguration(new SqliteFactory()), new MemoryCacheProvider());
            var s    = new SettingsServiceV2 <PlexRequestSettings>(ctor);

            s.SaveSettings(defaultSettings);

            var userSettings = new SettingsServiceV2 <UserManagementSettings>(ctor);

            userSettings.SaveSettings(defaultUserSettings);


            var cron      = (Quartz.Impl.Triggers.CronTriggerImpl)CronScheduleBuilder.WeeklyOnDayAndHourAndMinute(DayOfWeek.Friday, 7, 0).Build();
            var scheduled = new ScheduledJobsSettings
            {
                PlexAvailabilityChecker  = 60,
                SickRageCacher           = 60,
                SonarrCacher             = 60,
                CouchPotatoCacher        = 60,
                StoreBackup              = 24,
                StoreCleanup             = 24,
                UserRequestLimitResetter = 12,
                PlexEpisodeCacher        = 12,
                RecentlyAddedCron        = cron.CronExpressionString, // Weekly CRON at 7 am on Mondays
            };

            var scheduledSettings = new SettingsServiceV2 <ScheduledJobsSettings>(new SettingsJsonRepository(new DbConfiguration(new SqliteFactory()), new MemoryCacheProvider()));

            scheduledSettings.SaveSettings(scheduled);
        }
Пример #2
0
 private void CacheCouchPotatoQualityProfiles(ICacheProvider cacheProvider)
 {
     try
     {
         var cpSettingsService = new SettingsServiceV2 <CouchPotatoSettings>(new SettingsJsonRepository(new DbConfiguration(new SqliteFactory()), cacheProvider));
         var cpSettings        = cpSettingsService.GetSettings();
         if (cpSettings.Enabled)
         {
             Log.Info("Begin executing GetProfiles call to CouchPotato for quality profiles");
             CouchPotatoApi cpApi    = new CouchPotatoApi();
             var            profiles = cpApi.GetProfiles(cpSettings.FullUri, cpSettings.ApiKey);
             cacheProvider.Set(CacheKeys.CouchPotatoQualityProfiles, profiles);
             Log.Info("Finished executing GetProfiles call to CouchPotato for quality profiles");
         }
     }
     catch (Exception ex)
     {
         Log.Error(ex, "Failed to cache CouchPotato quality profiles!");
     }
 }
Пример #3
0
 private void CacheRadarrQualityProfiles(ICacheProvider cacheProvider)
 {
     try
     {
         var radarrService  = new SettingsServiceV2 <RadarrSettings>(new SettingsJsonRepository(new DbConfiguration(new SqliteFactory()), cacheProvider));
         var radarrSettings = radarrService.GetSettings();
         if (radarrSettings.Enabled)
         {
             Log.Info("Begin executing GetProfiles call to Radarr for quality profiles");
             RadarrApi radarrApi = new RadarrApi();
             var       profiles  = radarrApi.GetProfiles(radarrSettings.ApiKey, radarrSettings.FullUri);
             cacheProvider.Set(CacheKeys.RadarrQualityProfiles, profiles);
             Log.Info("Finished executing GetProfiles call to Radarr for quality profiles");
         }
     }
     catch (Exception ex)
     {
         Log.Error(ex, "Failed to cache Sonarr quality profiles!");
     }
 }