mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-21 05:43:19 -07:00
Merge pull request #2672 from tidusjar/feature/request-queue
Feature/request queue
This commit is contained in:
commit
60aa1c9fb0
47 changed files with 1817 additions and 140 deletions
|
@ -11,7 +11,7 @@ using Ombi.Core.Models;
|
||||||
using Ombi.Core.Models.UI;
|
using Ombi.Core.Models.UI;
|
||||||
using Ombi.Core.Rule.Interfaces;
|
using Ombi.Core.Rule.Interfaces;
|
||||||
using Ombi.Core.Settings;
|
using Ombi.Core.Settings;
|
||||||
using Ombi.Schedule.Jobs.Ombi;
|
using Ombi.Helpers;
|
||||||
using Ombi.Settings.Settings.Models;
|
using Ombi.Settings.Settings.Models;
|
||||||
using Ombi.Store.Entities;
|
using Ombi.Store.Entities;
|
||||||
using Ombi.Store.Repository;
|
using Ombi.Store.Repository;
|
||||||
|
@ -114,7 +114,7 @@ namespace Ombi.Core.Engine
|
||||||
foreach (var epInformation in childRequests.SeasonRequests.OrderBy(x => x.SeasonNumber))
|
foreach (var epInformation in childRequests.SeasonRequests.OrderBy(x => x.SeasonNumber))
|
||||||
{
|
{
|
||||||
var orderedEpisodes = epInformation.Episodes.OrderBy(x => x.EpisodeNumber).ToList();
|
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($"Season: {epInformation.SeasonNumber} - Episodes: {episodeString}");
|
||||||
finalsb.Append("<br />");
|
finalsb.Append("<br />");
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,16 +20,18 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Ombi.Api.CouchPotato\Ombi.Api.CouchPotato.csproj" />
|
||||||
<ProjectReference Include="..\Ombi.Api.DogNzb\Ombi.Api.DogNzb.csproj" />
|
<ProjectReference Include="..\Ombi.Api.DogNzb\Ombi.Api.DogNzb.csproj" />
|
||||||
|
<ProjectReference Include="..\Ombi.Api.Emby\Ombi.Api.Emby.csproj" />
|
||||||
<ProjectReference Include="..\Ombi.Api.Lidarr\Ombi.Api.Lidarr.csproj" />
|
<ProjectReference Include="..\Ombi.Api.Lidarr\Ombi.Api.Lidarr.csproj" />
|
||||||
<ProjectReference Include="..\Ombi.Api.Plex\Ombi.Api.Plex.csproj" />
|
<ProjectReference Include="..\Ombi.Api.Plex\Ombi.Api.Plex.csproj" />
|
||||||
|
<ProjectReference Include="..\Ombi.Api.Radarr\Ombi.Api.Radarr.csproj" />
|
||||||
<ProjectReference Include="..\Ombi.Api.SickRage\Ombi.Api.SickRage.csproj" />
|
<ProjectReference Include="..\Ombi.Api.SickRage\Ombi.Api.SickRage.csproj" />
|
||||||
<ProjectReference Include="..\Ombi.Api.Sonarr\Ombi.Api.Sonarr.csproj" />
|
<ProjectReference Include="..\Ombi.Api.Sonarr\Ombi.Api.Sonarr.csproj" />
|
||||||
<ProjectReference Include="..\Ombi.Api.Trakt\Ombi.Api.Trakt.csproj" />
|
<ProjectReference Include="..\Ombi.Api.Trakt\Ombi.Api.Trakt.csproj" />
|
||||||
<ProjectReference Include="..\Ombi.Api.TvMaze\Ombi.Api.TvMaze.csproj" />
|
<ProjectReference Include="..\Ombi.Api.TvMaze\Ombi.Api.TvMaze.csproj" />
|
||||||
<ProjectReference Include="..\Ombi.Helpers\Ombi.Helpers.csproj" />
|
<ProjectReference Include="..\Ombi.Helpers\Ombi.Helpers.csproj" />
|
||||||
<ProjectReference Include="..\Ombi.Notifications\Ombi.Notifications.csproj" />
|
<ProjectReference Include="..\Ombi.Notifications\Ombi.Notifications.csproj" />
|
||||||
<ProjectReference Include="..\Ombi.Schedule\Ombi.Schedule.csproj" />
|
|
||||||
<ProjectReference Include="..\Ombi.Settings\Ombi.Settings.csproj" />
|
<ProjectReference Include="..\Ombi.Settings\Ombi.Settings.csproj" />
|
||||||
<ProjectReference Include="..\Ombi.Store\Ombi.Store.csproj" />
|
<ProjectReference Include="..\Ombi.Store\Ombi.Store.csproj" />
|
||||||
<ProjectReference Include="..\Ombi.TheMovieDbApi\Ombi.Api.TheMovieDb.csproj" />
|
<ProjectReference Include="..\Ombi.TheMovieDbApi\Ombi.Api.TheMovieDb.csproj" />
|
||||||
|
|
|
@ -20,7 +20,7 @@ namespace Ombi.Core.Senders
|
||||||
{
|
{
|
||||||
public MovieSender(ISettingsService<RadarrSettings> radarrSettings, IRadarrApi api, ILogger<MovieSender> log,
|
public MovieSender(ISettingsService<RadarrSettings> radarrSettings, IRadarrApi api, ILogger<MovieSender> log,
|
||||||
ISettingsService<DogNzbSettings> dogSettings, IDogNzbApi dogApi, ISettingsService<CouchPotatoSettings> cpSettings,
|
ISettingsService<DogNzbSettings> dogSettings, IDogNzbApi dogApi, ISettingsService<CouchPotatoSettings> cpSettings,
|
||||||
ICouchPotatoApi cpApi, IRepository<UserQualityProfiles> userProfiles)
|
ICouchPotatoApi cpApi, IRepository<UserQualityProfiles> userProfiles, IRepository<RequestQueue> requestQueue, INotificationHelper notify)
|
||||||
{
|
{
|
||||||
RadarrSettings = radarrSettings;
|
RadarrSettings = radarrSettings;
|
||||||
RadarrApi = api;
|
RadarrApi = api;
|
||||||
|
@ -30,6 +30,8 @@ namespace Ombi.Core.Senders
|
||||||
CouchPotatoSettings = cpSettings;
|
CouchPotatoSettings = cpSettings;
|
||||||
CouchPotatoApi = cpApi;
|
CouchPotatoApi = cpApi;
|
||||||
_userProfiles = userProfiles;
|
_userProfiles = userProfiles;
|
||||||
|
_requestQueuRepository = requestQueue;
|
||||||
|
_notificationHelper = notify;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ISettingsService<RadarrSettings> RadarrSettings { get; }
|
private ISettingsService<RadarrSettings> RadarrSettings { get; }
|
||||||
|
@ -40,9 +42,14 @@ namespace Ombi.Core.Senders
|
||||||
private ISettingsService<CouchPotatoSettings> CouchPotatoSettings { get; }
|
private ISettingsService<CouchPotatoSettings> CouchPotatoSettings { get; }
|
||||||
private ICouchPotatoApi CouchPotatoApi { get; }
|
private ICouchPotatoApi CouchPotatoApi { get; }
|
||||||
private readonly IRepository<UserQualityProfiles> _userProfiles;
|
private readonly IRepository<UserQualityProfiles> _userProfiles;
|
||||||
|
private readonly IRepository<RequestQueue> _requestQueuRepository;
|
||||||
|
private readonly INotificationHelper _notificationHelper;
|
||||||
|
|
||||||
public async Task<SenderResult> Send(MovieRequests model)
|
public async Task<SenderResult> Send(MovieRequests model)
|
||||||
{
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
var cpSettings = await CouchPotatoSettings.GetSettingsAsync();
|
var cpSettings = await CouchPotatoSettings.GetSettingsAsync();
|
||||||
//var watcherSettings = await WatcherSettings.GetSettingsAsync();
|
//var watcherSettings = await WatcherSettings.GetSettingsAsync();
|
||||||
var radarrSettings = await RadarrSettings.GetSettingsAsync();
|
var radarrSettings = await RadarrSettings.GetSettingsAsync();
|
||||||
|
@ -66,12 +73,32 @@ namespace Ombi.Core.Senders
|
||||||
{
|
{
|
||||||
return await SendToCp(model, cpSettings, cpSettings.DefaultProfileId);
|
return await SendToCp(model, cpSettings, cpSettings.DefaultProfileId);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Log.LogError(e, "Error when seing movie to DVR app, added to the request queue");
|
||||||
|
|
||||||
//if (watcherSettings.Enabled)
|
// Check if already in request quee
|
||||||
//{
|
var existingQueue = await _requestQueuRepository.FirstOrDefaultAsync(x => x.RequestId == model.Id);
|
||||||
// return SendToWatcher(model, watcherSettings);
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return new SenderResult
|
return new SenderResult
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,29 +1,40 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using Ombi.Api.Lidarr;
|
using Ombi.Api.Lidarr;
|
||||||
using Ombi.Api.Lidarr.Models;
|
using Ombi.Api.Lidarr.Models;
|
||||||
using Ombi.Api.Radarr;
|
|
||||||
using Ombi.Core.Settings;
|
using Ombi.Core.Settings;
|
||||||
using Ombi.Helpers;
|
using Ombi.Helpers;
|
||||||
using Ombi.Settings.Settings.Models.External;
|
using Ombi.Settings.Settings.Models.External;
|
||||||
|
using Ombi.Store.Entities;
|
||||||
using Ombi.Store.Entities.Requests;
|
using Ombi.Store.Entities.Requests;
|
||||||
using Serilog;
|
using Ombi.Store.Repository;
|
||||||
|
using ILogger = Microsoft.Extensions.Logging.ILogger;
|
||||||
|
|
||||||
namespace Ombi.Core.Senders
|
namespace Ombi.Core.Senders
|
||||||
{
|
{
|
||||||
public class MusicSender : IMusicSender
|
public class MusicSender : IMusicSender
|
||||||
{
|
{
|
||||||
public MusicSender(ISettingsService<LidarrSettings> lidarr, ILidarrApi lidarrApi)
|
public MusicSender(ISettingsService<LidarrSettings> lidarr, ILidarrApi lidarrApi, ILogger<MusicSender> log,
|
||||||
|
IRepository<RequestQueue> requestQueue, INotificationHelper notify)
|
||||||
{
|
{
|
||||||
_lidarrSettings = lidarr;
|
_lidarrSettings = lidarr;
|
||||||
_lidarrApi = lidarrApi;
|
_lidarrApi = lidarrApi;
|
||||||
|
_log = log;
|
||||||
|
_requestQueueRepository = requestQueue;
|
||||||
|
_notificationHelper = notify;
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly ISettingsService<LidarrSettings> _lidarrSettings;
|
private readonly ISettingsService<LidarrSettings> _lidarrSettings;
|
||||||
private readonly ILidarrApi _lidarrApi;
|
private readonly ILidarrApi _lidarrApi;
|
||||||
|
private readonly ILogger _log;
|
||||||
|
private readonly IRepository<RequestQueue> _requestQueueRepository;
|
||||||
|
private readonly INotificationHelper _notificationHelper;
|
||||||
|
|
||||||
public async Task<SenderResult> Send(AlbumRequest model)
|
public async Task<SenderResult> Send(AlbumRequest model)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
var settings = await _lidarrSettings.GetSettingsAsync();
|
var settings = await _lidarrSettings.GetSettingsAsync();
|
||||||
if (settings.Enabled)
|
if (settings.Enabled)
|
||||||
|
@ -33,6 +44,33 @@ namespace Ombi.Core.Senders
|
||||||
|
|
||||||
return new SenderResult { Success = false, Sent = false, Message = "Lidarr is not enabled" };
|
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 = "Something went wrong!" };
|
||||||
|
}
|
||||||
|
|
||||||
private async Task<SenderResult> SendToLidarr(AlbumRequest model, LidarrSettings settings)
|
private async Task<SenderResult> SendToLidarr(AlbumRequest model, LidarrSettings settings)
|
||||||
{
|
{
|
||||||
|
|
|
@ -23,7 +23,7 @@ namespace Ombi.Core.Senders
|
||||||
{
|
{
|
||||||
public TvSender(ISonarrApi sonarrApi, ISonarrV3Api sonarrV3Api, ILogger<TvSender> log, ISettingsService<SonarrSettings> sonarrSettings,
|
public TvSender(ISonarrApi sonarrApi, ISonarrV3Api sonarrV3Api, ILogger<TvSender> log, ISettingsService<SonarrSettings> sonarrSettings,
|
||||||
ISettingsService<DogNzbSettings> dog, IDogNzbApi dogApi, ISettingsService<SickRageSettings> srSettings,
|
ISettingsService<DogNzbSettings> dog, IDogNzbApi dogApi, ISettingsService<SickRageSettings> srSettings,
|
||||||
ISickRageApi srApi, IRepository<UserQualityProfiles> userProfiles)
|
ISickRageApi srApi, IRepository<UserQualityProfiles> userProfiles, IRepository<RequestQueue> requestQueue, INotificationHelper notify)
|
||||||
{
|
{
|
||||||
SonarrApi = sonarrApi;
|
SonarrApi = sonarrApi;
|
||||||
SonarrV3Api = sonarrV3Api;
|
SonarrV3Api = sonarrV3Api;
|
||||||
|
@ -34,6 +34,8 @@ namespace Ombi.Core.Senders
|
||||||
SickRageSettings = srSettings;
|
SickRageSettings = srSettings;
|
||||||
SickRageApi = srApi;
|
SickRageApi = srApi;
|
||||||
UserQualityProfiles = userProfiles;
|
UserQualityProfiles = userProfiles;
|
||||||
|
_requestQueueRepository = requestQueue;
|
||||||
|
_notificationHelper = notify;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ISonarrApi SonarrApi { get; }
|
private ISonarrApi SonarrApi { get; }
|
||||||
|
@ -45,8 +47,12 @@ namespace Ombi.Core.Senders
|
||||||
private ISettingsService<DogNzbSettings> DogNzbSettings { get; }
|
private ISettingsService<DogNzbSettings> DogNzbSettings { get; }
|
||||||
private ISettingsService<SickRageSettings> SickRageSettings { get; }
|
private ISettingsService<SickRageSettings> SickRageSettings { get; }
|
||||||
private IRepository<UserQualityProfiles> UserQualityProfiles { get; }
|
private IRepository<UserQualityProfiles> UserQualityProfiles { get; }
|
||||||
|
private readonly IRepository<RequestQueue> _requestQueueRepository;
|
||||||
|
private readonly INotificationHelper _notificationHelper;
|
||||||
|
|
||||||
public async Task<SenderResult> Send(ChildRequests model)
|
public async Task<SenderResult> Send(ChildRequests model)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
var sonarr = await SonarrSettings.GetSettingsAsync();
|
var sonarr = await SonarrSettings.GetSettingsAsync();
|
||||||
if (sonarr.Enabled)
|
if (sonarr.Enabled)
|
||||||
|
@ -100,6 +106,37 @@ namespace Ombi.Core.Senders
|
||||||
Success = true
|
Success = true
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
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.TvShow,
|
||||||
|
RetryCount = 0
|
||||||
|
});
|
||||||
|
_notificationHelper.Notify(model, NotificationType.ItemAddedToFaultQueue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new SenderResult
|
||||||
|
{
|
||||||
|
Success = false,
|
||||||
|
Message = "Something wen't wrong!"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
private async Task<DogNzbAddResult> SendToDogNzb(ChildRequests model, DogNzbSettings settings)
|
private async Task<DogNzbAddResult> SendToDogNzb(ChildRequests model, DogNzbSettings settings)
|
||||||
{
|
{
|
||||||
|
@ -177,7 +214,6 @@ namespace Ombi.Core.Senders
|
||||||
qualityToUse = model.ParentRequest.QualityOverride.Value;
|
qualityToUse = model.ParentRequest.QualityOverride.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Are we using v3 sonarr?
|
// Are we using v3 sonarr?
|
||||||
var sonarrV3 = s.V3;
|
var sonarrV3 = s.V3;
|
||||||
var languageProfileId = s.LanguageProfile;
|
var languageProfileId = s.LanguageProfile;
|
||||||
|
|
|
@ -199,6 +199,7 @@ namespace Ombi.DependencyInjection
|
||||||
services.AddTransient<ILidarrArtistSync, LidarrArtistSync>();
|
services.AddTransient<ILidarrArtistSync, LidarrArtistSync>();
|
||||||
services.AddTransient<ILidarrAvailabilityChecker, LidarrAvailabilityChecker>();
|
services.AddTransient<ILidarrAvailabilityChecker, LidarrAvailabilityChecker>();
|
||||||
services.AddTransient<IIssuesPurge, IssuesPurge>();
|
services.AddTransient<IIssuesPurge, IssuesPurge>();
|
||||||
|
services.AddTransient<IResendFailedRequests, ResendFailedRequests>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Security;
|
using System.Security;
|
||||||
|
@ -76,6 +77,49 @@ namespace Ombi.Helpers
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string BuildEpisodeList(IEnumerable<int> orderedEpisodes)
|
||||||
|
{
|
||||||
|
var epSb = new StringBuilder();
|
||||||
|
var previousEpisodes = new List<int>();
|
||||||
|
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)
|
public static string RemoveSpaces(this string str)
|
||||||
{
|
{
|
||||||
return str.Replace(" ", "");
|
return str.Replace(" ", "");
|
||||||
|
|
|
@ -6,7 +6,6 @@ using Ombi.Api.Discord;
|
||||||
using Ombi.Api.Discord.Models;
|
using Ombi.Api.Discord.Models;
|
||||||
using Ombi.Core.Settings;
|
using Ombi.Core.Settings;
|
||||||
using Ombi.Helpers;
|
using Ombi.Helpers;
|
||||||
using Ombi.Notifications.Interfaces;
|
|
||||||
using Ombi.Notifications.Models;
|
using Ombi.Notifications.Models;
|
||||||
using Ombi.Settings.Settings.Models;
|
using Ombi.Settings.Settings.Models;
|
||||||
using Ombi.Settings.Settings.Models.Notifications;
|
using Ombi.Settings.Settings.Models.Notifications;
|
||||||
|
|
|
@ -8,7 +8,6 @@ using Microsoft.Extensions.Logging;
|
||||||
using MimeKit;
|
using MimeKit;
|
||||||
using Ombi.Core.Settings;
|
using Ombi.Core.Settings;
|
||||||
using Ombi.Helpers;
|
using Ombi.Helpers;
|
||||||
using Ombi.Notifications.Interfaces;
|
|
||||||
using Ombi.Notifications.Models;
|
using Ombi.Notifications.Models;
|
||||||
using Ombi.Notifications.Templates;
|
using Ombi.Notifications.Templates;
|
||||||
using Ombi.Settings.Settings.Models;
|
using Ombi.Settings.Settings.Models;
|
||||||
|
|
|
@ -2,13 +2,10 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Ombi.Api.Discord;
|
|
||||||
using Ombi.Api.Discord.Models;
|
|
||||||
using Ombi.Api.Mattermost;
|
using Ombi.Api.Mattermost;
|
||||||
using Ombi.Api.Mattermost.Models;
|
using Ombi.Api.Mattermost.Models;
|
||||||
using Ombi.Core.Settings;
|
using Ombi.Core.Settings;
|
||||||
using Ombi.Helpers;
|
using Ombi.Helpers;
|
||||||
using Ombi.Notifications.Interfaces;
|
|
||||||
using Ombi.Notifications.Models;
|
using Ombi.Notifications.Models;
|
||||||
using Ombi.Settings.Settings.Models;
|
using Ombi.Settings.Settings.Models;
|
||||||
using Ombi.Settings.Settings.Models.Notifications;
|
using Ombi.Settings.Settings.Models.Notifications;
|
||||||
|
|
|
@ -8,7 +8,6 @@ using Microsoft.Extensions.Logging;
|
||||||
using Ombi.Api.Notifications;
|
using Ombi.Api.Notifications;
|
||||||
using Ombi.Core.Settings;
|
using Ombi.Core.Settings;
|
||||||
using Ombi.Helpers;
|
using Ombi.Helpers;
|
||||||
using Ombi.Notifications.Interfaces;
|
|
||||||
using Ombi.Notifications.Models;
|
using Ombi.Notifications.Models;
|
||||||
using Ombi.Settings.Settings.Models;
|
using Ombi.Settings.Settings.Models;
|
||||||
using Ombi.Settings.Settings.Models.Notifications;
|
using Ombi.Settings.Settings.Models.Notifications;
|
||||||
|
|
|
@ -4,7 +4,6 @@ using Microsoft.Extensions.Logging;
|
||||||
using Ombi.Api.Pushbullet;
|
using Ombi.Api.Pushbullet;
|
||||||
using Ombi.Core.Settings;
|
using Ombi.Core.Settings;
|
||||||
using Ombi.Helpers;
|
using Ombi.Helpers;
|
||||||
using Ombi.Notifications.Interfaces;
|
|
||||||
using Ombi.Notifications.Models;
|
using Ombi.Notifications.Models;
|
||||||
using Ombi.Settings.Settings.Models;
|
using Ombi.Settings.Settings.Models;
|
||||||
using Ombi.Settings.Settings.Models.Notifications;
|
using Ombi.Settings.Settings.Models.Notifications;
|
||||||
|
|
|
@ -5,7 +5,6 @@ using Ombi.Api.Pushbullet;
|
||||||
using Ombi.Api.Pushover;
|
using Ombi.Api.Pushover;
|
||||||
using Ombi.Core.Settings;
|
using Ombi.Core.Settings;
|
||||||
using Ombi.Helpers;
|
using Ombi.Helpers;
|
||||||
using Ombi.Notifications.Interfaces;
|
|
||||||
using Ombi.Notifications.Models;
|
using Ombi.Notifications.Models;
|
||||||
using Ombi.Settings.Settings.Models;
|
using Ombi.Settings.Settings.Models;
|
||||||
using Ombi.Settings.Settings.Models.Notifications;
|
using Ombi.Settings.Settings.Models.Notifications;
|
||||||
|
|
|
@ -5,7 +5,6 @@ using Ombi.Api.Slack;
|
||||||
using Ombi.Api.Slack.Models;
|
using Ombi.Api.Slack.Models;
|
||||||
using Ombi.Core.Settings;
|
using Ombi.Core.Settings;
|
||||||
using Ombi.Helpers;
|
using Ombi.Helpers;
|
||||||
using Ombi.Notifications.Interfaces;
|
|
||||||
using Ombi.Notifications.Models;
|
using Ombi.Notifications.Models;
|
||||||
using Ombi.Settings.Settings.Models;
|
using Ombi.Settings.Settings.Models;
|
||||||
using Ombi.Settings.Settings.Models.Notifications;
|
using Ombi.Settings.Settings.Models.Notifications;
|
||||||
|
|
|
@ -3,7 +3,6 @@ using System.Threading.Tasks;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Ombi.Core.Settings;
|
using Ombi.Core.Settings;
|
||||||
using Ombi.Helpers;
|
using Ombi.Helpers;
|
||||||
using Ombi.Notifications.Interfaces;
|
|
||||||
using Ombi.Notifications.Models;
|
using Ombi.Notifications.Models;
|
||||||
using Ombi.Settings.Settings.Models;
|
using Ombi.Settings.Settings.Models;
|
||||||
using Ombi.Settings.Settings.Models.Notifications;
|
using Ombi.Settings.Settings.Models.Notifications;
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
@ -14,7 +13,7 @@ using Ombi.Store.Entities.Requests;
|
||||||
using Ombi.Store.Repository;
|
using Ombi.Store.Repository;
|
||||||
using Ombi.Store.Repository.Requests;
|
using Ombi.Store.Repository.Requests;
|
||||||
|
|
||||||
namespace Ombi.Notifications.Interfaces
|
namespace Ombi.Notifications
|
||||||
{
|
{
|
||||||
public abstract class BaseNotification<T> : INotification where T : Settings.Settings.Models.Settings, new()
|
public abstract class BaseNotification<T> : INotification where T : Settings.Settings.Models.Settings, new()
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,7 +6,6 @@ using System.Threading.Tasks;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Ombi.Core.Notifications;
|
using Ombi.Core.Notifications;
|
||||||
using Ombi.Helpers;
|
using Ombi.Helpers;
|
||||||
using Ombi.Notifications.Interfaces;
|
|
||||||
using Ombi.Notifications.Models;
|
using Ombi.Notifications.Models;
|
||||||
|
|
||||||
namespace Ombi.Notifications
|
namespace Ombi.Notifications
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
using System.Collections.Generic;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
using Ombi.Helpers;
|
||||||
using static Ombi.Schedule.Jobs.Ombi.NewsletterJob;
|
using static Ombi.Schedule.Jobs.Ombi.NewsletterJob;
|
||||||
|
|
||||||
namespace Ombi.Schedule.Tests
|
namespace Ombi.Schedule.Tests
|
||||||
|
@ -15,7 +17,7 @@ namespace Ombi.Schedule.Tests
|
||||||
{
|
{
|
||||||
ep.Add(i);
|
ep.Add(i);
|
||||||
}
|
}
|
||||||
var result = BuildEpisodeList(ep);
|
var result = StringHelper.BuildEpisodeList(ep);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ namespace Ombi.Schedule
|
||||||
IEmbyUserImporter embyUserImporter, ISonarrSync cache, ICouchPotatoSync cpCache,
|
IEmbyUserImporter embyUserImporter, ISonarrSync cache, ICouchPotatoSync cpCache,
|
||||||
ISettingsService<JobSettings> jobsettings, ISickRageSync srSync, IRefreshMetadata refresh,
|
ISettingsService<JobSettings> jobsettings, ISickRageSync srSync, IRefreshMetadata refresh,
|
||||||
INewsletterJob newsletter, IPlexRecentlyAddedSync recentlyAddedPlex, ILidarrArtistSync artist,
|
INewsletterJob newsletter, IPlexRecentlyAddedSync recentlyAddedPlex, ILidarrArtistSync artist,
|
||||||
IIssuesPurge purge)
|
IIssuesPurge purge, IResendFailedRequests resender)
|
||||||
{
|
{
|
||||||
_plexContentSync = plexContentSync;
|
_plexContentSync = plexContentSync;
|
||||||
_radarrSync = radarrSync;
|
_radarrSync = radarrSync;
|
||||||
|
@ -38,6 +38,7 @@ namespace Ombi.Schedule
|
||||||
_plexRecentlyAddedSync = recentlyAddedPlex;
|
_plexRecentlyAddedSync = recentlyAddedPlex;
|
||||||
_lidarrArtistSync = artist;
|
_lidarrArtistSync = artist;
|
||||||
_issuesPurge = purge;
|
_issuesPurge = purge;
|
||||||
|
_resender = resender;
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly IPlexContentSync _plexContentSync;
|
private readonly IPlexContentSync _plexContentSync;
|
||||||
|
@ -55,6 +56,7 @@ namespace Ombi.Schedule
|
||||||
private readonly INewsletterJob _newsletter;
|
private readonly INewsletterJob _newsletter;
|
||||||
private readonly ILidarrArtistSync _lidarrArtistSync;
|
private readonly ILidarrArtistSync _lidarrArtistSync;
|
||||||
private readonly IIssuesPurge _issuesPurge;
|
private readonly IIssuesPurge _issuesPurge;
|
||||||
|
private readonly IResendFailedRequests _resender;
|
||||||
|
|
||||||
public void Setup()
|
public void Setup()
|
||||||
{
|
{
|
||||||
|
@ -76,6 +78,8 @@ namespace Ombi.Schedule
|
||||||
RecurringJob.AddOrUpdate(() => _embyUserImporter.Start(), JobSettingsHelper.UserImporter(s));
|
RecurringJob.AddOrUpdate(() => _embyUserImporter.Start(), JobSettingsHelper.UserImporter(s));
|
||||||
RecurringJob.AddOrUpdate(() => _plexUserImporter.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(() => _newsletter.Start(), JobSettingsHelper.Newsletter(s));
|
||||||
|
RecurringJob.AddOrUpdate(() => _resender.Start(), JobSettingsHelper.ResendFailedRequests(s));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
9
src/Ombi.Schedule/Jobs/Ombi/IResendFailedRequests.cs
Normal file
9
src/Ombi.Schedule/Jobs/Ombi/IResendFailedRequests.cs
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Ombi.Schedule.Jobs.Ombi
|
||||||
|
{
|
||||||
|
public interface IResendFailedRequests
|
||||||
|
{
|
||||||
|
Task Start();
|
||||||
|
}
|
||||||
|
}
|
|
@ -677,7 +677,7 @@ namespace Ombi.Schedule.Jobs.Ombi
|
||||||
foreach (var epInformation in results.OrderBy(x => x.SeasonNumber))
|
foreach (var epInformation in results.OrderBy(x => x.SeasonNumber))
|
||||||
{
|
{
|
||||||
var orderedEpisodes = epInformation.Episodes.OrderBy(x => x.EpisodeNumber).ToList();
|
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($"Season: {epInformation.SeasonNumber} - Episodes: {episodeString}");
|
||||||
finalsb.Append("<br />");
|
finalsb.Append("<br />");
|
||||||
}
|
}
|
||||||
|
@ -715,48 +715,7 @@ namespace Ombi.Schedule.Jobs.Ombi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string BuildEpisodeList(IEnumerable<int> orderedEpisodes)
|
|
||||||
{
|
|
||||||
var epSb = new StringBuilder();
|
|
||||||
var previousEpisodes = new List<int>();
|
|
||||||
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<EmbyEpisode> embyContent, StringBuilder sb)
|
private async Task ProcessEmbyTv(HashSet<EmbyEpisode> embyContent, StringBuilder sb)
|
||||||
{
|
{
|
||||||
|
@ -841,7 +800,7 @@ namespace Ombi.Schedule.Jobs.Ombi
|
||||||
foreach (var epInformation in results.OrderBy(x => x.SeasonNumber))
|
foreach (var epInformation in results.OrderBy(x => x.SeasonNumber))
|
||||||
{
|
{
|
||||||
var orderedEpisodes = epInformation.Episodes.OrderBy(x => x.EpisodeNumber).ToList();
|
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($"Season: {epInformation.SeasonNumber} - Episodes: {episodeString}");
|
||||||
finalsb.Append("<br />");
|
finalsb.Append("<br />");
|
||||||
}
|
}
|
||||||
|
|
75
src/Ombi.Schedule/Jobs/Ombi/ResendFailedRequests.cs
Normal file
75
src/Ombi.Schedule/Jobs/Ombi/ResendFailedRequests.cs
Normal file
|
@ -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<RequestQueue> 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> _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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -34,6 +34,7 @@
|
||||||
<ProjectReference Include="..\Ombi.Api.SickRage\Ombi.Api.SickRage.csproj" />
|
<ProjectReference Include="..\Ombi.Api.SickRage\Ombi.Api.SickRage.csproj" />
|
||||||
<ProjectReference Include="..\Ombi.Api.Sonarr\Ombi.Api.Sonarr.csproj" />
|
<ProjectReference Include="..\Ombi.Api.Sonarr\Ombi.Api.Sonarr.csproj" />
|
||||||
<ProjectReference Include="..\Ombi.Api.TvMaze\Ombi.Api.TvMaze.csproj" />
|
<ProjectReference Include="..\Ombi.Api.TvMaze\Ombi.Api.TvMaze.csproj" />
|
||||||
|
<ProjectReference Include="..\Ombi.Core\Ombi.Core.csproj" />
|
||||||
<ProjectReference Include="..\Ombi.Notifications\Ombi.Notifications.csproj" />
|
<ProjectReference Include="..\Ombi.Notifications\Ombi.Notifications.csproj" />
|
||||||
<ProjectReference Include="..\Ombi.Settings\Ombi.Settings.csproj" />
|
<ProjectReference Include="..\Ombi.Settings\Ombi.Settings.csproj" />
|
||||||
<ProjectReference Include="..\Ombi.TheMovieDbApi\Ombi.Api.TheMovieDb.csproj" />
|
<ProjectReference Include="..\Ombi.TheMovieDbApi\Ombi.Api.TheMovieDb.csproj" />
|
||||||
|
|
|
@ -15,5 +15,6 @@
|
||||||
public string Newsletter { get; set; }
|
public string Newsletter { get; set; }
|
||||||
public string LidarrArtistSync { get; set; }
|
public string LidarrArtistSync { get; set; }
|
||||||
public string IssuesPurge { get; set; }
|
public string IssuesPurge { get; set; }
|
||||||
|
public string RetryRequests { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -61,6 +61,10 @@ namespace Ombi.Settings.Settings.Models
|
||||||
{
|
{
|
||||||
return Get(s.IssuesPurge, Cron.Daily());
|
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)
|
private static string Get(string settings, string defaultCron)
|
||||||
{
|
{
|
||||||
|
|
|
@ -56,6 +56,7 @@ namespace Ombi.Store.Context
|
||||||
public DbSet<RequestSubscription> RequestSubscription { get; set; }
|
public DbSet<RequestSubscription> RequestSubscription { get; set; }
|
||||||
public DbSet<UserNotificationPreferences> UserNotificationPreferences { get; set; }
|
public DbSet<UserNotificationPreferences> UserNotificationPreferences { get; set; }
|
||||||
public DbSet<UserQualityProfiles> UserQualityProfileses { get; set; }
|
public DbSet<UserQualityProfiles> UserQualityProfileses { get; set; }
|
||||||
|
public DbSet<RequestQueue> RequestQueue { get; set; }
|
||||||
|
|
||||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||||
{
|
{
|
||||||
|
|
16
src/Ombi.Store/Entities/RequestQueue.cs
Normal file
16
src/Ombi.Store/Entities/RequestQueue.cs
Normal file
|
@ -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; }
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,8 +1,4 @@
|
||||||
using System;
|
namespace Ombi.Store.Entities
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace Ombi.Store.Entities
|
|
||||||
{
|
{
|
||||||
public enum RequestType
|
public enum RequestType
|
||||||
{
|
{
|
||||||
|
|
1204
src/Ombi.Store/Migrations/20181204084915_RequestQueue.Designer.cs
generated
Normal file
1204
src/Ombi.Store/Migrations/20181204084915_RequestQueue.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
35
src/Ombi.Store/Migrations/20181204084915_RequestQueue.cs
Normal file
35
src/Ombi.Store/Migrations/20181204084915_RequestQueue.cs
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
namespace Ombi.Store.Migrations
|
||||||
|
{
|
||||||
|
public partial class RequestQueue : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "RequestQueue",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(nullable: false)
|
||||||
|
.Annotation("Sqlite:Autoincrement", true),
|
||||||
|
RequestId = table.Column<int>(nullable: false),
|
||||||
|
Type = table.Column<int>(nullable: false),
|
||||||
|
Dts = table.Column<DateTime>(nullable: false),
|
||||||
|
Error = table.Column<string>(nullable: true),
|
||||||
|
Completed = table.Column<DateTime>(nullable: true),
|
||||||
|
RetryCount = table.Column<int>(nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_RequestQueue", x => x.Id);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "RequestQueue");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -14,7 +14,7 @@ namespace Ombi.Store.Migrations
|
||||||
{
|
{
|
||||||
#pragma warning disable 612, 618
|
#pragma warning disable 612, 618
|
||||||
modelBuilder
|
modelBuilder
|
||||||
.HasAnnotation("ProductVersion", "2.1.3-rtm-32065");
|
.HasAnnotation("ProductVersion", "2.1.4-rtm-31024");
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
|
||||||
{
|
{
|
||||||
|
@ -508,6 +508,28 @@ namespace Ombi.Store.Migrations
|
||||||
b.ToTable("RecentlyAddedLog");
|
b.ToTable("RecentlyAddedLog");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Ombi.Store.Entities.RequestQueue", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd();
|
||||||
|
|
||||||
|
b.Property<DateTime?>("Completed");
|
||||||
|
|
||||||
|
b.Property<DateTime>("Dts");
|
||||||
|
|
||||||
|
b.Property<string>("Error");
|
||||||
|
|
||||||
|
b.Property<int>("RequestId");
|
||||||
|
|
||||||
|
b.Property<int>("RetryCount");
|
||||||
|
|
||||||
|
b.Property<int>("Type");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("RequestQueue");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Ombi.Store.Entities.Requests.AlbumRequest", b =>
|
modelBuilder.Entity("Ombi.Store.Entities.Requests.AlbumRequest", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
|
|
11
src/Ombi/ClientApp/app/interfaces/IFailedRequests.ts
Normal file
11
src/Ombi/ClientApp/app/interfaces/IFailedRequests.ts
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
import { RequestType } from ".";
|
||||||
|
export interface IFailedRequestsViewModel {
|
||||||
|
failedId: number;
|
||||||
|
title: string;
|
||||||
|
releaseYear: Date;
|
||||||
|
requestId: number;
|
||||||
|
type: RequestType;
|
||||||
|
dts: Date;
|
||||||
|
error: string;
|
||||||
|
retryCount: number;
|
||||||
|
}
|
|
@ -1,9 +1,9 @@
|
||||||
import { IUser } from "./IUser";
|
import { IUser } from "./IUser";
|
||||||
|
|
||||||
export enum RequestType {
|
export enum RequestType {
|
||||||
|
tvShow = 0,
|
||||||
movie = 1,
|
movie = 1,
|
||||||
tvShow = 2,
|
album = 2,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// NEW WORLD
|
// NEW WORLD
|
||||||
|
|
|
@ -147,6 +147,7 @@ export interface IJobSettings {
|
||||||
plexRecentlyAddedSync: string;
|
plexRecentlyAddedSync: string;
|
||||||
lidarrArtistSync: string;
|
lidarrArtistSync: string;
|
||||||
issuesPurge: string;
|
issuesPurge: string;
|
||||||
|
retryRequests: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IIssueSettings extends ISettings {
|
export interface IIssueSettings extends ISettings {
|
||||||
|
|
|
@ -17,3 +17,4 @@ export * from "./IRecentlyAdded";
|
||||||
export * from "./ILidarr";
|
export * from "./ILidarr";
|
||||||
export * from "./ISearchMusicResult";
|
export * from "./ISearchMusicResult";
|
||||||
export * from "./IVote";
|
export * from "./IVote";
|
||||||
|
export * from "./IFailedRequests";
|
||||||
|
|
|
@ -15,3 +15,4 @@ export * from "./mobile.service";
|
||||||
export * from "./notificationMessage.service";
|
export * from "./notificationMessage.service";
|
||||||
export * from "./recentlyAdded.service";
|
export * from "./recentlyAdded.service";
|
||||||
export * from "./vote.service";
|
export * from "./vote.service";
|
||||||
|
export * from "./requestretry.service";
|
||||||
|
|
21
src/Ombi/ClientApp/app/services/requestretry.service.ts
Normal file
21
src/Ombi/ClientApp/app/services/requestretry.service.ts
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
import { PlatformLocation } from "@angular/common";
|
||||||
|
import { Injectable } from "@angular/core";
|
||||||
|
|
||||||
|
import { HttpClient } from "@angular/common/http";
|
||||||
|
import { Observable } from "rxjs";
|
||||||
|
|
||||||
|
import { IFailedRequestsViewModel } from "../interfaces";
|
||||||
|
import { ServiceHelpers } from "./service.helpers";
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class RequestRetryService extends ServiceHelpers {
|
||||||
|
constructor(http: HttpClient, public platformLocation: PlatformLocation) {
|
||||||
|
super(http, "/api/v1/requestretry/", platformLocation);
|
||||||
|
}
|
||||||
|
public getFailedRequests(): Observable<IFailedRequestsViewModel[]> {
|
||||||
|
return this.http.get<IFailedRequestsViewModel[]>(this.url, {headers: this.headers});
|
||||||
|
}
|
||||||
|
public deleteFailedRequest(failedId: number): Observable<boolean> {
|
||||||
|
return this.http.delete<boolean>(`${this.url}/${failedId}`, {headers: this.headers});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
|
||||||
|
<settings-menu></settings-menu>
|
||||||
|
|
||||||
|
|
||||||
|
<table class="table table-striped table-hover table-responsive table-condensed">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<td>Title</td>
|
||||||
|
<td>Type</td>
|
||||||
|
<td>Retry Count</td>
|
||||||
|
<td>Error Description</td>
|
||||||
|
<td>Delete</td>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr *ngFor="let v of vm">
|
||||||
|
<td class="vcenter">
|
||||||
|
{{v.title}}
|
||||||
|
</td>
|
||||||
|
<td>{{RequestType[v.type] | humanize}}</td>
|
||||||
|
<td class="vcenter">{{v.retryCount}}</td>
|
||||||
|
<td class="vcenter"> <i [pTooltip]="v.error" class="fa fa-info-circle"></i></td>
|
||||||
|
<td class="vcenter"><button class="btn btn-sm btn-danger-outline" (click)="remove(v)">Remove</button></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
|
@ -0,0 +1,27 @@
|
||||||
|
import { Component, OnInit } from "@angular/core";
|
||||||
|
import { IFailedRequestsViewModel, RequestType } from "../../interfaces";
|
||||||
|
import { RequestRetryService } from "../../services";
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
templateUrl: "./failedrequest.component.html",
|
||||||
|
})
|
||||||
|
export class FailedRequestsComponent implements OnInit {
|
||||||
|
|
||||||
|
public vm: IFailedRequestsViewModel[];
|
||||||
|
public RequestType = RequestType;
|
||||||
|
|
||||||
|
constructor(private retry: RequestRetryService) { }
|
||||||
|
|
||||||
|
public ngOnInit() {
|
||||||
|
this.retry.getFailedRequests().subscribe(x => this.vm = x);
|
||||||
|
}
|
||||||
|
|
||||||
|
public remove(failed: IFailedRequestsViewModel) {
|
||||||
|
this.retry.deleteFailedRequest(failed.failedId).subscribe(x => {
|
||||||
|
if(x) {
|
||||||
|
const index = this.vm.indexOf(failed);
|
||||||
|
this.vm.splice(index,1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -48,6 +48,13 @@
|
||||||
<small *ngIf="form.get('automaticUpdater').hasError('required')" class="error-text">The Automatic Update is required</small>
|
<small *ngIf="form.get('automaticUpdater').hasError('required')" class="error-text">The Automatic Update is required</small>
|
||||||
<button type="button" class="btn btn-sm btn-primary-outline" (click)="testCron(form.get('automaticUpdater')?.value)">Test</button>
|
<button type="button" class="btn btn-sm btn-primary-outline" (click)="testCron(form.get('automaticUpdater')?.value)">Test</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="retryRequests" class="control-label">Retry Failed Requests</label>
|
||||||
|
<input type="text" class="form-control form-control-custom" [ngClass]="{'form-error': form.get('retryRequests').hasError('required')}" id="retryRequests" name="retryRequests" formControlName="retryRequests">
|
||||||
|
<small *ngIf="form.get('retryRequests').hasError('required')" class="error-text">The Retry Requests is required</small>
|
||||||
|
<button type="button" class="btn btn-sm btn-primary-outline" (click)="testCron(form.get('retryRequests')?.value)">Test</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|
|
@ -36,6 +36,7 @@ export class JobsComponent implements OnInit {
|
||||||
plexRecentlyAddedSync: [x.plexRecentlyAddedSync, Validators.required],
|
plexRecentlyAddedSync: [x.plexRecentlyAddedSync, Validators.required],
|
||||||
lidarrArtistSync: [x.lidarrArtistSync, Validators.required],
|
lidarrArtistSync: [x.lidarrArtistSync, Validators.required],
|
||||||
issuesPurge: [x.issuesPurge, Validators.required],
|
issuesPurge: [x.issuesPurge, Validators.required],
|
||||||
|
retryRequests: [x.retryRequests, Validators.required],
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ import { AuthGuard } from "../auth/auth.guard";
|
||||||
import { AuthService } from "../auth/auth.service";
|
import { AuthService } from "../auth/auth.service";
|
||||||
import {
|
import {
|
||||||
CouchPotatoService, EmbyService, IssuesService, JobService, LidarrService, MobileService, NotificationMessageService, PlexService, RadarrService,
|
CouchPotatoService, EmbyService, IssuesService, JobService, LidarrService, MobileService, NotificationMessageService, PlexService, RadarrService,
|
||||||
SonarrService, TesterService, ValidationService,
|
RequestRetryService, SonarrService, TesterService, ValidationService,
|
||||||
} from "../services";
|
} from "../services";
|
||||||
|
|
||||||
import { PipeModule } from "../pipes/pipe.module";
|
import { PipeModule } from "../pipes/pipe.module";
|
||||||
|
@ -19,6 +19,7 @@ import { CouchPotatoComponent } from "./couchpotato/couchpotato.component";
|
||||||
import { CustomizationComponent } from "./customization/customization.component";
|
import { CustomizationComponent } from "./customization/customization.component";
|
||||||
import { DogNzbComponent } from "./dognzb/dognzb.component";
|
import { DogNzbComponent } from "./dognzb/dognzb.component";
|
||||||
import { EmbyComponent } from "./emby/emby.component";
|
import { EmbyComponent } from "./emby/emby.component";
|
||||||
|
import { FailedRequestsComponent } from "./failedrequests/failedrequests.component";
|
||||||
import { IssuesComponent } from "./issues/issues.component";
|
import { IssuesComponent } from "./issues/issues.component";
|
||||||
import { JobsComponent } from "./jobs/jobs.component";
|
import { JobsComponent } from "./jobs/jobs.component";
|
||||||
import { LandingPageComponent } from "./landingpage/landingpage.component";
|
import { LandingPageComponent } from "./landingpage/landingpage.component";
|
||||||
|
@ -77,6 +78,7 @@ const routes: Routes = [
|
||||||
{ path: "Newsletter", component: NewsletterComponent, canActivate: [AuthGuard] },
|
{ path: "Newsletter", component: NewsletterComponent, canActivate: [AuthGuard] },
|
||||||
{ path: "Lidarr", component: LidarrComponent, canActivate: [AuthGuard] },
|
{ path: "Lidarr", component: LidarrComponent, canActivate: [AuthGuard] },
|
||||||
{ path: "Vote", component: VoteComponent, canActivate: [AuthGuard] },
|
{ path: "Vote", component: VoteComponent, canActivate: [AuthGuard] },
|
||||||
|
{ path: "FailedRequests", component: FailedRequestsComponent, canActivate: [AuthGuard] },
|
||||||
];
|
];
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
|
@ -130,6 +132,7 @@ const routes: Routes = [
|
||||||
NewsletterComponent,
|
NewsletterComponent,
|
||||||
LidarrComponent,
|
LidarrComponent,
|
||||||
VoteComponent,
|
VoteComponent,
|
||||||
|
FailedRequestsComponent,
|
||||||
],
|
],
|
||||||
exports: [
|
exports: [
|
||||||
RouterModule,
|
RouterModule,
|
||||||
|
@ -149,6 +152,7 @@ const routes: Routes = [
|
||||||
MobileService,
|
MobileService,
|
||||||
NotificationMessageService,
|
NotificationMessageService,
|
||||||
LidarrService,
|
LidarrService,
|
||||||
|
RequestRetryService,
|
||||||
],
|
],
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
|
@ -84,6 +84,7 @@
|
||||||
</a>
|
</a>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
<li [routerLinkActive]="['active']"><a [routerLink]="['/Settings/About']">About</a></li>
|
<li [routerLinkActive]="['active']"><a [routerLink]="['/Settings/About']">About</a></li>
|
||||||
|
<li [routerLinkActive]="['active']"><a [routerLink]="['/Settings/FailedRequests']">Failed Requests</a></li>
|
||||||
<li [routerLinkActive]="['active']"><a [routerLink]="['/Settings/Update']">Update</a></li>
|
<li [routerLinkActive]="['active']"><a [routerLink]="['/Settings/Update']">Update</a></li>
|
||||||
<li [routerLinkActive]="['active']"><a [routerLink]="['/Settings/Jobs']">Jobs</a></li>
|
<li [routerLinkActive]="['active']"><a [routerLink]="['/Settings/Jobs']">Jobs</a></li>
|
||||||
<!-- <li [routerLinkActive]="['active']"><a [routerLink]="['/Settings/Logs']">Logs (Not available)</a></li>
|
<!-- <li [routerLinkActive]="['active']"><a [routerLink]="['/Settings/Logs']">Logs (Not available)</a></li>
|
||||||
|
|
|
@ -843,6 +843,7 @@ body {
|
||||||
padding: 10px 15px;
|
padding: 10px 15px;
|
||||||
border-bottom: 1px solid transparent;
|
border-bottom: 1px solid transparent;
|
||||||
background: $form-color;
|
background: $form-color;
|
||||||
|
height: 40px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.card-header > a {
|
.card-header > a {
|
||||||
|
|
92
src/Ombi/Controllers/RequestRetryController.cs
Normal file
92
src/Ombi/Controllers/RequestRetryController.cs
Normal file
|
@ -0,0 +1,92 @@
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Ombi.Store.Entities.Requests;
|
||||||
|
using Ombi.Store.Repository;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Ombi.Attributes;
|
||||||
|
using Ombi.Models;
|
||||||
|
using Ombi.Store.Entities;
|
||||||
|
using Ombi.Store.Repository.Requests;
|
||||||
|
|
||||||
|
namespace Ombi.Controllers
|
||||||
|
{
|
||||||
|
[ApiV1]
|
||||||
|
[Admin]
|
||||||
|
[Produces("application/json")]
|
||||||
|
public class RequestRetryController : Controller
|
||||||
|
{
|
||||||
|
public RequestRetryController(IRepository<RequestQueue> requestQueue, IMovieRequestRepository movieRepo,
|
||||||
|
ITvRequestRepository tvRepo, IMusicRequestRepository musicRepo)
|
||||||
|
{
|
||||||
|
_requestQueueRepository = requestQueue;
|
||||||
|
_movieRequestRepository = movieRepo;
|
||||||
|
_tvRequestRepository = tvRepo;
|
||||||
|
_musicRequestRepository = musicRepo;
|
||||||
|
}
|
||||||
|
|
||||||
|
private readonly IRepository<RequestQueue> _requestQueueRepository;
|
||||||
|
private readonly IMovieRequestRepository _movieRequestRepository;
|
||||||
|
private readonly ITvRequestRepository _tvRequestRepository;
|
||||||
|
private readonly IMusicRequestRepository _musicRequestRepository;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get's all the failed requests that are currently in the queue
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet]
|
||||||
|
public async Task<IEnumerable<FailedRequestViewModel>> GetFailedRequests()
|
||||||
|
{
|
||||||
|
var failed = await _requestQueueRepository.GetAll().Where(x => !x.Completed.HasValue).ToListAsync();
|
||||||
|
|
||||||
|
var vm = new List<FailedRequestViewModel>();
|
||||||
|
foreach (var f in failed)
|
||||||
|
{
|
||||||
|
var vmModel = new FailedRequestViewModel
|
||||||
|
{
|
||||||
|
RequestId = f.RequestId,
|
||||||
|
RetryCount = f.RetryCount,
|
||||||
|
Dts = f.Dts,
|
||||||
|
Error = f.Error,
|
||||||
|
FailedId = f.Id,
|
||||||
|
Type = f.Type
|
||||||
|
};
|
||||||
|
|
||||||
|
if (f.Type == RequestType.Movie)
|
||||||
|
{
|
||||||
|
var request = await _movieRequestRepository.Find(f.RequestId);
|
||||||
|
vmModel.Title = request.Title;
|
||||||
|
vmModel.ReleaseYear = request.ReleaseDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (f.Type == RequestType.Album)
|
||||||
|
{
|
||||||
|
var request = await _musicRequestRepository.Find(f.RequestId);
|
||||||
|
vmModel.Title = request.Title;
|
||||||
|
vmModel.ReleaseYear = request.ReleaseDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (f.Type == RequestType.TvShow)
|
||||||
|
{
|
||||||
|
var request = await _tvRequestRepository.GetChild().Include(x => x.ParentRequest).FirstOrDefaultAsync(x => x.Id == f.RequestId);
|
||||||
|
vmModel.Title = request.Title;
|
||||||
|
vmModel.ReleaseYear = request.ParentRequest.ReleaseDate;
|
||||||
|
}
|
||||||
|
vm.Add(vmModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
return vm;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpDelete("{queueId:int}")]
|
||||||
|
public async Task<IActionResult> Delete(int queueId)
|
||||||
|
{
|
||||||
|
var queueItem = await _requestQueueRepository.GetAll().FirstOrDefaultAsync(x => x.Id == queueId);
|
||||||
|
await _requestQueueRepository.Delete(queueItem);
|
||||||
|
return Json(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -520,6 +520,7 @@ namespace Ombi.Controllers
|
||||||
j.Newsletter = j.Newsletter.HasValue() ? j.Newsletter : JobSettingsHelper.Newsletter(j);
|
j.Newsletter = j.Newsletter.HasValue() ? j.Newsletter : JobSettingsHelper.Newsletter(j);
|
||||||
j.LidarrArtistSync = j.LidarrArtistSync.HasValue() ? j.LidarrArtistSync : JobSettingsHelper.LidarrArtistSync(j);
|
j.LidarrArtistSync = j.LidarrArtistSync.HasValue() ? j.LidarrArtistSync : JobSettingsHelper.LidarrArtistSync(j);
|
||||||
j.IssuesPurge = j.IssuesPurge.HasValue() ? j.IssuesPurge : JobSettingsHelper.IssuePurge(j);
|
j.IssuesPurge = j.IssuesPurge.HasValue() ? j.IssuesPurge : JobSettingsHelper.IssuePurge(j);
|
||||||
|
j.RetryRequests = j.RetryRequests.HasValue() ? j.RetryRequests : JobSettingsHelper.ResendFailedRequests(j);
|
||||||
|
|
||||||
return j;
|
return j;
|
||||||
}
|
}
|
||||||
|
|
17
src/Ombi/Models/FailedRequestViewModel.cs
Normal file
17
src/Ombi/Models/FailedRequestViewModel.cs
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
using System;
|
||||||
|
using Ombi.Store.Entities;
|
||||||
|
|
||||||
|
namespace Ombi.Models
|
||||||
|
{
|
||||||
|
public class FailedRequestViewModel
|
||||||
|
{
|
||||||
|
public int FailedId { get; set; }
|
||||||
|
public string Title { get; set; }
|
||||||
|
public DateTime ReleaseYear { get; set; }
|
||||||
|
public int RequestId { get; set; }
|
||||||
|
public RequestType Type { get; set; }
|
||||||
|
public DateTime Dts { get; set; }
|
||||||
|
public string Error { get; set; }
|
||||||
|
public int RetryCount { get; set; }
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue