|
|
@ -27,9 +27,12 @@ namespace Ombi.Core.Rule.Rules.Search
|
|
|
|
var useTheMovieDb = false;
|
|
|
|
var useTheMovieDb = false;
|
|
|
|
var useId = false;
|
|
|
|
var useId = false;
|
|
|
|
var useTvDb = false;
|
|
|
|
var useTvDb = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PlexMediaTypeEntity type = ConvertType(obj.Type);
|
|
|
|
|
|
|
|
|
|
|
|
if (obj.ImdbId.HasValue())
|
|
|
|
if (obj.ImdbId.HasValue())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
item = await PlexContentRepository.Get(obj.ImdbId, ProviderType.ImdbId);
|
|
|
|
item = await PlexContentRepository.GetByType(obj.ImdbId, ProviderType.ImdbId, type);
|
|
|
|
if (item != null)
|
|
|
|
if (item != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
useImdb = true;
|
|
|
|
useImdb = true;
|
|
|
@ -39,7 +42,7 @@ namespace Ombi.Core.Rule.Rules.Search
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (obj.Id > 0)
|
|
|
|
if (obj.Id > 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
item = await PlexContentRepository.Get(obj.Id.ToString(), ProviderType.TheMovieDbId);
|
|
|
|
item = await PlexContentRepository.GetByType(obj.Id.ToString(), ProviderType.TheMovieDbId, type);
|
|
|
|
if (item != null)
|
|
|
|
if (item != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
useId = true;
|
|
|
|
useId = true;
|
|
|
@ -47,7 +50,7 @@ namespace Ombi.Core.Rule.Rules.Search
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (obj.TheMovieDbId.HasValue())
|
|
|
|
if (obj.TheMovieDbId.HasValue())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
item = await PlexContentRepository.Get(obj.TheMovieDbId, ProviderType.TheMovieDbId);
|
|
|
|
item = await PlexContentRepository.GetByType(obj.TheMovieDbId, ProviderType.TheMovieDbId, type);
|
|
|
|
if (item != null)
|
|
|
|
if (item != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
useTheMovieDb = true;
|
|
|
|
useTheMovieDb = true;
|
|
|
@ -58,7 +61,7 @@ namespace Ombi.Core.Rule.Rules.Search
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (obj.TheTvDbId.HasValue())
|
|
|
|
if (obj.TheTvDbId.HasValue())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
item = await PlexContentRepository.Get(obj.TheTvDbId, ProviderType.TvDbId);
|
|
|
|
item = await PlexContentRepository.GetByType(obj.TheTvDbId, ProviderType.TvDbId, type);
|
|
|
|
if (item != null)
|
|
|
|
if (item != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
useTvDb = true;
|
|
|
|
useTvDb = true;
|
|
|
@ -100,6 +103,12 @@ namespace Ombi.Core.Rule.Rules.Search
|
|
|
|
return Success();
|
|
|
|
return Success();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private PlexMediaTypeEntity ConvertType(RequestType type) =>
|
|
|
|
|
|
|
|
type switch
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
RequestType.Movie => PlexMediaTypeEntity.Movie,
|
|
|
|
|
|
|
|
RequestType.TvShow => PlexMediaTypeEntity.Show,
|
|
|
|
|
|
|
|
_ => PlexMediaTypeEntity.Movie,
|
|
|
|
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|