mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-19 12:59:39 -07:00
Fixed the availability checker
This commit is contained in:
parent
7132b61c40
commit
0fdc5e47be
1 changed files with 37 additions and 3 deletions
|
@ -43,8 +43,31 @@ namespace Ombi.Schedule.Jobs.Plex
|
||||||
|
|
||||||
foreach (var child in tv)
|
foreach (var child in tv)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
PlexServerContent item = null;
|
||||||
|
var useImdb = false;
|
||||||
|
var useTvDb = false;
|
||||||
|
if (child.ParentRequest.ImdbId.HasValue())
|
||||||
|
{
|
||||||
|
useImdb = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (child.ParentRequest.TvDbId.ToString().HasValue())
|
||||||
|
{
|
||||||
|
useTvDb = true;
|
||||||
|
}
|
||||||
|
|
||||||
var tvDbId = child.ParentRequest.TvDbId;
|
var tvDbId = child.ParentRequest.TvDbId;
|
||||||
var seriesEpisodes = plexEpisodes.Where(x => x.Series.TvDbId == tvDbId.ToString());
|
var imdbId = child.ParentRequest.ImdbId;
|
||||||
|
IQueryable<PlexEpisode> seriesEpisodes = null;
|
||||||
|
if (useImdb)
|
||||||
|
{
|
||||||
|
seriesEpisodes = plexEpisodes.Where(x => x.Series.ImdbId == imdbId.ToString());
|
||||||
|
}
|
||||||
|
if (useTvDb)
|
||||||
|
{
|
||||||
|
seriesEpisodes = plexEpisodes.Where(x => x.Series.TvDbId == tvDbId.ToString());
|
||||||
|
}
|
||||||
foreach (var season in child.SeasonRequests)
|
foreach (var season in child.SeasonRequests)
|
||||||
{
|
{
|
||||||
foreach (var episode in season.Episodes)
|
foreach (var episode in season.Episodes)
|
||||||
|
@ -87,8 +110,19 @@ namespace Ombi.Schedule.Jobs.Plex
|
||||||
|
|
||||||
foreach (var movie in movies)
|
foreach (var movie in movies)
|
||||||
{
|
{
|
||||||
var plexContent = await _repo.Get(movie.ImdbId);
|
PlexServerContent item = null;
|
||||||
if (plexContent == null)
|
if (movie.ImdbId.HasValue())
|
||||||
|
{
|
||||||
|
item = await _repo.Get(movie.ImdbId);
|
||||||
|
}
|
||||||
|
if (item == null)
|
||||||
|
{
|
||||||
|
if (movie.TheMovieDbId.ToString().HasValue())
|
||||||
|
{
|
||||||
|
item = await _repo.Get(movie.TheMovieDbId.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (item == null)
|
||||||
{
|
{
|
||||||
// We don't yet have this
|
// We don't yet have this
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue