fix(plex): Fixed some errors around the scanner that was causing the scan to fail

translations
TidusJar 3 months ago
parent be886eed3c
commit d9787dc32a

@ -7,6 +7,7 @@ using Microsoft.Extensions.Logging;
using Ombi.Api.Emby;
using Ombi.Api.Jellyfin;
using Ombi.Api.Plex;
using Ombi.Api.Plex.Models;
using Ombi.Api.TheMovieDb;
using Ombi.Api.TheMovieDb.Models;
using Ombi.Api.TvMaze;
@ -286,7 +287,18 @@ namespace Ombi.Schedule.Jobs.Ombi
continue;
}
var servers = settings.Servers[0];
var metaData = await _plexApi.GetMetadata(servers.PlexAuthToken, settings.Servers[0].FullUri, movie.Key);
PlexMetadata metaData = null;
try
{
metaData = await _plexApi.GetMetadata(servers.PlexAuthToken, settings.Servers[0].FullUri, movie.Key);
}
catch (Exception e)
{
_log.LogError($"Could not find the metadata for title: '{movie.Title}', skipping");
_log.LogDebug(e, $"Could not find the metadata for title: '{movie.Title}', skipping");
continue;
}
var guids = new List<string>();
var meta = metaData.MediaContainer.Metadata.FirstOrDefault();

@ -304,6 +304,13 @@ namespace Ombi.Schedule.Jobs.Plex
var existing = await Repo.GetFirstContentByCustom(x => x.Title == movie.title
&& x.ReleaseYear == movie.year.ToString()
&& x.Type == MediaType.Movie);
if (existing == null)
{
// Let's just check the key
existing = await Repo.GetByKey(movie.ratingKey);
}
if (existing != null)
{
// We need to see if this is a different quality,
@ -342,12 +349,6 @@ namespace Ombi.Schedule.Jobs.Plex
continue;
}
//var hasSameKey = await Repo.GetByKey(movie.ratingKey);
//if (hasSameKey != null)
//{
// await Repo.Delete(hasSameKey);
//}
Logger.LogDebug("Adding movie {0}", movie.title);
var guids = new List<string>();
if (!movie.Guid.Any())

@ -94,7 +94,7 @@ namespace Ombi.Store.Repository
public async Task<PlexServerContent> GetByKey(string key)
{
return await Db.PlexServerContent.Include(x => x.Seasons).FirstOrDefaultAsync(x => x.Key == key);
return await Db.PlexServerContent.Include(x => x.Seasons).Include(x => x.Episodes).FirstOrDefaultAsync(x => x.Key == key);
}
public IEnumerable<PlexServerContent> GetWhereContentByCustom(Expression<Func<PlexServerContent, bool>> predicate)

Loading…
Cancel
Save