diff --git a/src/Ombi.Core/Engine/VoteEngine.cs b/src/Ombi.Core/Engine/VoteEngine.cs
index 7c4d48a6f..5c73e03d9 100644
--- a/src/Ombi.Core/Engine/VoteEngine.cs
+++ b/src/Ombi.Core/Engine/VoteEngine.cs
@@ -11,7 +11,7 @@ using Ombi.Core.Models;
using Ombi.Core.Models.UI;
using Ombi.Core.Rule.Interfaces;
using Ombi.Core.Settings;
-using Ombi.Schedule.Jobs.Ombi;
+using Ombi.Helpers;
using Ombi.Settings.Settings.Models;
using Ombi.Store.Entities;
using Ombi.Store.Repository;
@@ -114,7 +114,7 @@ namespace Ombi.Core.Engine
foreach (var epInformation in childRequests.SeasonRequests.OrderBy(x => x.SeasonNumber))
{
var orderedEpisodes = epInformation.Episodes.OrderBy(x => x.EpisodeNumber).ToList();
- var episodeString = NewsletterJob.BuildEpisodeList(orderedEpisodes.Select(x => x.EpisodeNumber));
+ var episodeString = StringHelper.BuildEpisodeList(orderedEpisodes.Select(x => x.EpisodeNumber));
finalsb.Append($"Season: {epInformation.SeasonNumber} - Episodes: {episodeString}");
finalsb.Append("
");
}
diff --git a/src/Ombi.Core/Ombi.Core.csproj b/src/Ombi.Core/Ombi.Core.csproj
index 10e07822a..fb1024b93 100644
--- a/src/Ombi.Core/Ombi.Core.csproj
+++ b/src/Ombi.Core/Ombi.Core.csproj
@@ -20,16 +20,18 @@
+
+
+
-
diff --git a/src/Ombi.Core/Senders/MovieSender.cs b/src/Ombi.Core/Senders/MovieSender.cs
index 66978f758..9124eb9c9 100644
--- a/src/Ombi.Core/Senders/MovieSender.cs
+++ b/src/Ombi.Core/Senders/MovieSender.cs
@@ -20,7 +20,7 @@ namespace Ombi.Core.Senders
{
public MovieSender(ISettingsService radarrSettings, IRadarrApi api, ILogger log,
ISettingsService dogSettings, IDogNzbApi dogApi, ISettingsService cpSettings,
- ICouchPotatoApi cpApi, IRepository userProfiles)
+ ICouchPotatoApi cpApi, IRepository userProfiles, IRepository requestQueue, INotificationHelper notify)
{
RadarrSettings = radarrSettings;
RadarrApi = api;
@@ -30,6 +30,8 @@ namespace Ombi.Core.Senders
CouchPotatoSettings = cpSettings;
CouchPotatoApi = cpApi;
_userProfiles = userProfiles;
+ _requestQueuRepository = requestQueue;
+ _notificationHelper = notify;
}
private ISettingsService RadarrSettings { get; }
@@ -40,39 +42,64 @@ namespace Ombi.Core.Senders
private ISettingsService CouchPotatoSettings { get; }
private ICouchPotatoApi CouchPotatoApi { get; }
private readonly IRepository _userProfiles;
+ private readonly IRepository _requestQueuRepository;
+ private readonly INotificationHelper _notificationHelper;
public async Task Send(MovieRequests model)
{
- var cpSettings = await CouchPotatoSettings.GetSettingsAsync();
- //var watcherSettings = await WatcherSettings.GetSettingsAsync();
- var radarrSettings = await RadarrSettings.GetSettingsAsync();
- if (radarrSettings.Enabled)
+ try
{
- return await SendToRadarr(model, radarrSettings);
- }
- var dogSettings = await DogNzbSettings.GetSettingsAsync();
- if (dogSettings.Enabled)
- {
- await SendToDogNzb(model, dogSettings);
- return new SenderResult
+ var cpSettings = await CouchPotatoSettings.GetSettingsAsync();
+ //var watcherSettings = await WatcherSettings.GetSettingsAsync();
+ var radarrSettings = await RadarrSettings.GetSettingsAsync();
+ if (radarrSettings.Enabled)
{
- Success = true,
- Sent = true,
- };
- }
+ return await SendToRadarr(model, radarrSettings);
+ }
- if (cpSettings.Enabled)
+ var dogSettings = await DogNzbSettings.GetSettingsAsync();
+ if (dogSettings.Enabled)
+ {
+ await SendToDogNzb(model, dogSettings);
+ return new SenderResult
+ {
+ Success = true,
+ Sent = true,
+ };
+ }
+
+ if (cpSettings.Enabled)
+ {
+ return await SendToCp(model, cpSettings, cpSettings.DefaultProfileId);
+ }
+ }
+ catch (Exception e)
{
- return await SendToCp(model, cpSettings, cpSettings.DefaultProfileId);
+ Log.LogError(e, "Error when seing movie to DVR app, added to the request queue");
+
+ // Check if already in request quee
+ var existingQueue = await _requestQueuRepository.FirstOrDefaultAsync(x => x.RequestId == model.Id);
+ if (existingQueue != null)
+ {
+ existingQueue.RetryCount++;
+ existingQueue.Error = e.Message;
+ await _requestQueuRepository.SaveChangesAsync();
+ }
+ else
+ {
+ await _requestQueuRepository.Add(new RequestQueue
+ {
+ Dts = DateTime.UtcNow,
+ Error = e.Message,
+ RequestId = model.Id,
+ Type = RequestType.Movie,
+ RetryCount = 0
+ });
+ _notificationHelper.Notify(model, NotificationType.ItemAddedToFaultQueue);
+ }
}
- //if (watcherSettings.Enabled)
- //{
- // return SendToWatcher(model, watcherSettings);
- //}
-
-
return new SenderResult
{
Success = true,
@@ -94,9 +121,9 @@ namespace Ombi.Core.Senders
private async Task SendToRadarr(MovieRequests model, RadarrSettings settings)
{
-
+
var qualityToUse = int.Parse(settings.DefaultQualityProfile);
-
+
var rootFolderPath = settings.DefaultRootPath;
var profiles = await _userProfiles.GetAll().FirstOrDefaultAsync(x => x.UserId == model.RequestedUserId);
@@ -155,7 +182,7 @@ namespace Ombi.Core.Senders
// Search for it
if (!settings.AddOnly)
{
- await RadarrApi.MovieSearch(new[] {existingMovie.id}, settings.ApiKey, settings.FullUri);
+ await RadarrApi.MovieSearch(new[] { existingMovie.id }, settings.ApiKey, settings.FullUri);
}
return new SenderResult { Success = true, Sent = true };
diff --git a/src/Ombi.Core/Senders/MusicSender.cs b/src/Ombi.Core/Senders/MusicSender.cs
index 60e4ca6ee..76a9fc14c 100644
--- a/src/Ombi.Core/Senders/MusicSender.cs
+++ b/src/Ombi.Core/Senders/MusicSender.cs
@@ -1,37 +1,75 @@
using System;
using System.Linq;
using System.Threading.Tasks;
+using Microsoft.Extensions.Logging;
using Ombi.Api.Lidarr;
using Ombi.Api.Lidarr.Models;
-using Ombi.Api.Radarr;
using Ombi.Core.Settings;
using Ombi.Helpers;
using Ombi.Settings.Settings.Models.External;
+using Ombi.Store.Entities;
using Ombi.Store.Entities.Requests;
-using Serilog;
+using Ombi.Store.Repository;
+using ILogger = Microsoft.Extensions.Logging.ILogger;
namespace Ombi.Core.Senders
{
public class MusicSender : IMusicSender
{
- public MusicSender(ISettingsService lidarr, ILidarrApi lidarrApi)
+ public MusicSender(ISettingsService lidarr, ILidarrApi lidarrApi, ILogger log,
+ IRepository requestQueue, INotificationHelper notify)
{
_lidarrSettings = lidarr;
_lidarrApi = lidarrApi;
+ _log = log;
+ _requestQueueRepository = requestQueue;
+ _notificationHelper = notify;
}
private readonly ISettingsService _lidarrSettings;
private readonly ILidarrApi _lidarrApi;
+ private readonly ILogger _log;
+ private readonly IRepository _requestQueueRepository;
+ private readonly INotificationHelper _notificationHelper;
public async Task Send(AlbumRequest model)
{
- var settings = await _lidarrSettings.GetSettingsAsync();
- if (settings.Enabled)
+ try
{
- return await SendToLidarr(model, settings);
+ var settings = await _lidarrSettings.GetSettingsAsync();
+ if (settings.Enabled)
+ {
+ return await SendToLidarr(model, settings);
+ }
+
+ return new SenderResult { Success = false, Sent = false, Message = "Lidarr is not enabled" };
+ }
+ catch (Exception e)
+ {
+ _log.LogError(e, "Exception thrown when sending a music to DVR app, added to the request queue");
+ var existingQueue = await _requestQueueRepository.FirstOrDefaultAsync(x => x.RequestId == model.Id);
+ if (existingQueue != null)
+ {
+ existingQueue.RetryCount++;
+ existingQueue.Error = e.Message;
+ await _requestQueueRepository.SaveChangesAsync();
+ }
+ else
+ {
+ await _requestQueueRepository.Add(new RequestQueue
+ {
+ Dts = DateTime.UtcNow,
+ Error = e.Message,
+ RequestId = model.Id,
+ Type = RequestType.Album,
+ RetryCount = 0
+ });
+ _notificationHelper.Notify(model, NotificationType.ItemAddedToFaultQueue);
+ }
}
- return new SenderResult { Success = false, Sent = false, Message = "Lidarr is not enabled" };
+
+ return new SenderResult { Success = false, Sent = false, Message = "Something went wrong!" };
}
private async Task SendToLidarr(AlbumRequest model, LidarrSettings settings)
diff --git a/src/Ombi.Core/Senders/TvSender.cs b/src/Ombi.Core/Senders/TvSender.cs
index aadb893d0..d0946b6f4 100644
--- a/src/Ombi.Core/Senders/TvSender.cs
+++ b/src/Ombi.Core/Senders/TvSender.cs
@@ -23,7 +23,7 @@ namespace Ombi.Core.Senders
{
public TvSender(ISonarrApi sonarrApi, ISonarrV3Api sonarrV3Api, ILogger log, ISettingsService sonarrSettings,
ISettingsService dog, IDogNzbApi dogApi, ISettingsService srSettings,
- ISickRageApi srApi, IRepository userProfiles)
+ ISickRageApi srApi, IRepository userProfiles, IRepository requestQueue, INotificationHelper notify)
{
SonarrApi = sonarrApi;
SonarrV3Api = sonarrV3Api;
@@ -34,6 +34,8 @@ namespace Ombi.Core.Senders
SickRageSettings = srSettings;
SickRageApi = srApi;
UserQualityProfiles = userProfiles;
+ _requestQueueRepository = requestQueue;
+ _notificationHelper = notify;
}
private ISonarrApi SonarrApi { get; }
@@ -45,59 +47,94 @@ namespace Ombi.Core.Senders
private ISettingsService DogNzbSettings { get; }
private ISettingsService SickRageSettings { get; }
private IRepository UserQualityProfiles { get; }
+ private readonly IRepository _requestQueueRepository;
+ private readonly INotificationHelper _notificationHelper;
public async Task Send(ChildRequests model)
{
- var sonarr = await SonarrSettings.GetSettingsAsync();
- if (sonarr.Enabled)
+ try
{
- var result = await SendToSonarr(model);
- if (result != null)
+ var sonarr = await SonarrSettings.GetSettingsAsync();
+ if (sonarr.Enabled)
{
+ var result = await SendToSonarr(model);
+ if (result != null)
+ {
+ return new SenderResult
+ {
+ Sent = true,
+ Success = true
+ };
+ }
+ }
+ var dog = await DogNzbSettings.GetSettingsAsync();
+ if (dog.Enabled)
+ {
+ var result = await SendToDogNzb(model, dog);
+ if (!result.Failure)
+ {
+ return new SenderResult
+ {
+ Sent = true,
+ Success = true
+ };
+ }
return new SenderResult
{
- Sent = true,
- Success = true
+ Message = result.ErrorMessage
};
}
- }
- var dog = await DogNzbSettings.GetSettingsAsync();
- if (dog.Enabled)
- {
- var result = await SendToDogNzb(model, dog);
- if (!result.Failure)
+ var sr = await SickRageSettings.GetSettingsAsync();
+ if (sr.Enabled)
{
+ var result = await SendToSickRage(model, sr);
+ if (result)
+ {
+ return new SenderResult
+ {
+ Sent = true,
+ Success = true
+ };
+ }
return new SenderResult
{
- Sent = true,
- Success = true
+ Message = "Could not send to SickRage!"
};
}
return new SenderResult
{
- Message = result.ErrorMessage
+ Success = true
};
}
- var sr = await SickRageSettings.GetSettingsAsync();
- if (sr.Enabled)
+ catch (Exception e)
{
- var result = await SendToSickRage(model, sr);
- if (result)
+ Logger.LogError(e, "Exception thrown when sending a movie to DVR app, added to the request queue");
+ // Check if already in request quee
+ var existingQueue = await _requestQueueRepository.FirstOrDefaultAsync(x => x.RequestId == model.Id);
+ if (existingQueue != null)
{
- return new SenderResult
- {
- Sent = true,
- Success = true
- };
+ existingQueue.RetryCount++;
+ existingQueue.Error = e.Message;
+ await _requestQueueRepository.SaveChangesAsync();
}
- return new SenderResult
+ else
{
- Message = "Could not send to SickRage!"
- };
+ await _requestQueueRepository.Add(new RequestQueue
+ {
+ Dts = DateTime.UtcNow,
+ Error = e.Message,
+ RequestId = model.Id,
+ Type = RequestType.TvShow,
+ RetryCount = 0
+ });
+ _notificationHelper.Notify(model, NotificationType.ItemAddedToFaultQueue);
+ }
}
+
return new SenderResult
{
- Success = true
+ Success = false,
+ Message = "Something wen't wrong!"
};
}
@@ -145,7 +182,7 @@ namespace Ombi.Core.Senders
}
if (profiles.SonarrQualityProfileAnime > 0)
{
- qualityToUse = profiles.SonarrQualityProfileAnime;
+ qualityToUse = profiles.SonarrQualityProfileAnime;
}
}
seriesType = "anime";
@@ -165,7 +202,7 @@ namespace Ombi.Core.Senders
}
if (profiles.SonarrQualityProfile > 0)
{
- qualityToUse = profiles.SonarrQualityProfile;
+ qualityToUse = profiles.SonarrQualityProfile;
}
}
seriesType = "standard";
@@ -176,8 +213,7 @@ namespace Ombi.Core.Senders
{
qualityToUse = model.ParentRequest.QualityOverride.Value;
}
-
-
+
// Are we using v3 sonarr?
var sonarrV3 = s.V3;
var languageProfileId = s.LanguageProfile;
@@ -280,7 +316,7 @@ namespace Ombi.Core.Senders
}
}
var seriesChanges = false;
-
+
foreach (var season in model.SeasonRequests)
{
var sonarrSeason = sonarrEpList.Where(x => x.seasonNumber == season.SeasonNumber);
diff --git a/src/Ombi.DependencyInjection/IocExtensions.cs b/src/Ombi.DependencyInjection/IocExtensions.cs
index c33f31c10..190e79203 100644
--- a/src/Ombi.DependencyInjection/IocExtensions.cs
+++ b/src/Ombi.DependencyInjection/IocExtensions.cs
@@ -199,6 +199,7 @@ namespace Ombi.DependencyInjection
services.AddTransient();
services.AddTransient();
services.AddTransient();
+ services.AddTransient();
}
}
}
diff --git a/src/Ombi.Helpers/StringHelper.cs b/src/Ombi.Helpers/StringHelper.cs
index c198301fc..68a29e848 100644
--- a/src/Ombi.Helpers/StringHelper.cs
+++ b/src/Ombi.Helpers/StringHelper.cs
@@ -1,4 +1,5 @@
using System;
+using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Security;
@@ -76,6 +77,49 @@ namespace Ombi.Helpers
return -1;
}
+ public static string BuildEpisodeList(IEnumerable orderedEpisodes)
+ {
+ var epSb = new StringBuilder();
+ var previousEpisodes = new List();
+ var previousEpisode = -1;
+ foreach (var ep in orderedEpisodes)
+ {
+ if (ep - 1 == previousEpisode)
+ {
+ // This is the next one
+ previousEpisodes.Add(ep);
+ }
+ else
+ {
+ if (previousEpisodes.Count > 1)
+ {
+ // End it
+ epSb.Append($"{previousEpisodes.First()}-{previousEpisodes.Last()}, ");
+ }
+ else if (previousEpisodes.Count == 1)
+ {
+ epSb.Append($"{previousEpisodes.FirstOrDefault()}, ");
+ }
+ // New one
+ previousEpisodes.Clear();
+ previousEpisodes.Add(ep);
+ }
+ previousEpisode = ep;
+ }
+
+ if (previousEpisodes.Count > 1)
+ {
+ // Got some left over
+ epSb.Append($"{previousEpisodes.First()}-{previousEpisodes.Last()}");
+ }
+ else if (previousEpisodes.Count == 1)
+ {
+ epSb.Append(previousEpisodes.FirstOrDefault());
+ }
+
+ return epSb.ToString();
+ }
+
public static string RemoveSpaces(this string str)
{
return str.Replace(" ", "");
diff --git a/src/Ombi.Notifications/Agents/DiscordNotification.cs b/src/Ombi.Notifications/Agents/DiscordNotification.cs
index 84e907053..c0671fc90 100644
--- a/src/Ombi.Notifications/Agents/DiscordNotification.cs
+++ b/src/Ombi.Notifications/Agents/DiscordNotification.cs
@@ -6,7 +6,6 @@ using Ombi.Api.Discord;
using Ombi.Api.Discord.Models;
using Ombi.Core.Settings;
using Ombi.Helpers;
-using Ombi.Notifications.Interfaces;
using Ombi.Notifications.Models;
using Ombi.Settings.Settings.Models;
using Ombi.Settings.Settings.Models.Notifications;
diff --git a/src/Ombi.Notifications/Agents/EmailNotification.cs b/src/Ombi.Notifications/Agents/EmailNotification.cs
index cff1f3b80..9621fed43 100644
--- a/src/Ombi.Notifications/Agents/EmailNotification.cs
+++ b/src/Ombi.Notifications/Agents/EmailNotification.cs
@@ -8,7 +8,6 @@ using Microsoft.Extensions.Logging;
using MimeKit;
using Ombi.Core.Settings;
using Ombi.Helpers;
-using Ombi.Notifications.Interfaces;
using Ombi.Notifications.Models;
using Ombi.Notifications.Templates;
using Ombi.Settings.Settings.Models;
diff --git a/src/Ombi.Notifications/Agents/MattermostNotification.cs b/src/Ombi.Notifications/Agents/MattermostNotification.cs
index 37e597854..62c5505c5 100644
--- a/src/Ombi.Notifications/Agents/MattermostNotification.cs
+++ b/src/Ombi.Notifications/Agents/MattermostNotification.cs
@@ -2,13 +2,10 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
-using Ombi.Api.Discord;
-using Ombi.Api.Discord.Models;
using Ombi.Api.Mattermost;
using Ombi.Api.Mattermost.Models;
using Ombi.Core.Settings;
using Ombi.Helpers;
-using Ombi.Notifications.Interfaces;
using Ombi.Notifications.Models;
using Ombi.Settings.Settings.Models;
using Ombi.Settings.Settings.Models.Notifications;
diff --git a/src/Ombi.Notifications/Agents/MobileNotification.cs b/src/Ombi.Notifications/Agents/MobileNotification.cs
index a16785909..de904ecfd 100644
--- a/src/Ombi.Notifications/Agents/MobileNotification.cs
+++ b/src/Ombi.Notifications/Agents/MobileNotification.cs
@@ -8,7 +8,6 @@ using Microsoft.Extensions.Logging;
using Ombi.Api.Notifications;
using Ombi.Core.Settings;
using Ombi.Helpers;
-using Ombi.Notifications.Interfaces;
using Ombi.Notifications.Models;
using Ombi.Settings.Settings.Models;
using Ombi.Settings.Settings.Models.Notifications;
diff --git a/src/Ombi.Notifications/Agents/PushbulletNotification.cs b/src/Ombi.Notifications/Agents/PushbulletNotification.cs
index 6c6b1f789..8440ad319 100644
--- a/src/Ombi.Notifications/Agents/PushbulletNotification.cs
+++ b/src/Ombi.Notifications/Agents/PushbulletNotification.cs
@@ -4,7 +4,6 @@ using Microsoft.Extensions.Logging;
using Ombi.Api.Pushbullet;
using Ombi.Core.Settings;
using Ombi.Helpers;
-using Ombi.Notifications.Interfaces;
using Ombi.Notifications.Models;
using Ombi.Settings.Settings.Models;
using Ombi.Settings.Settings.Models.Notifications;
diff --git a/src/Ombi.Notifications/Agents/PushoverNotification.cs b/src/Ombi.Notifications/Agents/PushoverNotification.cs
index 86f91dbaa..0d1675f82 100644
--- a/src/Ombi.Notifications/Agents/PushoverNotification.cs
+++ b/src/Ombi.Notifications/Agents/PushoverNotification.cs
@@ -5,7 +5,6 @@ using Ombi.Api.Pushbullet;
using Ombi.Api.Pushover;
using Ombi.Core.Settings;
using Ombi.Helpers;
-using Ombi.Notifications.Interfaces;
using Ombi.Notifications.Models;
using Ombi.Settings.Settings.Models;
using Ombi.Settings.Settings.Models.Notifications;
diff --git a/src/Ombi.Notifications/Agents/SlackNotification.cs b/src/Ombi.Notifications/Agents/SlackNotification.cs
index ee81e9729..fdbd7ba64 100644
--- a/src/Ombi.Notifications/Agents/SlackNotification.cs
+++ b/src/Ombi.Notifications/Agents/SlackNotification.cs
@@ -5,7 +5,6 @@ using Ombi.Api.Slack;
using Ombi.Api.Slack.Models;
using Ombi.Core.Settings;
using Ombi.Helpers;
-using Ombi.Notifications.Interfaces;
using Ombi.Notifications.Models;
using Ombi.Settings.Settings.Models;
using Ombi.Settings.Settings.Models.Notifications;
diff --git a/src/Ombi.Notifications/Agents/TelegramNotification.cs b/src/Ombi.Notifications/Agents/TelegramNotification.cs
index cf463bf99..8e4c4e898 100644
--- a/src/Ombi.Notifications/Agents/TelegramNotification.cs
+++ b/src/Ombi.Notifications/Agents/TelegramNotification.cs
@@ -3,7 +3,6 @@ using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Ombi.Core.Settings;
using Ombi.Helpers;
-using Ombi.Notifications.Interfaces;
using Ombi.Notifications.Models;
using Ombi.Settings.Settings.Models;
using Ombi.Settings.Settings.Models.Notifications;
diff --git a/src/Ombi.Notifications/BaseNotification.cs b/src/Ombi.Notifications/BaseNotification.cs
index 53d6d5d9d..57eafedd9 100644
--- a/src/Ombi.Notifications/BaseNotification.cs
+++ b/src/Ombi.Notifications/BaseNotification.cs
@@ -1,5 +1,4 @@
using System;
-using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
@@ -14,7 +13,7 @@ using Ombi.Store.Entities.Requests;
using Ombi.Store.Repository;
using Ombi.Store.Repository.Requests;
-namespace Ombi.Notifications.Interfaces
+namespace Ombi.Notifications
{
public abstract class BaseNotification : INotification where T : Settings.Settings.Models.Settings, new()
{
diff --git a/src/Ombi.Notifications/NotificationService.cs b/src/Ombi.Notifications/NotificationService.cs
index d3651871f..c2985a21b 100644
--- a/src/Ombi.Notifications/NotificationService.cs
+++ b/src/Ombi.Notifications/NotificationService.cs
@@ -6,7 +6,6 @@ using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Ombi.Core.Notifications;
using Ombi.Helpers;
-using Ombi.Notifications.Interfaces;
using Ombi.Notifications.Models;
namespace Ombi.Notifications
diff --git a/src/Ombi.Schedule.Tests/NewsletterTests.cs b/src/Ombi.Schedule.Tests/NewsletterTests.cs
index 146cd97cf..f729e8899 100644
--- a/src/Ombi.Schedule.Tests/NewsletterTests.cs
+++ b/src/Ombi.Schedule.Tests/NewsletterTests.cs
@@ -1,5 +1,7 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using NUnit.Framework;
+using Ombi.Helpers;
using static Ombi.Schedule.Jobs.Ombi.NewsletterJob;
namespace Ombi.Schedule.Tests
@@ -15,7 +17,7 @@ namespace Ombi.Schedule.Tests
{
ep.Add(i);
}
- var result = BuildEpisodeList(ep);
+ var result = StringHelper.BuildEpisodeList(ep);
return result;
}
diff --git a/src/Ombi.Schedule/JobSetup.cs b/src/Ombi.Schedule/JobSetup.cs
index 7ce32de04..fa111d5f4 100644
--- a/src/Ombi.Schedule/JobSetup.cs
+++ b/src/Ombi.Schedule/JobSetup.cs
@@ -21,7 +21,7 @@ namespace Ombi.Schedule
IEmbyUserImporter embyUserImporter, ISonarrSync cache, ICouchPotatoSync cpCache,
ISettingsService jobsettings, ISickRageSync srSync, IRefreshMetadata refresh,
INewsletterJob newsletter, IPlexRecentlyAddedSync recentlyAddedPlex, ILidarrArtistSync artist,
- IIssuesPurge purge)
+ IIssuesPurge purge, IResendFailedRequests resender)
{
_plexContentSync = plexContentSync;
_radarrSync = radarrSync;
@@ -38,6 +38,7 @@ namespace Ombi.Schedule
_plexRecentlyAddedSync = recentlyAddedPlex;
_lidarrArtistSync = artist;
_issuesPurge = purge;
+ _resender = resender;
}
private readonly IPlexContentSync _plexContentSync;
@@ -55,6 +56,7 @@ namespace Ombi.Schedule
private readonly INewsletterJob _newsletter;
private readonly ILidarrArtistSync _lidarrArtistSync;
private readonly IIssuesPurge _issuesPurge;
+ private readonly IResendFailedRequests _resender;
public void Setup()
{
@@ -76,6 +78,8 @@ namespace Ombi.Schedule
RecurringJob.AddOrUpdate(() => _embyUserImporter.Start(), JobSettingsHelper.UserImporter(s));
RecurringJob.AddOrUpdate(() => _plexUserImporter.Start(), JobSettingsHelper.UserImporter(s));
RecurringJob.AddOrUpdate(() => _newsletter.Start(), JobSettingsHelper.Newsletter(s));
+ RecurringJob.AddOrUpdate(() => _newsletter.Start(), JobSettingsHelper.Newsletter(s));
+ RecurringJob.AddOrUpdate(() => _resender.Start(), JobSettingsHelper.ResendFailedRequests(s));
}
diff --git a/src/Ombi.Schedule/Jobs/Ombi/IResendFailedRequests.cs b/src/Ombi.Schedule/Jobs/Ombi/IResendFailedRequests.cs
new file mode 100644
index 000000000..b55c0f69b
--- /dev/null
+++ b/src/Ombi.Schedule/Jobs/Ombi/IResendFailedRequests.cs
@@ -0,0 +1,9 @@
+using System.Threading.Tasks;
+
+namespace Ombi.Schedule.Jobs.Ombi
+{
+ public interface IResendFailedRequests
+ {
+ Task Start();
+ }
+}
\ No newline at end of file
diff --git a/src/Ombi.Schedule/Jobs/Ombi/NewsletterJob.cs b/src/Ombi.Schedule/Jobs/Ombi/NewsletterJob.cs
index 472cd325b..ab0ef9578 100644
--- a/src/Ombi.Schedule/Jobs/Ombi/NewsletterJob.cs
+++ b/src/Ombi.Schedule/Jobs/Ombi/NewsletterJob.cs
@@ -677,7 +677,7 @@ namespace Ombi.Schedule.Jobs.Ombi
foreach (var epInformation in results.OrderBy(x => x.SeasonNumber))
{
var orderedEpisodes = epInformation.Episodes.OrderBy(x => x.EpisodeNumber).ToList();
- var episodeString = BuildEpisodeList(orderedEpisodes.Select(x => x.EpisodeNumber));
+ var episodeString = StringHelper.BuildEpisodeList(orderedEpisodes.Select(x => x.EpisodeNumber));
finalsb.Append($"Season: {epInformation.SeasonNumber} - Episodes: {episodeString}");
finalsb.Append("
");
}
@@ -715,48 +715,7 @@ namespace Ombi.Schedule.Jobs.Ombi
}
}
- public static string BuildEpisodeList(IEnumerable orderedEpisodes)
- {
- var epSb = new StringBuilder();
- var previousEpisodes = new List();
- var previousEpisode = -1;
- foreach (var ep in orderedEpisodes)
- {
- if (ep - 1 == previousEpisode)
- {
- // This is the next one
- previousEpisodes.Add(ep);
- }
- else
- {
- if (previousEpisodes.Count > 1)
- {
- // End it
- epSb.Append($"{previousEpisodes.First()}-{previousEpisodes.Last()}, ");
- }
- else if (previousEpisodes.Count == 1)
- {
- epSb.Append($"{previousEpisodes.FirstOrDefault()}, ");
- }
- // New one
- previousEpisodes.Clear();
- previousEpisodes.Add(ep);
- }
- previousEpisode = ep;
- }
-
- if (previousEpisodes.Count > 1)
- {
- // Got some left over
- epSb.Append($"{previousEpisodes.First()}-{previousEpisodes.Last()}");
- }
- else if(previousEpisodes.Count == 1)
- {
- epSb.Append(previousEpisodes.FirstOrDefault());
- }
-
- return epSb.ToString();
- }
+
private async Task ProcessEmbyTv(HashSet embyContent, StringBuilder sb)
{
@@ -841,7 +800,7 @@ namespace Ombi.Schedule.Jobs.Ombi
foreach (var epInformation in results.OrderBy(x => x.SeasonNumber))
{
var orderedEpisodes = epInformation.Episodes.OrderBy(x => x.EpisodeNumber).ToList();
- var episodeString = BuildEpisodeList(orderedEpisodes.Select(x => x.EpisodeNumber));
+ var episodeString = StringHelper.BuildEpisodeList(orderedEpisodes.Select(x => x.EpisodeNumber));
finalsb.Append($"Season: {epInformation.SeasonNumber} - Episodes: {episodeString}");
finalsb.Append("
");
}
diff --git a/src/Ombi.Schedule/Jobs/Ombi/ResendFailedRequests.cs b/src/Ombi.Schedule/Jobs/Ombi/ResendFailedRequests.cs
new file mode 100644
index 000000000..bc8f93a97
--- /dev/null
+++ b/src/Ombi.Schedule/Jobs/Ombi/ResendFailedRequests.cs
@@ -0,0 +1,75 @@
+using System;
+using System.Linq;
+using System.Threading.Tasks;
+using Microsoft.EntityFrameworkCore;
+using Ombi.Core;
+using Ombi.Core.Senders;
+using Ombi.Store.Entities;
+using Ombi.Store.Repository;
+using Ombi.Store.Repository.Requests;
+
+namespace Ombi.Schedule.Jobs.Ombi
+{
+ public class ResendFailedRequests : IResendFailedRequests
+ {
+ public ResendFailedRequests(IRepository queue, IMovieSender movieSender, ITvSender tvSender, IMusicSender musicSender,
+ IMovieRequestRepository movieRepo, ITvRequestRepository tvRepo, IMusicRequestRepository music)
+ {
+ _requestQueue = queue;
+ _movieSender = movieSender;
+ _tvSender = tvSender;
+ _musicSender = musicSender;
+ _movieRequestRepository = movieRepo;
+ _tvRequestRepository = tvRepo;
+ _musicRequestRepository = music;
+ }
+
+ private readonly IRepository _requestQueue;
+ private readonly IMovieSender _movieSender;
+ private readonly ITvSender _tvSender;
+ private readonly IMusicSender _musicSender;
+ private readonly IMovieRequestRepository _movieRequestRepository;
+ private readonly ITvRequestRepository _tvRequestRepository;
+ private readonly IMusicRequestRepository _musicRequestRepository;
+
+ public async Task Start()
+ {
+ // Get all the failed ones!
+ var failedRequests = _requestQueue.GetAll().Where(x => !x.Completed.HasValue);
+
+ foreach (var request in failedRequests)
+ {
+ if (request.Type == RequestType.Movie)
+ {
+ var movieRequest = await _movieRequestRepository.GetAll().FirstOrDefaultAsync(x => x.Id == request.RequestId);
+ var result = await _movieSender.Send(movieRequest);
+ if (result.Success)
+ {
+ request.Completed = DateTime.UtcNow;
+ await _requestQueue.SaveChangesAsync();
+ }
+ }
+ if (request.Type == RequestType.TvShow)
+ {
+ var tvRequest = await _tvRequestRepository.GetChild().FirstOrDefaultAsync(x => x.Id == request.RequestId);
+ var result = await _tvSender.Send(tvRequest);
+ if (result.Success)
+ {
+ request.Completed = DateTime.UtcNow;
+ await _requestQueue.SaveChangesAsync();
+ }
+ }
+ if (request.Type == RequestType.Album)
+ {
+ var musicRequest = await _musicRequestRepository.GetAll().FirstOrDefaultAsync(x => x.Id == request.RequestId);
+ var result = await _musicSender.Send(musicRequest);
+ if (result.Success)
+ {
+ request.Completed = DateTime.UtcNow;
+ await _requestQueue.SaveChangesAsync();
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Ombi.Schedule/Ombi.Schedule.csproj b/src/Ombi.Schedule/Ombi.Schedule.csproj
index 06cc2bb49..94657e922 100644
--- a/src/Ombi.Schedule/Ombi.Schedule.csproj
+++ b/src/Ombi.Schedule/Ombi.Schedule.csproj
@@ -34,6 +34,7 @@
+
diff --git a/src/Ombi.Settings/Settings/Models/JobSettings.cs b/src/Ombi.Settings/Settings/Models/JobSettings.cs
index 8b283cdf7..46a950185 100644
--- a/src/Ombi.Settings/Settings/Models/JobSettings.cs
+++ b/src/Ombi.Settings/Settings/Models/JobSettings.cs
@@ -15,5 +15,6 @@
public string Newsletter { get; set; }
public string LidarrArtistSync { get; set; }
public string IssuesPurge { get; set; }
+ public string RetryRequests { get; set; }
}
}
\ No newline at end of file
diff --git a/src/Ombi.Settings/Settings/Models/JobSettingsHelper.cs b/src/Ombi.Settings/Settings/Models/JobSettingsHelper.cs
index 4491ca27a..1aca72344 100644
--- a/src/Ombi.Settings/Settings/Models/JobSettingsHelper.cs
+++ b/src/Ombi.Settings/Settings/Models/JobSettingsHelper.cs
@@ -61,6 +61,10 @@ namespace Ombi.Settings.Settings.Models
{
return Get(s.IssuesPurge, Cron.Daily());
}
+ public static string ResendFailedRequests(JobSettings s)
+ {
+ return Get(s.RetryRequests, Cron.Daily(6));
+ }
private static string Get(string settings, string defaultCron)
{
diff --git a/src/Ombi.Store/Context/OmbiContext.cs b/src/Ombi.Store/Context/OmbiContext.cs
index 16f26c65a..3d8c05daa 100644
--- a/src/Ombi.Store/Context/OmbiContext.cs
+++ b/src/Ombi.Store/Context/OmbiContext.cs
@@ -56,6 +56,7 @@ namespace Ombi.Store.Context
public DbSet RequestSubscription { get; set; }
public DbSet UserNotificationPreferences { get; set; }
public DbSet UserQualityProfileses { get; set; }
+ public DbSet RequestQueue { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
diff --git a/src/Ombi.Store/Entities/RequestQueue.cs b/src/Ombi.Store/Entities/RequestQueue.cs
new file mode 100644
index 000000000..85f73e04b
--- /dev/null
+++ b/src/Ombi.Store/Entities/RequestQueue.cs
@@ -0,0 +1,16 @@
+using System;
+using System.ComponentModel.DataAnnotations.Schema;
+
+namespace Ombi.Store.Entities
+{
+ [Table("RequestQueue")]
+ public class RequestQueue : Entity
+ {
+ public int RequestId { get; set; }
+ public RequestType Type { get; set; }
+ public DateTime Dts { get; set; }
+ public string Error { get; set; }
+ public DateTime? Completed { get; set; }
+ public int RetryCount { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/Ombi.Store/Entities/RequestType.cs b/src/Ombi.Store/Entities/RequestType.cs
index 151453bdd..4d2d20ac4 100644
--- a/src/Ombi.Store/Entities/RequestType.cs
+++ b/src/Ombi.Store/Entities/RequestType.cs
@@ -1,8 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace Ombi.Store.Entities
+namespace Ombi.Store.Entities
{
public enum RequestType
{
diff --git a/src/Ombi.Store/Migrations/20181204084915_RequestQueue.Designer.cs b/src/Ombi.Store/Migrations/20181204084915_RequestQueue.Designer.cs
new file mode 100644
index 000000000..468abb2c7
--- /dev/null
+++ b/src/Ombi.Store/Migrations/20181204084915_RequestQueue.Designer.cs
@@ -0,0 +1,1204 @@
+//
+using System;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using Ombi.Store.Context;
+
+namespace Ombi.Store.Migrations
+{
+ [DbContext(typeof(OmbiContext))]
+ [Migration("20181204084915_RequestQueue")]
+ partial class RequestQueue
+ {
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "2.1.4-rtm-31024");
+
+ 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.LidarrAlbumCache", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("AddedAt");
+
+ b.Property("ArtistId");
+
+ b.Property("ForeignAlbumId");
+
+ b.Property("Monitored");
+
+ b.Property("PercentOfTracks");
+
+ b.Property("ReleaseDate");
+
+ b.Property("Title");
+
+ b.Property("TrackCount");
+
+ b.HasKey("Id");
+
+ b.ToTable("LidarrAlbumCache");
+ });
+
+ modelBuilder.Entity("Ombi.Store.Entities.LidarrArtistCache", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("ArtistId");
+
+ b.Property("ArtistName");
+
+ b.Property("ForeignArtistId");
+
+ b.Property("Monitored");
+
+ b.HasKey("Id");
+
+ b.ToTable("LidarrArtistCache");
+ });
+
+ 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("MusicRequestLimit");
+
+ 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("AlbumId");
+
+ 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.RequestQueue", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("Completed");
+
+ b.Property("Dts");
+
+ b.Property("Error");
+
+ b.Property("RequestId");
+
+ b.Property("RetryCount");
+
+ b.Property("Type");
+
+ b.HasKey("Id");
+
+ b.ToTable("RequestQueue");
+ });
+
+ modelBuilder.Entity("Ombi.Store.Entities.Requests.AlbumRequest", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("Approved");
+
+ b.Property("ArtistName");
+
+ b.Property("Available");
+
+ b.Property("Cover");
+
+ b.Property("Denied");
+
+ b.Property("DeniedReason");
+
+ b.Property("Disk");
+
+ b.Property("ForeignAlbumId");
+
+ b.Property("ForeignArtistId");
+
+ b.Property("MarkedAsApproved");
+
+ b.Property("MarkedAsAvailable");
+
+ b.Property("MarkedAsDenied");
+
+ b.Property("Rating");
+
+ b.Property("ReleaseDate");
+
+ b.Property("RequestType");
+
+ b.Property("RequestedDate");
+
+ b.Property("RequestedUserId");
+
+ b.Property("Title");
+
+ b.HasKey("Id");
+
+ b.HasIndex("RequestedUserId");
+
+ b.ToTable("AlbumRequests");
+ });
+
+ 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("MarkedAsApproved");
+
+ b.Property("MarkedAsAvailable");
+
+ b.Property("MarkedAsDenied");
+
+ 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