mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-21 05:43:19 -07:00
Fixed the issue where we wouldn't correctly mark some shows as available when there was no provider id #2429
This commit is contained in:
parent
e4f90e6c17
commit
51f5bbc6a8
1 changed files with 36 additions and 18 deletions
|
@ -381,6 +381,19 @@ namespace Ombi.Schedule.Jobs.Plex
|
|||
|
||||
if (existingContent != null)
|
||||
{
|
||||
// Let's make sure that we have some sort of ID e.g. Imdbid for this,
|
||||
// Looks like it's possible to not have an Id for a show
|
||||
// I suspect we cached that show just as it was added to Plex.
|
||||
|
||||
if (!existingContent.HasImdb && !existingContent.HasTheMovieDb && !existingContent.HasTvDb)
|
||||
{
|
||||
var showMetadata = await PlexApi.GetMetadata(servers.PlexAuthToken, servers.FullUri,
|
||||
existingContent.Key);
|
||||
GetProviderIds(showMetadata, existingContent);
|
||||
|
||||
await Repo.Update(existingContent);
|
||||
}
|
||||
|
||||
// Just check the key
|
||||
if (existingKey != null)
|
||||
{
|
||||
|
@ -478,10 +491,7 @@ namespace Ombi.Schedule.Jobs.Plex
|
|||
// But it does not contain the `guid` property that we need to pull out thetvdb id...
|
||||
var showMetadata = await PlexApi.GetMetadata(servers.PlexAuthToken, servers.FullUri,
|
||||
show.ratingKey);
|
||||
var providerIds =
|
||||
PlexHelper.GetProviderIdFromPlexGuid(showMetadata.MediaContainer.Metadata.FirstOrDefault()
|
||||
.guid);
|
||||
|
||||
|
||||
var item = new PlexServerContent
|
||||
{
|
||||
AddedAt = DateTime.Now,
|
||||
|
@ -492,20 +502,7 @@ namespace Ombi.Schedule.Jobs.Plex
|
|||
Url = PlexHelper.GetPlexMediaUrl(servers.MachineIdentifier, show.ratingKey),
|
||||
Seasons = new List<PlexSeasonsContent>()
|
||||
};
|
||||
if (providerIds.Type == ProviderType.ImdbId)
|
||||
{
|
||||
item.ImdbId = providerIds.ImdbId;
|
||||
}
|
||||
|
||||
if (providerIds.Type == ProviderType.TheMovieDbId)
|
||||
{
|
||||
item.TheMovieDbId = providerIds.TheMovieDb;
|
||||
}
|
||||
|
||||
if (providerIds.Type == ProviderType.TvDbId)
|
||||
{
|
||||
item.TvDbId = providerIds.TheTvDb;
|
||||
}
|
||||
GetProviderIds(showMetadata, item);
|
||||
|
||||
// Let's just double check to make sure we do not have it now we have some id's
|
||||
var existingImdb = false;
|
||||
|
@ -547,6 +544,27 @@ namespace Ombi.Schedule.Jobs.Plex
|
|||
}
|
||||
}
|
||||
|
||||
private static void GetProviderIds(PlexMetadata showMetadata, PlexServerContent existingContent)
|
||||
{
|
||||
var providerIds =
|
||||
PlexHelper.GetProviderIdFromPlexGuid(showMetadata.MediaContainer.Metadata.FirstOrDefault()
|
||||
.guid);
|
||||
if (providerIds.Type == ProviderType.ImdbId)
|
||||
{
|
||||
existingContent.ImdbId = providerIds.ImdbId;
|
||||
}
|
||||
|
||||
if (providerIds.Type == ProviderType.TheMovieDbId)
|
||||
{
|
||||
existingContent.TheMovieDbId = providerIds.TheMovieDb;
|
||||
}
|
||||
|
||||
if (providerIds.Type == ProviderType.TvDbId)
|
||||
{
|
||||
existingContent.TvDbId = providerIds.TheTvDb;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets all the library sections.
|
||||
/// If the user has specified only certain libraries then we will only look for those
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue