diff --git a/appveyor.yml b/appveyor.yml
index 39d67b91d..862993a21 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -15,19 +15,19 @@ test: off
after_build:
- cmd: >-
- appveyor PushArtifact "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp2.0\windows.zip"
+ appveyor PushArtifact "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp2.1\windows.zip"
- appveyor PushArtifact "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp2.0\osx.tar.gz"
+ appveyor PushArtifact "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp2.1\osx.tar.gz"
- appveyor PushArtifact "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp2.0\linux.tar.gz"
+ appveyor PushArtifact "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp2.1\linux.tar.gz"
- appveyor PushArtifact "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp2.0\linux-arm.tar.gz"
+ appveyor PushArtifact "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp2.1\linux-arm.tar.gz"
- appveyor PushArtifact "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp2.0\windows-32bit.zip"
+ appveyor PushArtifact "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp2.1\windows-32bit.zip"
# appveyor PushArtifact "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp2.0\linux-arm64.tar.gz"
diff --git a/build.cake b/build.cake
index a497c5f77..d200eac98 100644
--- a/build.cake
+++ b/build.cake
@@ -26,7 +26,7 @@ var csProj = "./src/Ombi/Ombi.csproj"; // Path to the project.csproj
var solutionFile = "Ombi.sln"; // Solution file if needed
GitVersion versionInfo = null;
-var frameworkVer = "netcoreapp2.0";
+var frameworkVer = "netcoreapp2.1";
var buildSettings = new DotNetCoreBuildSettings
{
diff --git a/src/Ombi.Api.Radarr/Ombi.Api.Radarr.csproj b/src/Ombi.Api.Radarr/Ombi.Api.Radarr.csproj
index d2b605337..ff506dc35 100644
--- a/src/Ombi.Api.Radarr/Ombi.Api.Radarr.csproj
+++ b/src/Ombi.Api.Radarr/Ombi.Api.Radarr.csproj
@@ -9,7 +9,7 @@
-
+
diff --git a/src/Ombi.Api.Service/Ombi.Api.Service.csproj b/src/Ombi.Api.Service/Ombi.Api.Service.csproj
index 67f37c80d..4a7f4865e 100644
--- a/src/Ombi.Api.Service/Ombi.Api.Service.csproj
+++ b/src/Ombi.Api.Service/Ombi.Api.Service.csproj
@@ -11,7 +11,7 @@
-
+
diff --git a/src/Ombi.Api/Ombi.Api.csproj b/src/Ombi.Api/Ombi.Api.csproj
index 32fc60bb6..533bcfcda 100644
--- a/src/Ombi.Api/Ombi.Api.csproj
+++ b/src/Ombi.Api/Ombi.Api.csproj
@@ -9,7 +9,7 @@
-
+
diff --git a/src/Ombi.Core.Tests/Ombi.Core.Tests.csproj b/src/Ombi.Core.Tests/Ombi.Core.Tests.csproj
index d75ba3411..b9960aa7f 100644
--- a/src/Ombi.Core.Tests/Ombi.Core.Tests.csproj
+++ b/src/Ombi.Core.Tests/Ombi.Core.Tests.csproj
@@ -1,7 +1,7 @@
- netcoreapp2.0
+ netcoreapp2.1
diff --git a/src/Ombi.Core/Ombi.Core.csproj b/src/Ombi.Core/Ombi.Core.csproj
index 2037113bd..1c09c88e3 100644
--- a/src/Ombi.Core/Ombi.Core.csproj
+++ b/src/Ombi.Core/Ombi.Core.csproj
@@ -12,9 +12,9 @@
-
-
-
+
+
+
diff --git a/src/Ombi.DependencyInjection/Ombi.DependencyInjection.csproj b/src/Ombi.DependencyInjection/Ombi.DependencyInjection.csproj
index 675f6461b..d2f94127f 100644
--- a/src/Ombi.DependencyInjection/Ombi.DependencyInjection.csproj
+++ b/src/Ombi.DependencyInjection/Ombi.DependencyInjection.csproj
@@ -9,9 +9,9 @@
-
-
-
+
+
+
diff --git a/src/Ombi.Helpers/Ombi.Helpers.csproj b/src/Ombi.Helpers/Ombi.Helpers.csproj
index 12c6fecc4..4b104eadb 100644
--- a/src/Ombi.Helpers/Ombi.Helpers.csproj
+++ b/src/Ombi.Helpers/Ombi.Helpers.csproj
@@ -10,8 +10,8 @@
-
-
+
+
diff --git a/src/Ombi.Helpers/OmbiRoles.cs b/src/Ombi.Helpers/OmbiRoles.cs
index ba8c8d087..5b62a2bae 100644
--- a/src/Ombi.Helpers/OmbiRoles.cs
+++ b/src/Ombi.Helpers/OmbiRoles.cs
@@ -11,6 +11,6 @@
public const string RequestTv = nameof(RequestTv);
public const string RequestMovie = nameof(RequestMovie);
public const string Disabled = nameof(Disabled);
- public const string RecievesNewsletter = nameof(RecievesNewsletter);
+ public const string ReceivesNewsletter = nameof(ReceivesNewsletter);
}
}
\ No newline at end of file
diff --git a/src/Ombi.Notifications.Tests/Ombi.Notifications.Tests.csproj b/src/Ombi.Notifications.Tests/Ombi.Notifications.Tests.csproj
index b350b93f4..01721db3f 100644
--- a/src/Ombi.Notifications.Tests/Ombi.Notifications.Tests.csproj
+++ b/src/Ombi.Notifications.Tests/Ombi.Notifications.Tests.csproj
@@ -1,7 +1,7 @@
- netcoreapp2.0
+ netcoreapp2.1
diff --git a/src/Ombi.Notifications/NotificationMessageCurlys.cs b/src/Ombi.Notifications/NotificationMessageCurlys.cs
index fb5dd976b..748f2adb5 100644
--- a/src/Ombi.Notifications/NotificationMessageCurlys.cs
+++ b/src/Ombi.Notifications/NotificationMessageCurlys.cs
@@ -44,8 +44,17 @@ namespace Ombi.Notifications
}
Overview = req?.Overview;
Year = req?.ReleaseDate.Year.ToString();
- PosterImage = req?.RequestType == RequestType.Movie ?
- string.Format("https://image.tmdb.org/t/p/w300{0}", req?.PosterPath) : req?.PosterPath;
+
+ if (req?.RequestType == RequestType.Movie)
+ {
+ PosterImage = string.Format((req?.PosterPath ?? string.Empty).StartsWith("/", StringComparison.InvariantCultureIgnoreCase)
+ ? "https://image.tmdb.org/t/p/w300{0}" : "https://image.tmdb.org/t/p/w300/{0}", req?.PosterPath);
+ }
+ else
+ {
+ PosterImage = req?.PosterPath;
+ }
+
AdditionalInformation = opts?.AdditionalInformation ?? string.Empty;
}
@@ -88,8 +97,15 @@ namespace Ombi.Notifications
Overview = req?.ParentRequest.Overview;
Year = req?.ParentRequest.ReleaseDate.Year.ToString();
- PosterImage = req?.RequestType == RequestType.Movie ?
- $"https://image.tmdb.org/t/p/w300{req?.ParentRequest.PosterPath}" : req?.ParentRequest.PosterPath;
+ if (req?.RequestType == RequestType.Movie)
+ {
+ PosterImage = string.Format((req?.ParentRequest.PosterPath ?? string.Empty).StartsWith("/", StringComparison.InvariantCultureIgnoreCase)
+ ? "https://image.tmdb.org/t/p/w300{0}" : "https://image.tmdb.org/t/p/w300/{0}", req?.ParentRequest.PosterPath);
+ }
+ else
+ {
+ PosterImage = req?.ParentRequest.PosterPath;
+ }
AdditionalInformation = opts.AdditionalInformation;
// DO Episode and Season Lists
@@ -133,6 +149,8 @@ namespace Ombi.Notifications
ApplicationUrl = (s?.ApplicationUrl.HasValue() ?? false) ? s.ApplicationUrl : string.Empty;
ApplicationName = string.IsNullOrEmpty(s?.ApplicationName) ? "Ombi" : s?.ApplicationName;
RequestedUser = user.UserName;
+ Alias = user.UserAlias;
+ UserName = user.UserName;
}
private void LoadIssues(NotificationOptions opts)
diff --git a/src/Ombi.Notifications/Ombi.Notifications.csproj b/src/Ombi.Notifications/Ombi.Notifications.csproj
index 46a64072e..529f01357 100644
--- a/src/Ombi.Notifications/Ombi.Notifications.csproj
+++ b/src/Ombi.Notifications/Ombi.Notifications.csproj
@@ -10,7 +10,7 @@
-
+
diff --git a/src/Ombi.Schedule.Tests/Ombi.Schedule.Tests.csproj b/src/Ombi.Schedule.Tests/Ombi.Schedule.Tests.csproj
index bdfbd60e6..d147af88f 100644
--- a/src/Ombi.Schedule.Tests/Ombi.Schedule.Tests.csproj
+++ b/src/Ombi.Schedule.Tests/Ombi.Schedule.Tests.csproj
@@ -1,11 +1,11 @@
- netcoreapp2.0
+ netcoreapp2.1
-
+
diff --git a/src/Ombi.Schedule/Jobs/Ombi/NewsletterJob.cs b/src/Ombi.Schedule/Jobs/Ombi/NewsletterJob.cs
index 3c6a4458f..8f88a4a18 100644
--- a/src/Ombi.Schedule/Jobs/Ombi/NewsletterJob.cs
+++ b/src/Ombi.Schedule/Jobs/Ombi/NewsletterJob.cs
@@ -131,7 +131,7 @@ namespace Ombi.Schedule.Jobs.Ombi
if (!test)
{
// Get the users to send it to
- var users = await _userManager.GetUsersInRoleAsync(OmbiRoles.RecievesNewsletter);
+ var users = await _userManager.GetUsersInRoleAsync(OmbiRoles.ReceivesNewsletter);
if (!users.Any())
{
return;
diff --git a/src/Ombi.Schedule/Jobs/Plex/Interfaces/IPlexAvailabilityChecker.cs b/src/Ombi.Schedule/Jobs/Plex/Interfaces/IPlexAvailabilityChecker.cs
index 3de9749d6..2d115ab88 100644
--- a/src/Ombi.Schedule/Jobs/Plex/Interfaces/IPlexAvailabilityChecker.cs
+++ b/src/Ombi.Schedule/Jobs/Plex/Interfaces/IPlexAvailabilityChecker.cs
@@ -1,4 +1,5 @@
-using System.Threading.Tasks;
+using System.Collections.Generic;
+using System.Threading.Tasks;
namespace Ombi.Schedule.Jobs.Plex
{
diff --git a/src/Ombi.Schedule/Jobs/Plex/Interfaces/IPlexEpisodeSync.cs b/src/Ombi.Schedule/Jobs/Plex/Interfaces/IPlexEpisodeSync.cs
index ede393790..7de7c3c0c 100644
--- a/src/Ombi.Schedule/Jobs/Plex/Interfaces/IPlexEpisodeSync.cs
+++ b/src/Ombi.Schedule/Jobs/Plex/Interfaces/IPlexEpisodeSync.cs
@@ -1,4 +1,5 @@
using System;
+using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Ombi.Api.Plex.Models;
@@ -9,6 +10,6 @@ namespace Ombi.Schedule.Jobs.Plex.Interfaces
public interface IPlexEpisodeSync : IBaseJob
{
Task Start();
- Task ProcessEpsiodes(Metadata[] episodes, IQueryable currentEpisodes);
+ Task> ProcessEpsiodes(Metadata[] episodes, IQueryable currentEpisodes);
}
}
\ No newline at end of file
diff --git a/src/Ombi.Schedule/Jobs/Plex/Models/ProcessedContent.cs b/src/Ombi.Schedule/Jobs/Plex/Models/ProcessedContent.cs
new file mode 100644
index 000000000..be70d0029
--- /dev/null
+++ b/src/Ombi.Schedule/Jobs/Plex/Models/ProcessedContent.cs
@@ -0,0 +1,14 @@
+using System.Collections.Generic;
+using System.Linq;
+
+namespace Ombi.Schedule.Jobs.Plex.Models
+{
+ public class ProcessedContent
+ {
+ public IEnumerable Content { get; set; }
+ public IEnumerable Episodes { get; set; }
+
+ public bool HasProcessedContent => Content.Any();
+ public bool HasProcessedEpisodes => Episodes.Any();
+ }
+}
\ No newline at end of file
diff --git a/src/Ombi.Schedule/Jobs/Plex/PlexAvailabilityChecker.cs b/src/Ombi.Schedule/Jobs/Plex/PlexAvailabilityChecker.cs
index 343c4256e..9c86a13c4 100644
--- a/src/Ombi.Schedule/Jobs/Plex/PlexAvailabilityChecker.cs
+++ b/src/Ombi.Schedule/Jobs/Plex/PlexAvailabilityChecker.cs
@@ -4,10 +4,12 @@ using System.Linq;
using System.Threading.Tasks;
using Hangfire;
using Microsoft.EntityFrameworkCore;
+using Microsoft.Extensions.Logging;
using Ombi.Core.Notifications;
using Ombi.Helpers;
using Ombi.Notifications.Models;
using Ombi.Store.Entities;
+using Ombi.Store.Entities.Requests;
using Ombi.Store.Repository;
using Ombi.Store.Repository.Requests;
@@ -16,13 +18,14 @@ namespace Ombi.Schedule.Jobs.Plex
public class PlexAvailabilityChecker : IPlexAvailabilityChecker
{
public PlexAvailabilityChecker(IPlexContentRepository repo, ITvRequestRepository tvRequest, IMovieRequestRepository movies,
- INotificationService notification, IBackgroundJobClient background)
+ INotificationService notification, IBackgroundJobClient background, ILogger log)
{
_tvRepo = tvRequest;
_repo = repo;
_movieRepo = movies;
_notificationService = notification;
_backgroundJobClient = background;
+ _log = log;
}
private readonly ITvRequestRepository _tvRepo;
@@ -30,16 +33,29 @@ namespace Ombi.Schedule.Jobs.Plex
private readonly IPlexContentRepository _repo;
private readonly INotificationService _notificationService;
private readonly IBackgroundJobClient _backgroundJobClient;
+ private readonly ILogger _log;
public async Task Start()
{
- await ProcessMovies();
- await ProcessTv();
+ try
+ {
+ await ProcessMovies();
+ await ProcessTv();
+ }
+ catch (Exception e)
+ {
+ _log.LogError(e, "Exception thrown in Plex availbility checker");
+ }
}
- private async Task ProcessTv()
+ private Task ProcessTv()
{
var tv = _tvRepo.GetChild().Where(x => !x.Available);
+ return ProcessTv(tv);
+ }
+
+ private async Task ProcessTv(IQueryable tv)
+ {
var plexEpisodes = _repo.GetAllEpisodes().Include(x => x.Series);
foreach (var child in tv)
@@ -81,6 +97,10 @@ namespace Ombi.Schedule.Jobs.Plex
{
foreach (var episode in season.Episodes)
{
+ if (episode.Available)
+ {
+ continue;
+ }
var foundEp = await seriesEpisodes.FirstOrDefaultAsync(
x => x.EpisodeNumber == episode.EpisodeNumber &&
x.SeasonNumber == episode.Season.SeasonNumber);
diff --git a/src/Ombi.Schedule/Jobs/Plex/PlexContentSync.cs b/src/Ombi.Schedule/Jobs/Plex/PlexContentSync.cs
index 7fdb5d19a..fec69bcc3 100644
--- a/src/Ombi.Schedule/Jobs/Plex/PlexContentSync.cs
+++ b/src/Ombi.Schedule/Jobs/Plex/PlexContentSync.cs
@@ -39,6 +39,7 @@ using Ombi.Core.Settings.Models.External;
using Ombi.Helpers;
using Ombi.Schedule.Jobs.Ombi;
using Ombi.Schedule.Jobs.Plex.Interfaces;
+using Ombi.Schedule.Jobs.Plex.Models;
using Ombi.Store.Entities;
using Ombi.Store.Repository;
@@ -47,7 +48,7 @@ namespace Ombi.Schedule.Jobs.Plex
public class PlexContentSync : IPlexContentSync
{
public PlexContentSync(ISettingsService plex, IPlexApi plexApi, ILogger logger, IPlexContentRepository repo,
- IPlexEpisodeSync epsiodeSync, IRefreshMetadata metadataRefresh)
+ IPlexEpisodeSync epsiodeSync, IRefreshMetadata metadataRefresh, IPlexAvailabilityChecker checker)
{
Plex = plex;
PlexApi = plexApi;
@@ -55,6 +56,7 @@ namespace Ombi.Schedule.Jobs.Plex
Repo = repo;
EpisodeSync = epsiodeSync;
Metadata = metadataRefresh;
+ Checker = checker;
plex.ClearCache();
}
@@ -64,6 +66,7 @@ namespace Ombi.Schedule.Jobs.Plex
private IPlexContentRepository Repo { get; }
private IPlexEpisodeSync EpisodeSync { get; }
private IRefreshMetadata Metadata { get; }
+ private IPlexAvailabilityChecker Checker { get; }
public async Task CacheContent(bool recentlyAddedSearch = false)
{
@@ -77,17 +80,13 @@ namespace Ombi.Schedule.Jobs.Plex
Logger.LogError("Plex Settings are not valid");
return;
}
- var processedContent = new HashSet();
+ var processedContent = new ProcessedContent();
Logger.LogInformation("Starting Plex Content Cacher");
try
{
if (recentlyAddedSearch)
{
- var result = await StartTheCache(plexSettings, true);
- foreach (var r in result)
- {
- processedContent.Add(r);
- }
+ processedContent = await StartTheCache(plexSettings, true);
}
else
{
@@ -105,31 +104,32 @@ namespace Ombi.Schedule.Jobs.Plex
BackgroundJob.Enqueue(() => EpisodeSync.Start());
}
- if (processedContent.Any() && recentlyAddedSearch)
+ if (processedContent.HasProcessedContent && recentlyAddedSearch)
{
// Just check what we send it
- BackgroundJob.Enqueue(() => Metadata.ProcessPlexServerContent(processedContent));
+ BackgroundJob.Enqueue(() => Metadata.ProcessPlexServerContent(processedContent.Content));
+ }
+
+ if (processedContent.HasProcessedEpisodes && recentlyAddedSearch)
+ {
+ BackgroundJob.Enqueue(() => Checker.Start());
}
}
- private async Task> StartTheCache(PlexSettings plexSettings, bool recentlyAddedSearch)
+ private async Task StartTheCache(PlexSettings plexSettings, bool recentlyAddedSearch)
{
- var processedContent = new HashSet();
+ var processedContent = new ProcessedContent();
foreach (var servers in plexSettings.Servers ?? new List())
{
try
{
- Logger.LogInformation("Starting to cache the content on server {0}", servers.Name);
-
+ Logger.LogInformation("Starting to cache the content on server {0}", servers.Name);
+
if (recentlyAddedSearch)
{
// If it's recently added search then we want the results to pass to the metadata job
// This way the metadata job is smaller in size to process, it only need to look at newly added shit
- var result = await ProcessServer(servers, true);
- foreach (var plexServerContent in result)
- {
- processedContent.Add(plexServerContent);
- }
+ return await ProcessServer(servers, true);
}
else
{
@@ -145,9 +145,11 @@ namespace Ombi.Schedule.Jobs.Plex
return processedContent;
}
- private async Task> ProcessServer(PlexServers servers, bool recentlyAddedSearch)
+ private async Task ProcessServer(PlexServers servers, bool recentlyAddedSearch)
{
- var processedContent = new Dictionary();
+ var retVal = new ProcessedContent();
+ var contentProcessed = new Dictionary();
+ var episodesProcessed = new List();
Logger.LogInformation("Getting all content from server {0}", servers.Name);
var allContent = await GetAllContent(servers, recentlyAddedSearch);
Logger.LogInformation("We found {0} items", allContent.Count);
@@ -170,12 +172,12 @@ namespace Ombi.Schedule.Jobs.Plex
// Lookup the rating key
var showMetadata = await PlexApi.GetMetadata(servers.PlexAuthToken, servers.FullUri, grandParentKey);
var show = showMetadata.MediaContainer.Metadata.FirstOrDefault();
- if(show == null)
+ if (show == null)
{
continue;
}
- await ProcessTvShow(servers, show, contentToAdd, processedContent);
+ await ProcessTvShow(servers, show, contentToAdd, contentProcessed);
if (contentToAdd.Any())
{
await Repo.AddRange(contentToAdd, false);
@@ -183,7 +185,7 @@ namespace Ombi.Schedule.Jobs.Plex
{
foreach (var plexServerContent in contentToAdd)
{
- processedContent.Add(plexServerContent.Id, plexServerContent.Key);
+ contentProcessed.Add(plexServerContent.Id, plexServerContent.Key);
}
}
contentToAdd.Clear();
@@ -198,7 +200,8 @@ namespace Ombi.Schedule.Jobs.Plex
// Save just to make sure we don't leave anything hanging
await Repo.SaveChangesAsync();
- await EpisodeSync.ProcessEpsiodes(content.Metadata, allEps);
+ var episodesAdded = await EpisodeSync.ProcessEpsiodes(content.Metadata, allEps);
+ episodesProcessed.AddRange(episodesAdded.Select(x => x.Id));
}
if (content.viewGroup.Equals(PlexMediaType.Show.ToString(), StringComparison.CurrentCultureIgnoreCase))
{
@@ -208,7 +211,7 @@ namespace Ombi.Schedule.Jobs.Plex
foreach (var show in content.Metadata ?? new Metadata[] { })
{
count++;
- await ProcessTvShow(servers, show, contentToAdd, processedContent);
+ await ProcessTvShow(servers, show, contentToAdd, contentProcessed);
if (contentToAdd.Any())
{
@@ -217,7 +220,7 @@ namespace Ombi.Schedule.Jobs.Plex
{
foreach (var plexServerContent in contentToAdd)
{
- processedContent.Add(plexServerContent.Id, plexServerContent.Key);
+ contentProcessed.Add(plexServerContent.Id, plexServerContent.Key);
}
}
contentToAdd.Clear();
@@ -299,7 +302,7 @@ namespace Ombi.Schedule.Jobs.Plex
await Repo.AddRange(contentToAdd);
foreach (var c in contentToAdd)
{
- processedContent.Add(c.Id, c.Key);
+ contentProcessed.Add(c.Id, c.Key);
}
contentToAdd.Clear();
}
@@ -310,7 +313,7 @@ namespace Ombi.Schedule.Jobs.Plex
await Repo.AddRange(contentToAdd);
foreach (var c in contentToAdd)
{
- processedContent.Add(c.Id, c.Key);
+ contentProcessed.Add(c.Id, c.Key);
}
contentToAdd.Clear();
}
@@ -321,14 +324,16 @@ namespace Ombi.Schedule.Jobs.Plex
await Repo.AddRange(contentToAdd);
foreach (var c in contentToAdd)
{
- processedContent.Add(c.Id, c.Key);
+ contentProcessed.Add(c.Id, c.Key);
}
}
- return processedContent.Values;
+ retVal.Content = contentProcessed.Values;
+ retVal.Episodes = episodesProcessed;
+ return retVal;
}
- private async Task ProcessTvShow(PlexServers servers, Metadata show, HashSet contentToAdd, Dictionary contentProcessed)
+ private async Task ProcessTvShow(PlexServers servers, Metadata show, HashSet contentToAdd, Dictionary contentProcessed)
{
var seasonList = await PlexApi.GetSeasons(servers.PlexAuthToken, servers.FullUri,
show.ratingKey);
@@ -349,7 +354,7 @@ namespace Ombi.Schedule.Jobs.Plex
var existingContent = await Repo.GetFirstContentByCustom(x => x.Title == show.title
&& x.ReleaseYear == show.year.ToString()
&& x.Type == PlexMediaTypeEntity.Show);
-
+
// Just double check the rating key, since this is our unique constraint
var existingKey = await Repo.GetByKey(show.ratingKey);
@@ -422,6 +427,26 @@ namespace Ombi.Schedule.Jobs.Plex
if (seasonExists != null)
{
// We already have this season
+ // check if we have the episode
+ //if (episode != null)
+ //{
+ // var existing = existingContent.Episodes.Any(x =>
+ // x.SeasonNumber == episode.parentIndex && x.EpisodeNumber == episode.index);
+ // if (!existing)
+ // {
+ // // We don't have this episode, lets add it
+ // existingContent.Episodes.Add(new PlexEpisode
+ // {
+ // EpisodeNumber = episode.index,
+ // SeasonNumber = episode.parentIndex,
+ // GrandparentKey = episode.grandparentRatingKey,
+ // ParentKey = episode.parentRatingKey,
+ // Key = episode.ratingKey,
+ // Title = episode.title
+ // });
+ // itemAdded = true;
+ // }
+ //}
continue;
}
diff --git a/src/Ombi.Schedule/Jobs/Plex/PlexEpisodeSync.cs b/src/Ombi.Schedule/Jobs/Plex/PlexEpisodeSync.cs
index d98eace4a..5652d126b 100644
--- a/src/Ombi.Schedule/Jobs/Plex/PlexEpisodeSync.cs
+++ b/src/Ombi.Schedule/Jobs/Plex/PlexEpisodeSync.cs
@@ -129,7 +129,7 @@ namespace Ombi.Schedule.Jobs.Plex
await _repo.SaveChangesAsync();
}
- public async Task ProcessEpsiodes(Metadata[] episodes, IQueryable currentEpisodes)
+ public async Task> ProcessEpsiodes(Metadata[] episodes, IQueryable currentEpisodes)
{
var ep = new HashSet();
try
@@ -179,6 +179,7 @@ namespace Ombi.Schedule.Jobs.Plex
}
await _repo.AddRange(ep);
+ return ep;
}
catch (Exception e)
{
diff --git a/src/Ombi.Settings/Ombi.Settings.csproj b/src/Ombi.Settings/Ombi.Settings.csproj
index 3cb56cb07..8709fd906 100644
--- a/src/Ombi.Settings/Ombi.Settings.csproj
+++ b/src/Ombi.Settings/Ombi.Settings.csproj
@@ -9,7 +9,7 @@
-
+
diff --git a/src/Ombi.Store/Context/OmbiContext.cs b/src/Ombi.Store/Context/OmbiContext.cs
index 8fb05f6ae..e9937509e 100644
--- a/src/Ombi.Store/Context/OmbiContext.cs
+++ b/src/Ombi.Store/Context/OmbiContext.cs
@@ -117,12 +117,12 @@ namespace Ombi.Store.Context
Database.ExecuteSqlCommand("VACUUM;");
// Make sure we have the roles
- var roles = Roles.Where(x => x.Name == OmbiRoles.RecievesNewsletter);
+ var roles = Roles.Where(x => x.Name == OmbiRoles.ReceivesNewsletter);
if (!roles.Any())
{
- Roles.Add(new IdentityRole(OmbiRoles.RecievesNewsletter)
+ Roles.Add(new IdentityRole(OmbiRoles.ReceivesNewsletter)
{
- NormalizedName = OmbiRoles.RecievesNewsletter.ToUpper()
+ NormalizedName = OmbiRoles.ReceivesNewsletter.ToUpper()
});
SaveChanges();
}
diff --git a/src/Ombi.Store/Migrations/20180613203443_RoleRename.Designer.cs b/src/Ombi.Store/Migrations/20180613203443_RoleRename.Designer.cs
new file mode 100644
index 000000000..c370e06ce
--- /dev/null
+++ b/src/Ombi.Store/Migrations/20180613203443_RoleRename.Designer.cs
@@ -0,0 +1,981 @@
+//
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage;
+using Microsoft.EntityFrameworkCore.Storage.Internal;
+using Ombi.Helpers;
+using Ombi.Store.Context;
+using Ombi.Store.Entities;
+using Ombi.Store.Entities.Requests;
+using System;
+
+namespace Ombi.Store.Migrations
+{
+ [DbContext(typeof(OmbiContext))]
+ [Migration("20180613203443_RoleRename")]
+ partial class RoleRename
+ {
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "2.0.3-rtm-10026");
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken();
+
+ b.Property("Name")
+ .HasMaxLength(256);
+
+ b.Property("NormalizedName")
+ .HasMaxLength(256);
+
+ b.HasKey("Id");
+
+ b.HasIndex("NormalizedName")
+ .IsUnique()
+ .HasName("RoleNameIndex");
+
+ b.ToTable("AspNetRoles");
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("ClaimType");
+
+ b.Property("ClaimValue");
+
+ b.Property("RoleId")
+ .IsRequired();
+
+ b.HasKey("Id");
+
+ b.HasIndex("RoleId");
+
+ b.ToTable("AspNetRoleClaims");
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("ClaimType");
+
+ b.Property("ClaimValue");
+
+ b.Property("UserId")
+ .IsRequired();
+
+ b.HasKey("Id");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("AspNetUserClaims");
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b =>
+ {
+ b.Property("LoginProvider");
+
+ b.Property("ProviderKey");
+
+ b.Property("ProviderDisplayName");
+
+ b.Property("UserId")
+ .IsRequired();
+
+ b.HasKey("LoginProvider", "ProviderKey");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("AspNetUserLogins");
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b =>
+ {
+ b.Property("UserId");
+
+ b.Property("RoleId");
+
+ b.HasKey("UserId", "RoleId");
+
+ b.HasIndex("RoleId");
+
+ b.ToTable("AspNetUserRoles");
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b =>
+ {
+ b.Property("UserId");
+
+ b.Property("LoginProvider");
+
+ b.Property("Name");
+
+ b.Property("Value");
+
+ b.HasKey("UserId", "LoginProvider", "Name");
+
+ b.ToTable("AspNetUserTokens");
+ });
+
+ modelBuilder.Entity("Ombi.Store.Entities.ApplicationConfiguration", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("Type");
+
+ b.Property("Value");
+
+ b.HasKey("Id");
+
+ b.ToTable("ApplicationConfiguration");
+ });
+
+ modelBuilder.Entity("Ombi.Store.Entities.Audit", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("AuditArea");
+
+ b.Property("AuditType");
+
+ b.Property("DateTime");
+
+ b.Property("Description");
+
+ b.Property("User");
+
+ b.HasKey("Id");
+
+ b.ToTable("Audit");
+ });
+
+ modelBuilder.Entity("Ombi.Store.Entities.CouchPotatoCache", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("TheMovieDbId");
+
+ b.HasKey("Id");
+
+ b.ToTable("CouchPotatoCache");
+ });
+
+ modelBuilder.Entity("Ombi.Store.Entities.EmbyContent", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("AddedAt");
+
+ b.Property("EmbyId")
+ .IsRequired();
+
+ b.Property("ImdbId");
+
+ b.Property("ProviderId");
+
+ b.Property("TheMovieDbId");
+
+ b.Property("Title");
+
+ b.Property("TvDbId");
+
+ b.Property("Type");
+
+ b.Property("Url");
+
+ b.HasKey("Id");
+
+ b.ToTable("EmbyContent");
+ });
+
+ modelBuilder.Entity("Ombi.Store.Entities.EmbyEpisode", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("AddedAt");
+
+ b.Property("EmbyId");
+
+ b.Property("EpisodeNumber");
+
+ b.Property("ImdbId");
+
+ b.Property("ParentId");
+
+ b.Property("ProviderId");
+
+ b.Property("SeasonNumber");
+
+ b.Property("TheMovieDbId");
+
+ b.Property("Title");
+
+ b.Property("TvDbId");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ParentId");
+
+ b.ToTable("EmbyEpisode");
+ });
+
+ modelBuilder.Entity("Ombi.Store.Entities.GlobalSettings", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("Content");
+
+ b.Property("SettingsName");
+
+ b.HasKey("Id");
+
+ b.ToTable("GlobalSettings");
+ });
+
+ modelBuilder.Entity("Ombi.Store.Entities.NotificationTemplates", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("Agent");
+
+ b.Property("Enabled");
+
+ b.Property("Message");
+
+ b.Property("NotificationType");
+
+ b.Property("Subject");
+
+ b.HasKey("Id");
+
+ b.ToTable("NotificationTemplates");
+ });
+
+ modelBuilder.Entity("Ombi.Store.Entities.NotificationUserId", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("AddedAt");
+
+ b.Property("PlayerId");
+
+ b.Property("UserId");
+
+ b.HasKey("Id");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("NotificationUserId");
+ });
+
+ modelBuilder.Entity("Ombi.Store.Entities.OmbiUser", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("AccessFailedCount");
+
+ b.Property("Alias");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken();
+
+ b.Property("Email")
+ .HasMaxLength(256);
+
+ b.Property("EmailConfirmed");
+
+ b.Property("EmbyConnectUserId");
+
+ b.Property("EpisodeRequestLimit");
+
+ b.Property("LastLoggedIn");
+
+ b.Property("LockoutEnabled");
+
+ b.Property("LockoutEnd");
+
+ b.Property("MovieRequestLimit");
+
+ b.Property("NormalizedEmail")
+ .HasMaxLength(256);
+
+ b.Property("NormalizedUserName")
+ .HasMaxLength(256);
+
+ b.Property("PasswordHash");
+
+ b.Property("PhoneNumber");
+
+ b.Property("PhoneNumberConfirmed");
+
+ b.Property("ProviderUserId");
+
+ b.Property("SecurityStamp");
+
+ b.Property("TwoFactorEnabled");
+
+ b.Property("UserAccessToken");
+
+ b.Property("UserName")
+ .HasMaxLength(256);
+
+ b.Property("UserType");
+
+ b.HasKey("Id");
+
+ b.HasIndex("NormalizedEmail")
+ .HasName("EmailIndex");
+
+ b.HasIndex("NormalizedUserName")
+ .IsUnique()
+ .HasName("UserNameIndex");
+
+ b.ToTable("AspNetUsers");
+ });
+
+ modelBuilder.Entity("Ombi.Store.Entities.PlexEpisode", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("EpisodeNumber");
+
+ b.Property("GrandparentKey");
+
+ b.Property("Key");
+
+ b.Property("ParentKey");
+
+ b.Property("SeasonNumber");
+
+ b.Property("Title");
+
+ b.HasKey("Id");
+
+ b.HasIndex("GrandparentKey");
+
+ b.ToTable("PlexEpisode");
+ });
+
+ modelBuilder.Entity("Ombi.Store.Entities.PlexSeasonsContent", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("ParentKey");
+
+ b.Property("PlexContentId");
+
+ b.Property("PlexServerContentId");
+
+ b.Property("SeasonKey");
+
+ b.Property("SeasonNumber");
+
+ b.HasKey("Id");
+
+ b.HasIndex("PlexServerContentId");
+
+ b.ToTable("PlexSeasonsContent");
+ });
+
+ modelBuilder.Entity("Ombi.Store.Entities.PlexServerContent", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("AddedAt");
+
+ b.Property("ImdbId");
+
+ b.Property("Key");
+
+ b.Property("Quality");
+
+ b.Property("ReleaseYear");
+
+ b.Property("TheMovieDbId");
+
+ b.Property("Title");
+
+ b.Property("TvDbId");
+
+ b.Property("Type");
+
+ b.Property("Url");
+
+ b.HasKey("Id");
+
+ b.ToTable("PlexServerContent");
+ });
+
+ modelBuilder.Entity("Ombi.Store.Entities.RadarrCache", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("HasFile");
+
+ b.Property("TheMovieDbId");
+
+ b.HasKey("Id");
+
+ b.ToTable("RadarrCache");
+ });
+
+ modelBuilder.Entity("Ombi.Store.Entities.RecentlyAddedLog", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("AddedAt");
+
+ b.Property("ContentId");
+
+ b.Property("ContentType");
+
+ b.Property("EpisodeNumber");
+
+ b.Property("SeasonNumber");
+
+ b.Property("Type");
+
+ b.HasKey("Id");
+
+ b.ToTable("RecentlyAddedLog");
+ });
+
+ modelBuilder.Entity("Ombi.Store.Entities.Requests.ChildRequests", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("Approved");
+
+ b.Property("Available");
+
+ b.Property("Denied");
+
+ b.Property("DeniedReason");
+
+ b.Property("IssueId");
+
+ b.Property("ParentRequestId");
+
+ b.Property("RequestType");
+
+ b.Property("RequestedDate");
+
+ b.Property("RequestedUserId");
+
+ b.Property("SeriesType");
+
+ b.Property("Title");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ParentRequestId");
+
+ b.HasIndex("RequestedUserId");
+
+ b.ToTable("ChildRequests");
+ });
+
+ modelBuilder.Entity("Ombi.Store.Entities.Requests.IssueCategory", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("Value");
+
+ b.HasKey("Id");
+
+ b.ToTable("IssueCategory");
+ });
+
+ modelBuilder.Entity("Ombi.Store.Entities.Requests.IssueComments", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("Comment");
+
+ b.Property("Date");
+
+ b.Property("IssuesId");
+
+ b.Property("UserId");
+
+ b.HasKey("Id");
+
+ b.HasIndex("IssuesId");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("IssueComments");
+ });
+
+ modelBuilder.Entity("Ombi.Store.Entities.Requests.Issues", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("Description");
+
+ b.Property("IssueCategoryId");
+
+ b.Property("IssueId");
+
+ b.Property("ProviderId");
+
+ b.Property("RequestId");
+
+ b.Property("RequestType");
+
+ b.Property("ResovledDate");
+
+ b.Property("Status");
+
+ b.Property("Subject");
+
+ b.Property("Title");
+
+ b.Property("UserReportedId");
+
+ b.HasKey("Id");
+
+ b.HasIndex("IssueCategoryId");
+
+ b.HasIndex("IssueId");
+
+ b.HasIndex("UserReportedId");
+
+ b.ToTable("Issues");
+ });
+
+ modelBuilder.Entity("Ombi.Store.Entities.Requests.MovieRequests", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("Approved");
+
+ b.Property("Available");
+
+ b.Property("Background");
+
+ b.Property("Denied");
+
+ b.Property("DeniedReason");
+
+ b.Property("DigitalReleaseDate");
+
+ b.Property("ImdbId");
+
+ b.Property("IssueId");
+
+ b.Property("Overview");
+
+ b.Property("PosterPath");
+
+ b.Property("QualityOverride");
+
+ b.Property("ReleaseDate");
+
+ b.Property("RequestType");
+
+ b.Property("RequestedDate");
+
+ b.Property("RequestedUserId");
+
+ b.Property("RootPathOverride");
+
+ b.Property("Status");
+
+ b.Property("TheMovieDbId");
+
+ b.Property("Title");
+
+ b.HasKey("Id");
+
+ b.HasIndex("RequestedUserId");
+
+ b.ToTable("MovieRequests");
+ });
+
+ modelBuilder.Entity("Ombi.Store.Entities.Requests.RequestLog", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("EpisodeCount");
+
+ b.Property("RequestDate");
+
+ b.Property("RequestId");
+
+ b.Property("RequestType");
+
+ b.Property("UserId");
+
+ b.HasKey("Id");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("RequestLog");
+ });
+
+ modelBuilder.Entity("Ombi.Store.Entities.Requests.TvRequests", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("Background");
+
+ b.Property("ImdbId");
+
+ b.Property("Overview");
+
+ b.Property("PosterPath");
+
+ b.Property("QualityOverride");
+
+ b.Property("ReleaseDate");
+
+ b.Property("RootFolder");
+
+ b.Property("Status");
+
+ b.Property("Title");
+
+ b.Property("TvDbId");
+
+ b.HasKey("Id");
+
+ b.ToTable("TvRequests");
+ });
+
+ modelBuilder.Entity("Ombi.Store.Entities.RequestSubscription", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("RequestId");
+
+ b.Property("RequestType");
+
+ b.Property("UserId");
+
+ b.HasKey("Id");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("RequestSubscription");
+ });
+
+ modelBuilder.Entity("Ombi.Store.Entities.SickRageCache", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("TvDbId");
+
+ b.HasKey("Id");
+
+ b.ToTable("SickRageCache");
+ });
+
+ modelBuilder.Entity("Ombi.Store.Entities.SickRageEpisodeCache", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("EpisodeNumber");
+
+ b.Property("SeasonNumber");
+
+ b.Property("TvDbId");
+
+ b.HasKey("Id");
+
+ b.ToTable("SickRageEpisodeCache");
+ });
+
+ modelBuilder.Entity("Ombi.Store.Entities.SonarrCache", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("TvDbId");
+
+ b.HasKey("Id");
+
+ b.ToTable("SonarrCache");
+ });
+
+ modelBuilder.Entity("Ombi.Store.Entities.SonarrEpisodeCache", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("EpisodeNumber");
+
+ b.Property("HasFile");
+
+ b.Property("SeasonNumber");
+
+ b.Property("TvDbId");
+
+ b.HasKey("Id");
+
+ b.ToTable("SonarrEpisodeCache");
+ });
+
+ modelBuilder.Entity("Ombi.Store.Entities.Tokens", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property