mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-20 13:23:20 -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
3 changed files with 22 additions and 9 deletions
|
@ -7,6 +7,7 @@ using Microsoft.Extensions.Logging;
|
||||||
using Ombi.Api.Emby;
|
using Ombi.Api.Emby;
|
||||||
using Ombi.Api.Jellyfin;
|
using Ombi.Api.Jellyfin;
|
||||||
using Ombi.Api.Plex;
|
using Ombi.Api.Plex;
|
||||||
|
using Ombi.Api.Plex.Models;
|
||||||
using Ombi.Api.TheMovieDb;
|
using Ombi.Api.TheMovieDb;
|
||||||
using Ombi.Api.TheMovieDb.Models;
|
using Ombi.Api.TheMovieDb.Models;
|
||||||
using Ombi.Api.TvMaze;
|
using Ombi.Api.TvMaze;
|
||||||
|
@ -286,7 +287,18 @@ namespace Ombi.Schedule.Jobs.Ombi
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
var servers = settings.Servers[0];
|
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 guids = new List<string>();
|
||||||
|
|
||||||
var meta = metaData.MediaContainer.Metadata.FirstOrDefault();
|
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
|
var existing = await Repo.GetFirstContentByCustom(x => x.Title == movie.title
|
||||||
&& x.ReleaseYear == movie.year.ToString()
|
&& x.ReleaseYear == movie.year.ToString()
|
||||||
&& x.Type == MediaType.Movie);
|
&& x.Type == MediaType.Movie);
|
||||||
|
|
||||||
|
|
||||||
|
if (existing == null)
|
||||||
|
{
|
||||||
|
// Let's just check the key
|
||||||
|
existing = await Repo.GetByKey(movie.ratingKey);
|
||||||
|
}
|
||||||
if (existing != null)
|
if (existing != null)
|
||||||
{
|
{
|
||||||
// We need to see if this is a different quality,
|
// We need to see if this is a different quality,
|
||||||
|
@ -342,12 +349,6 @@ namespace Ombi.Schedule.Jobs.Plex
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
//var hasSameKey = await Repo.GetByKey(movie.ratingKey);
|
|
||||||
//if (hasSameKey != null)
|
|
||||||
//{
|
|
||||||
// await Repo.Delete(hasSameKey);
|
|
||||||
//}
|
|
||||||
|
|
||||||
Logger.LogDebug("Adding movie {0}", movie.title);
|
Logger.LogDebug("Adding movie {0}", movie.title);
|
||||||
var guids = new List<string>();
|
var guids = new List<string>();
|
||||||
if (!movie.Guid.Any())
|
if (!movie.Guid.Any())
|
||||||
|
|
|
@ -94,7 +94,7 @@ namespace Ombi.Store.Repository
|
||||||
|
|
||||||
public async Task<PlexServerContent> GetByKey(string key)
|
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)
|
public IEnumerable<PlexServerContent> GetWhereContentByCustom(Expression<Func<PlexServerContent, bool>> predicate)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue