mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-03-12 04:35:27 -07:00
fix(plex): Fixed some errors around the scanner that was causing the scan to fail
This commit is contained in:
parent
be886eed3c
commit
d9787dc32a
src
Ombi.Schedule/Jobs
Ombi.Store/Repository
@ -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,
|
||||
@ -340,13 +347,7 @@ namespace Ombi.Schedule.Jobs.Plex
|
||||
|
||||
Logger.LogDebug($"We already have movie {movie.title}");
|
||||
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>();
|
||||
|
@ -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…
x
Reference in New Issue
Block a user