mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-29 19:18:30 -07:00
commit
09ac8406bf
5 changed files with 34 additions and 7 deletions
|
@ -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,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -107,7 +107,7 @@ namespace Ombi.Helpers
|
||||||
public static string GetPlexMediaUrl(string machineId, int mediaId)
|
public static string GetPlexMediaUrl(string machineId, int mediaId)
|
||||||
{
|
{
|
||||||
var url =
|
var url =
|
||||||
$"https://app.plex.tv/web/app#!/server/{machineId}/details?key=library%2Fmetadata%2F{mediaId}";
|
$"https://app.plex.tv/web/app#!/server/{machineId}/details?key=%2flibrary%2Fmetadata%2F{mediaId}";
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ namespace Ombi.Store.Repository
|
||||||
{
|
{
|
||||||
Task<bool> ContentExists(string providerId);
|
Task<bool> ContentExists(string providerId);
|
||||||
Task<PlexServerContent> Get(string providerId, ProviderType type);
|
Task<PlexServerContent> Get(string providerId, ProviderType type);
|
||||||
|
Task<PlexServerContent> GetByType(string providerId, ProviderType type, PlexMediaTypeEntity plexType);
|
||||||
Task<PlexServerContent> GetByKey(int key);
|
Task<PlexServerContent> GetByKey(int key);
|
||||||
Task Update(PlexServerContent existingContent);
|
Task Update(PlexServerContent existingContent);
|
||||||
IQueryable<PlexEpisode> GetAllEpisodes();
|
IQueryable<PlexEpisode> GetAllEpisodes();
|
||||||
|
|
|
@ -79,6 +79,23 @@ namespace Ombi.Store.Repository
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<PlexServerContent> GetByType(string providerId, ProviderType type, PlexMediaTypeEntity plexType)
|
||||||
|
{
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case ProviderType.ImdbId:
|
||||||
|
return await Db.PlexServerContent.FirstOrDefaultAsync(x => x.ImdbId == providerId && x.Type == plexType);
|
||||||
|
case ProviderType.TheMovieDbId:
|
||||||
|
return await Db.PlexServerContent.FirstOrDefaultAsync(x => x.TheMovieDbId == providerId && x.Type == plexType);
|
||||||
|
case ProviderType.TvDbId:
|
||||||
|
return await Db.PlexServerContent.FirstOrDefaultAsync(x => x.TvDbId == providerId && x.Type == plexType);
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public async Task<PlexServerContent> GetByKey(int key)
|
public async Task<PlexServerContent> GetByKey(int key)
|
||||||
{
|
{
|
||||||
return await Db.PlexServerContent.Include(x => x.Seasons).FirstOrDefaultAsync(x => x.Key == key);
|
return await Db.PlexServerContent.Include(x => x.Seasons).FirstOrDefaultAsync(x => x.Key == key);
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
{{'Search.ViewOnEmby' | translate}}
|
{{'Search.ViewOnEmby' | translate}}
|
||||||
<i class="far fa-play-circle fa-2x"></i>
|
<i class="far fa-play-circle fa-2x"></i>
|
||||||
</a>
|
</a>
|
||||||
<a id="viewOnJellyfinButton" *ngIf="movie.jellyfinUrl" href="{{movie.jellyfinUrl}}" mat-raised-button target="_blank" class="btn-spacing viewon-btn jellyfinUrl">
|
<a id="viewOnJellyfinButton" *ngIf="movie.jellyfinUrl" href="{{movie.jellyfinUrl}}" mat-raised-button target="_blank" class="btn-spacing viewon-btn jellyfin">
|
||||||
{{'Search.ViewOnJellyfin' | translate}}
|
{{'Search.ViewOnJellyfin' | translate}}
|
||||||
<i class="far fa-play-circle fa-2x"></i>
|
<i class="far fa-play-circle fa-2x"></i>
|
||||||
</a>
|
</a>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue