|
|
@ -150,9 +150,9 @@ namespace Ombi.Schedule.Jobs.Plex
|
|
|
|
var retVal = new ProcessedContent();
|
|
|
|
var retVal = new ProcessedContent();
|
|
|
|
var contentProcessed = new Dictionary<int, int>();
|
|
|
|
var contentProcessed = new Dictionary<int, int>();
|
|
|
|
var episodesProcessed = new List<int>();
|
|
|
|
var episodesProcessed = new List<int>();
|
|
|
|
Logger.LogInformation("Getting all content from server {0}", servers.Name);
|
|
|
|
Logger.LogDebug("Getting all content from server {0}", servers.Name);
|
|
|
|
var allContent = await GetAllContent(servers, recentlyAddedSearch);
|
|
|
|
var allContent = await GetAllContent(servers, recentlyAddedSearch);
|
|
|
|
Logger.LogInformation("We found {0} items", allContent.Count);
|
|
|
|
Logger.LogDebug("We found {0} items", allContent.Count);
|
|
|
|
|
|
|
|
|
|
|
|
// Let's now process this.
|
|
|
|
// Let's now process this.
|
|
|
|
var contentToAdd = new HashSet<PlexServerContent>();
|
|
|
|
var contentToAdd = new HashSet<PlexServerContent>();
|
|
|
@ -163,7 +163,7 @@ namespace Ombi.Schedule.Jobs.Plex
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (content.viewGroup.Equals(PlexMediaType.Episode.ToString(), StringComparison.CurrentCultureIgnoreCase))
|
|
|
|
if (content.viewGroup.Equals(PlexMediaType.Episode.ToString(), StringComparison.CurrentCultureIgnoreCase))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Logger.LogInformation("Found some episodes, this must be a recently added sync");
|
|
|
|
Logger.LogDebug("Found some episodes, this must be a recently added sync");
|
|
|
|
var count = 0;
|
|
|
|
var count = 0;
|
|
|
|
foreach (var epInfo in content.Metadata ?? new Metadata[]{})
|
|
|
|
foreach (var epInfo in content.Metadata ?? new Metadata[]{})
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -208,7 +208,7 @@ namespace Ombi.Schedule.Jobs.Plex
|
|
|
|
if (content.viewGroup.Equals(PlexMediaType.Show.ToString(), StringComparison.CurrentCultureIgnoreCase))
|
|
|
|
if (content.viewGroup.Equals(PlexMediaType.Show.ToString(), StringComparison.CurrentCultureIgnoreCase))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Process Shows
|
|
|
|
// Process Shows
|
|
|
|
Logger.LogInformation("Processing TV Shows");
|
|
|
|
Logger.LogDebug("Processing TV Shows");
|
|
|
|
var count = 0;
|
|
|
|
var count = 0;
|
|
|
|
foreach (var show in content.Metadata ?? new Metadata[] { })
|
|
|
|
foreach (var show in content.Metadata ?? new Metadata[] { })
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -237,7 +237,7 @@ namespace Ombi.Schedule.Jobs.Plex
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (content.viewGroup.Equals(PlexMediaType.Movie.ToString(), StringComparison.CurrentCultureIgnoreCase))
|
|
|
|
if (content.viewGroup.Equals(PlexMediaType.Movie.ToString(), StringComparison.CurrentCultureIgnoreCase))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Logger.LogInformation("Processing Movies");
|
|
|
|
Logger.LogDebug("Processing Movies");
|
|
|
|
foreach (var movie in content?.Metadata ?? new Metadata[] { })
|
|
|
|
foreach (var movie in content?.Metadata ?? new Metadata[] { })
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Let's check if we have this movie
|
|
|
|
// Let's check if we have this movie
|
|
|
@ -251,7 +251,7 @@ namespace Ombi.Schedule.Jobs.Plex
|
|
|
|
//var existing = await Repo.GetByKey(movie.ratingKey);
|
|
|
|
//var existing = await Repo.GetByKey(movie.ratingKey);
|
|
|
|
if (existing != null)
|
|
|
|
if (existing != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Logger.LogInformation("We already have movie {0}", movie.title);
|
|
|
|
Logger.LogDebug("We already have movie {0}", movie.title);
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -261,7 +261,7 @@ namespace Ombi.Schedule.Jobs.Plex
|
|
|
|
await Repo.Delete(hasSameKey);
|
|
|
|
await Repo.Delete(hasSameKey);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Logger.LogInformation("Adding movie {0}", movie.title);
|
|
|
|
Logger.LogDebug("Adding movie {0}", movie.title);
|
|
|
|
var metaData = await PlexApi.GetMetadata(servers.PlexAuthToken, servers.FullUri,
|
|
|
|
var metaData = await PlexApi.GetMetadata(servers.PlexAuthToken, servers.FullUri,
|
|
|
|
movie.ratingKey);
|
|
|
|
movie.ratingKey);
|
|
|
|
var providerIds = PlexHelper.GetProviderIdFromPlexGuid(metaData.MediaContainer.Metadata
|
|
|
|
var providerIds = PlexHelper.GetProviderIdFromPlexGuid(metaData.MediaContainer.Metadata
|
|
|
@ -421,7 +421,7 @@ namespace Ombi.Schedule.Jobs.Plex
|
|
|
|
{
|
|
|
|
{
|
|
|
|
try
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Logger.LogInformation("We already have show {0} checking for new seasons",
|
|
|
|
Logger.LogDebug("We already have show {0} checking for new seasons",
|
|
|
|
existingContent.Title);
|
|
|
|
existingContent.Title);
|
|
|
|
// Ok so we have it, let's check if there are any new seasons
|
|
|
|
// Ok so we have it, let's check if there are any new seasons
|
|
|
|
var itemAdded = false;
|
|
|
|
var itemAdded = false;
|
|
|
@ -472,7 +472,7 @@ namespace Ombi.Schedule.Jobs.Plex
|
|
|
|
{
|
|
|
|
{
|
|
|
|
try
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Logger.LogInformation("New show {0}, so add it", show.title);
|
|
|
|
Logger.LogDebug("New show {0}, so add it", show.title);
|
|
|
|
|
|
|
|
|
|
|
|
// Get the show metadata... This sucks since the `metadata` var contains all information about the show
|
|
|
|
// Get the show metadata... This sucks since the `metadata` var contains all information about the show
|
|
|
|
// But it does not contain the `guid` property that we need to pull out thetvdb id...
|
|
|
|
// But it does not contain the `guid` property that we need to pull out thetvdb id...
|
|
|
@ -573,7 +573,7 @@ namespace Ombi.Schedule.Jobs.Plex
|
|
|
|
.Select(x => x.Key.ToString()).ToList();
|
|
|
|
.Select(x => x.Key.ToString()).ToList();
|
|
|
|
if (!keys.Contains(dir.key))
|
|
|
|
if (!keys.Contains(dir.key))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Logger.LogInformation("Lib {0} is not monitored, so skipping", dir.key);
|
|
|
|
Logger.LogDebug("Lib {0} is not monitored, so skipping", dir.key);
|
|
|
|
// We are not monitoring this lib
|
|
|
|
// We are not monitoring this lib
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|