Added an option to disable/enable the Plex episode cacher

pull/470/head
tidusjar 8 years ago
parent f8457d1db2
commit 963b4e6ee8

@ -29,6 +29,7 @@ namespace PlexRequests.Core.SettingModels
public sealed class PlexSettings : ExternalSettings
{
public bool AdvancedSearch { get; set; }
public bool EnableTvEpisodeSearching { get; set; }
public string PlexAuthToken { get; set; }
}

@ -71,10 +71,9 @@ namespace PlexRequests.Services.Jobs
private const string TableName = "PlexEpisodes";
public void CacheEpisodes()
public void CacheEpisodes(PlexSettings settings)
{
var videoHashset = new HashSet<Video>();
var settings = Plex.GetSettings();
// Ensure Plex is setup correctly
if (string.IsNullOrEmpty(settings.PlexAuthToken))
{
@ -144,6 +143,12 @@ namespace PlexRequests.Services.Jobs
{
try
{
var s = Plex.GetSettings();
if (!s.EnableTvEpisodeSearching)
{
return;
}
var jobs = Job.GetJobs();
var job = jobs.FirstOrDefault(x => x.Name.Equals(JobNames.EpisodeCacher, StringComparison.CurrentCultureIgnoreCase));
if (job != null)
@ -153,7 +158,7 @@ namespace PlexRequests.Services.Jobs
return;
}
}
CacheEpisodes();
CacheEpisodes(s);
}
catch (Exception e)
{

@ -62,6 +62,25 @@
<small>If enabled we will be able to have a 100% accurate match, but we will be querying Plex for every single item in your library. So if you have a big library then this could take some time.</small>
</div>
<div class="form-group">
<div class="checkbox">
@if (Model.EnableTvEpisodeSearching)
{
<input type="checkbox" id="EnableTvEpisodeSearching" name="EnableTvEpisodeSearching" checked="checked"><label for="EnableTvEpisodeSearching">Enable Episode Searching</label>
}
else
{
<input type="checkbox" id="EnableTvEpisodeSearching" name="EnableTvEpisodeSearching"><label for="EnableTvEpisodeSearching">Enable Episode Searching</label>
}
</div>
<small>
If enabled then we will lookup all episodes on your Plex server and store them in the local database. This will stop episode requests that already exist on Plex (that might not be in Sonarr).
Please be aware that this is a very resource intensive process and while the Plex Episode Cacher job is running the application may appear slow (Depending on the size of your Plex library).
</small>
</div>
<div class="form-group">
<label for="SubDir" class="control-label">Plex Base Url</label>
<div>

Loading…
Cancel
Save