|
|
@ -261,6 +261,36 @@ namespace Ombi.Schedule.Jobs.Plex
|
|
|
|
await Repo.SaveChangesAsync();
|
|
|
|
await Repo.SaveChangesAsync();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (content.viewGroup.Equals(PlexMediaType.Movie.ToString(), StringComparison.InvariantCultureIgnoreCase))
|
|
|
|
if (content.viewGroup.Equals(PlexMediaType.Movie.ToString(), StringComparison.InvariantCultureIgnoreCase))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
await MovieLoop(servers, content, contentToAdd, contentProcessed);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (contentToAdd.Count > 500)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
await Repo.AddRange(contentToAdd);
|
|
|
|
|
|
|
|
foreach (var c in contentToAdd)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
contentProcessed.Add(c.Id, c.Key);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
contentToAdd.Clear();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (contentToAdd.Any())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
await Repo.AddRange(contentToAdd);
|
|
|
|
|
|
|
|
foreach (var c in contentToAdd)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
contentProcessed.Add(c.Id, c.Key);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
retVal.Content = contentProcessed.Values;
|
|
|
|
|
|
|
|
retVal.Episodes = episodesProcessed;
|
|
|
|
|
|
|
|
return retVal;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public async Task MovieLoop(PlexServers servers, Mediacontainer content, HashSet<PlexServerContent> contentToAdd,
|
|
|
|
|
|
|
|
Dictionary<int, int> contentProcessed)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Logger.LogDebug("Processing Movies");
|
|
|
|
Logger.LogDebug("Processing Movies");
|
|
|
|
foreach (var movie in content?.Metadata ?? new Metadata[] { })
|
|
|
|
foreach (var movie in content?.Metadata ?? new Metadata[] { })
|
|
|
@ -329,14 +359,17 @@ namespace Ombi.Schedule.Jobs.Plex
|
|
|
|
{
|
|
|
|
{
|
|
|
|
item.ImdbId = providerIds.ImdbId;
|
|
|
|
item.ImdbId = providerIds.ImdbId;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (providerIds.TheMovieDb.HasValue())
|
|
|
|
if (providerIds.TheMovieDb.HasValue())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
item.TheMovieDbId = providerIds.TheMovieDb;
|
|
|
|
item.TheMovieDbId = providerIds.TheMovieDb;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (providerIds.TheTvDb.HasValue())
|
|
|
|
if (providerIds.TheTvDb.HasValue())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
item.TvDbId = providerIds.TheTvDb;
|
|
|
|
item.TvDbId = providerIds.TheTvDb;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
contentToAdd.Add(item);
|
|
|
|
contentToAdd.Add(item);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception e)
|
|
|
|
catch (Exception e)
|
|
|
@ -352,33 +385,10 @@ namespace Ombi.Schedule.Jobs.Plex
|
|
|
|
{
|
|
|
|
{
|
|
|
|
contentProcessed.Add(c.Id, c.Key);
|
|
|
|
contentProcessed.Add(c.Id, c.Key);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
contentToAdd.Clear();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (contentToAdd.Count > 500)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
await Repo.AddRange(contentToAdd);
|
|
|
|
|
|
|
|
foreach (var c in contentToAdd)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
contentProcessed.Add(c.Id, c.Key);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
contentToAdd.Clear();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (contentToAdd.Any())
|
|
|
|
contentToAdd.Clear();
|
|
|
|
{
|
|
|
|
|
|
|
|
await Repo.AddRange(contentToAdd);
|
|
|
|
|
|
|
|
foreach (var c in contentToAdd)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
contentProcessed.Add(c.Id, c.Key);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
retVal.Content = contentProcessed.Values;
|
|
|
|
|
|
|
|
retVal.Episodes = episodesProcessed;
|
|
|
|
|
|
|
|
return retVal;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private async Task ProcessTvShow(PlexServers servers, Metadata show, HashSet<PlexServerContent> contentToAdd, Dictionary<int, int> contentProcessed)
|
|
|
|
private async Task ProcessTvShow(PlexServers servers, Metadata show, HashSet<PlexServerContent> contentToAdd, Dictionary<int, int> contentProcessed)
|
|
|
|