Update the availability checker to search for TV Episodes

pull/470/head
tidusjar 8 years ago
parent 4cc698a833
commit 87f343ef06

@ -109,15 +109,23 @@ namespace PlexRequests.Services.Jobs
foreach (var r in requestedModels) foreach (var r in requestedModels)
{ {
var releaseDate = r.ReleaseDate == DateTime.MinValue ? string.Empty : r.ReleaseDate.ToString("yyyy"); var releaseDate = r.ReleaseDate == DateTime.MinValue ? string.Empty : r.ReleaseDate.ToString("yyyy");
bool matchResult; bool matchResult;
switch (r.Type) switch (r.Type)
{ {
case RequestType.Movie: case RequestType.Movie:
matchResult = IsMovieAvailable(movies, r.Title, releaseDate, r.ImdbId); matchResult = IsMovieAvailable(movies, r.Title, releaseDate, r.ImdbId);
break; break;
case RequestType.TvShow: case RequestType.TvShow:
matchResult = IsTvShowAvailable(shows, r.Title, releaseDate, r.TvDbId); if (!plexSettings.EnableTvEpisodeSearching)
{
matchResult = IsTvShowAvailable(shows, r.Title, releaseDate, r.TvDbId);
}
else
{
matchResult =
r.Episodes.All(x => IsEpisodeAvailable(r.TvDbId, x.SeasonNumber, x.EpisodeNumber));
}
break; break;
case RequestType.Album: case RequestType.Album:
matchResult = IsAlbumAvailable(albums, r.Title, r.ReleaseDate.Year.ToString(), r.ArtistName); matchResult = IsAlbumAvailable(albums, r.Title, r.ReleaseDate.Year.ToString(), r.ArtistName);
@ -126,6 +134,7 @@ namespace PlexRequests.Services.Jobs
throw new ArgumentOutOfRangeException(); throw new ArgumentOutOfRangeException();
} }
if (matchResult) if (matchResult)
{ {
r.Available = true; r.Available = true;

Loading…
Cancel
Save