diff --git a/src/Ombi.Schedule/Jobs/ArrAvailabilityChecker.cs b/src/Ombi.Schedule/Jobs/ArrAvailabilityChecker.cs index c113c64fd..756343c76 100644 --- a/src/Ombi.Schedule/Jobs/ArrAvailabilityChecker.cs +++ b/src/Ombi.Schedule/Jobs/ArrAvailabilityChecker.cs @@ -11,7 +11,6 @@ using Ombi.Core.Settings; using Ombi.Helpers; using Ombi.Hubs; using Ombi.Notifications.Models; -using Ombi.Schedule.Jobs.Plex.Models; using Ombi.Settings.Settings.Models.External; using Ombi.Store.Entities; using Ombi.Store.Repository; @@ -20,17 +19,13 @@ using Quartz; namespace Ombi.Schedule.Jobs.Radarr { - public class ArrAvailabilityChecker : IArrAvailabilityChecker + public class ArrAvailabilityChecker : AvailabilityChecker, IArrAvailabilityChecker { private readonly IExternalRepository _radarrRepo; private readonly IExternalRepository _sonarrRepo; - private readonly ILogger _logger; private readonly ISettingsService _radarrSettings; private readonly ISettingsService _sonarrSettings; private readonly IExternalRepository _sonarrEpisodeRepo; - private readonly INotificationHelper _notification; - private readonly IHubContext _hub; - private readonly ITvRequestRepository _tvRequest; private readonly IMovieRequestRepository _movies; public ArrAvailabilityChecker( @@ -42,15 +37,12 @@ namespace Ombi.Schedule.Jobs.Radarr ILogger log, ISettingsService radarrSettings, ISettingsService sonarrSettings) + : base(tvRequest, notification, log, hub) { _radarrRepo = radarrRepo; _sonarrRepo = sonarrRepo; _sonarrEpisodeRepo = sonarrEpisodeRepo; - _notification = notification; - _hub = hub; - _tvRequest = tvRequest; _movies = movies; - _logger = log; _radarrSettings = radarrSettings; _sonarrSettings = sonarrSettings; } @@ -82,7 +74,7 @@ namespace Ombi.Schedule.Jobs.Radarr var available = availableRadarrMovies.FirstOrDefault(x => x.TheMovieDbId == movieRequest.TheMovieDbId); if (available != null) { - _logger.LogInformation($"Found move '{movieRequest.Title}' available in Radarr"); + _log.LogInformation($"Found move '{movieRequest.Title}' available in Radarr"); if (available.Has4K && !movieRequest.Available4K) { itemsForAvailability.Add(new AvailabilityModel @@ -114,7 +106,7 @@ namespace Ombi.Schedule.Jobs.Radarr } foreach (var item in itemsForAvailability) { - await _notification.Notify(new NotificationOptions + await _notificationService.Notify(new NotificationOptions { DateTime = DateTime.Now, NotificationType = NotificationType.RequestAvailable, @@ -127,9 +119,9 @@ namespace Ombi.Schedule.Jobs.Radarr public async Task ProcessTvShows() { - var tv = await _tvRequest.GetChild().Where(x => !x.Available).ToListAsync(); + var tv = await _tvRepo.GetChild().Where(x => !x.Available).ToListAsync(); var sonarrEpisodes = _sonarrEpisodeRepo.GetAll().Where(x => x.HasFile); - + foreach (var child in tv) { var tvDbId = child.ParentRequest.TvDbId; @@ -140,85 +132,10 @@ namespace Ombi.Schedule.Jobs.Radarr continue; } - //if (!seriesEpisodes.Any()) - //{ - // // Let's try and match the series by name - // seriesEpisodes = sonarrEpisodes.Where(x => - // x.EpisodeNumber == child.Title && - // x.Series.ReleaseYear == child.ParentRequest.ReleaseDate.Year.ToString()); - - //} - - var availableEpisode = new List(); - foreach (var season in child.SeasonRequests) - { - foreach (var episode in season.Episodes) - { - if (episode.Available) - { - continue; - } - var foundEp = await seriesEpisodes.AnyAsync( - x => x.EpisodeNumber == episode.EpisodeNumber && - x.SeasonNumber == episode.Season.SeasonNumber); - - if (foundEp) - { - availableEpisode.Add(new AvailabilityModel - { - Id = episode.Id, - EpisodeNumber = episode.EpisodeNumber, - SeasonNumber = episode.Season.SeasonNumber - }); - episode.Available = true; - } - } - } - - if (availableEpisode.Any()) - { - await _tvRequest.Save(); - } - - // Check to see if all of the episodes in all seasons are available for this request - var allAvailable = child.SeasonRequests.All(x => x.Episodes.All(c => c.Available)); - if (allAvailable) - { - await _hub.Clients.Clients(NotificationHub.AdminConnectionIds) - .SendAsync(NotificationHub.NotificationEvent, "Sonarr Availability Checker found some new available Shows!"); - child.Available = true; - child.MarkedAsAvailable = DateTime.UtcNow; - _logger.LogInformation("[ARR_AC] - Child request {0} is now available, sending notification", $"{child.Title} - {child.Id}"); - // We have ful-fulled this request! - await _tvRequest.Save(); - await _notification.Notify(new NotificationOptions - { - DateTime = DateTime.Now, - NotificationType = NotificationType.RequestAvailable, - RequestId = child.Id, - RequestType = RequestType.TvShow, - Recipient = child.RequestedUser.Email - }); - } - else if (availableEpisode.Any()) - { - var notification = new NotificationOptions - { - DateTime = DateTime.Now, - NotificationType = NotificationType.PartiallyAvailable, - RequestId = child.Id, - RequestType = RequestType.TvShow, - Recipient = child.RequestedUser.Email, - }; - notification.Substitutes.Add("Season", availableEpisode.First().SeasonNumber.ToString()); - notification.Substitutes.Add("Episodes", string.Join(", ", availableEpisode.Select(x => x.EpisodeNumber))); - notification.Substitutes.Add("EpisodesCount", $"{availableEpisode.Count}"); - notification.Substitutes.Add("SeasonEpisodes", string.Join(", ", availableEpisode.Select(x => $"{x.SeasonNumber}x{x.EpisodeNumber}" ))); - await _notification.Notify(notification); - } + ProcessTvShow(seriesEpisodes, child); } - await _tvRequest.Save(); + await _tvRepo.Save(); } private bool _disposed; diff --git a/src/Ombi.Schedule/Jobs/AvailabilityChecker.cs b/src/Ombi.Schedule/Jobs/AvailabilityChecker.cs new file mode 100644 index 000000000..1183e3f60 --- /dev/null +++ b/src/Ombi.Schedule/Jobs/AvailabilityChecker.cs @@ -0,0 +1,106 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Microsoft.AspNetCore.SignalR; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Logging; +using Ombi.Core; +using Ombi.Helpers; +using Ombi.Hubs; +using Ombi.Notifications.Models; +using Ombi.Store.Entities; +using Ombi.Store.Entities.Requests; +using Ombi.Store.Repository.Requests; + +namespace Ombi.Schedule.Jobs +{ + public class AvailabilityChecker + { + protected readonly ITvRequestRepository _tvRepo; + protected readonly INotificationHelper _notificationService; + protected readonly ILogger _log; + protected readonly IHubContext _hub; + + public AvailabilityChecker(ITvRequestRepository tvRequest, INotificationHelper notification, + ILogger log, IHubContext hub) + { + _tvRepo = tvRequest; + _notificationService = notification; + _log = log; + _hub = hub; + } + + protected async void ProcessTvShow(IQueryable seriesEpisodes, ChildRequests child) + { + + var availableEpisode = new List(); + foreach (var season in child.SeasonRequests) + { + foreach (var episode in season.Episodes) + { + if (episode.Available) + { + continue; + } + var foundEp = await seriesEpisodes.AnyAsync( + x => x.EpisodeNumber == episode.EpisodeNumber && + x.SeasonNumber == episode.Season.SeasonNumber); + + if (foundEp) + { + availableEpisode.Add(new AvailabilityModel + { + Id = episode.Id, + EpisodeNumber = episode.EpisodeNumber, + SeasonNumber = episode.Season.SeasonNumber + }); + episode.Available = true; + } + } + } + + if (availableEpisode.Any()) + { + await _tvRepo.Save(); + } + + // Check to see if all of the episodes in all seasons are available for this request + var allAvailable = child.SeasonRequests.All(x => x.Episodes.All(c => c.Available)); + if (allAvailable) + { + // We have ful-fulled this request! + child.Available = true; + child.MarkedAsAvailable = DateTime.UtcNow; + await _hub.Clients.Clients(NotificationHub.AdminConnectionIds) + .SendAsync(NotificationHub.NotificationEvent, "Availability Checker found some new available Shows!"); + _log.LogInformation("Child request {0} is now available, sending notification", $"{child.Title} - {child.Id}"); + + await _tvRepo.Save(); + await _notificationService.Notify(new NotificationOptions + { + DateTime = DateTime.Now, + NotificationType = NotificationType.RequestAvailable, + RequestId = child.Id, + RequestType = RequestType.TvShow, + Recipient = child.RequestedUser.Email + }); + } + else if (availableEpisode.Any()) + { + var notification = new NotificationOptions + { + DateTime = DateTime.Now, + NotificationType = NotificationType.PartiallyAvailable, + RequestId = child.Id, + RequestType = RequestType.TvShow, + Recipient = child.RequestedUser.Email, + }; + notification.Substitutes.Add("Season", availableEpisode.First().SeasonNumber.ToString()); + notification.Substitutes.Add("Episodes", string.Join(", ", availableEpisode.Select(x => x.EpisodeNumber))); + notification.Substitutes.Add("EpisodesCount", $"{availableEpisode.Count}"); + notification.Substitutes.Add("SeasonEpisodes", string.Join(", ", availableEpisode.Select(x => $"{x.SeasonNumber}x{x.EpisodeNumber}"))); + await _notificationService.Notify(notification); + } + } + } +} diff --git a/src/Ombi.Schedule/Jobs/Emby/EmbyAvaliabilityChecker.cs b/src/Ombi.Schedule/Jobs/Emby/EmbyAvaliabilityChecker.cs index 1ac49ee3d..7e969e566 100644 --- a/src/Ombi.Schedule/Jobs/Emby/EmbyAvaliabilityChecker.cs +++ b/src/Ombi.Schedule/Jobs/Emby/EmbyAvaliabilityChecker.cs @@ -1,17 +1,14 @@ using System; -using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.SignalR; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; using Ombi.Core; -using Ombi.Core.Notifications; using Ombi.Core.Services; using Ombi.Helpers; using Ombi.Hubs; using Ombi.Notifications.Models; -using Ombi.Schedule.Jobs.Ombi; using Ombi.Settings.Settings.Models; using Ombi.Store.Entities; using Ombi.Store.Repository; @@ -20,38 +17,31 @@ using Quartz; namespace Ombi.Schedule.Jobs.Emby { - public class EmbyAvaliabilityChecker : IEmbyAvaliabilityChecker + public class EmbyAvaliabilityChecker : AvailabilityChecker, IEmbyAvaliabilityChecker { public EmbyAvaliabilityChecker(IEmbyContentRepository repo, ITvRequestRepository t, IMovieRequestRepository m, INotificationHelper n, ILogger log, IHubContext notification, IFeatureService featureService) + : base(t, n, log, notification) { _repo = repo; - _tvRepo = t; _movieRepo = m; - _notificationService = n; - _log = log; - _notification = notification; _featureService = featureService; } - private readonly ITvRequestRepository _tvRepo; private readonly IMovieRequestRepository _movieRepo; private readonly IEmbyContentRepository _repo; - private readonly INotificationHelper _notificationService; - private readonly ILogger _log; - private readonly IHubContext _notification; private readonly IFeatureService _featureService; public async Task Execute(IJobExecutionContext job) { _log.LogInformation("Starting Emby Availability Check"); - await _notification.Clients.Clients(NotificationHub.AdminConnectionIds) + await _hub.Clients.Clients(NotificationHub.AdminConnectionIds) .SendAsync(NotificationHub.NotificationEvent, "Emby Availability Checker Started"); await ProcessMovies(); await ProcessTv(); _log.LogInformation("Finished Emby Availability Check"); - await _notification.Clients.Clients(NotificationHub.AdminConnectionIds) + await _hub.Clients.Clients(NotificationHub.AdminConnectionIds) .SendAsync(NotificationHub.NotificationEvent, "Emby Availability Checker Finished"); } @@ -167,70 +157,7 @@ namespace Ombi.Schedule.Jobs.Emby x.Series.Title == child.Title); } - var availableEpisode = new List(); - foreach (var season in child.SeasonRequests) - { - foreach (var episode in season.Episodes) - { - if (episode.Available) - { - continue; - } - - var foundEp = await seriesEpisodes.FirstOrDefaultAsync( - x => x.EpisodeNumber == episode.EpisodeNumber && - x.SeasonNumber == episode.Season.SeasonNumber); - - if (foundEp != null) - { - availableEpisode.Add(new AvailabilityModel - { - Id = episode.Id, - EpisodeNumber = episode.EpisodeNumber, - SeasonNumber = episode.Season.SeasonNumber - }); - episode.Available = true; - } - } - } - - if (availableEpisode.Any()) - { - await _tvRepo.Save(); - } - - // Check to see if all of the episodes in all seasons are available for this request - var allAvailable = child.SeasonRequests.All(x => x.Episodes.All(c => c.Available)); - if (allAvailable) - { - // We have fulfulled this request! - child.Available = true; - child.MarkedAsAvailable = DateTime.Now; - await _notificationService.Notify(new NotificationOptions - { - DateTime = DateTime.Now, - NotificationType = NotificationType.RequestAvailable, - RequestId = child.Id, - RequestType = RequestType.TvShow, - Recipient = child.RequestedUser.Email - }); - } - else if (availableEpisode.Any()) - { - var notification = new NotificationOptions - { - DateTime = DateTime.Now, - NotificationType = NotificationType.PartiallyAvailable, - RequestId = child.Id, - RequestType = RequestType.TvShow, - Recipient = child.RequestedUser.Email, - }; - notification.Substitutes.Add("Season", availableEpisode.First().SeasonNumber.ToString()); - notification.Substitutes.Add("Episodes", string.Join(", ", availableEpisode.Select(x => x.EpisodeNumber))); - notification.Substitutes.Add("EpisodesCount", $"{availableEpisode.Count}"); - notification.Substitutes.Add("SeasonEpisodes", string.Join(", ", availableEpisode.Select(x => $"{x.SeasonNumber}x{x.EpisodeNumber}" ))); - await _notificationService.Notify(notification); - } + ProcessTvShow(seriesEpisodes, child); } await _tvRepo.Save(); diff --git a/src/Ombi.Schedule/Jobs/Jellyfin/JellyfinAvaliabilityChecker.cs b/src/Ombi.Schedule/Jobs/Jellyfin/JellyfinAvaliabilityChecker.cs index 574de4c36..bc790a2c2 100644 --- a/src/Ombi.Schedule/Jobs/Jellyfin/JellyfinAvaliabilityChecker.cs +++ b/src/Ombi.Schedule/Jobs/Jellyfin/JellyfinAvaliabilityChecker.cs @@ -26,7 +26,6 @@ #endregion using System; -using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.SignalR; @@ -45,38 +44,31 @@ using Quartz; namespace Ombi.Schedule.Jobs.Jellyfin { - public class JellyfinAvaliabilityChecker : IJellyfinAvaliabilityChecker + public class JellyfinAvaliabilityChecker : AvailabilityChecker, IJellyfinAvaliabilityChecker { public JellyfinAvaliabilityChecker(IJellyfinContentRepository repo, ITvRequestRepository t, IMovieRequestRepository m, INotificationHelper n, ILogger log, IHubContext notification, IFeatureService featureService) + : base(t, n, log, notification) { _repo = repo; - _tvRepo = t; _movieRepo = m; - _notificationService = n; - _log = log; - _notification = notification; _featureService = featureService; } - private readonly ITvRequestRepository _tvRepo; private readonly IMovieRequestRepository _movieRepo; private readonly IJellyfinContentRepository _repo; - private readonly INotificationHelper _notificationService; - private readonly ILogger _log; - private readonly IHubContext _notification; private readonly IFeatureService _featureService; public async Task Execute(IJobExecutionContext job) { _log.LogInformation("Starting Jellyfin Availability Check"); - await _notification.Clients.Clients(NotificationHub.AdminConnectionIds) + await _hub.Clients.Clients(NotificationHub.AdminConnectionIds) .SendAsync(NotificationHub.NotificationEvent, "Jellyfin Availability Checker Started"); await ProcessMovies(); await ProcessTv(); _log.LogInformation("Finished Jellyfin Availability Check"); - await _notification.Clients.Clients(NotificationHub.AdminConnectionIds) + await _hub.Clients.Clients(NotificationHub.AdminConnectionIds) .SendAsync(NotificationHub.NotificationEvent, "Jellyfin Availability Checker Finished"); } @@ -193,70 +185,7 @@ namespace Ombi.Schedule.Jobs.Jellyfin x.Series.Title == child.Title); } - var availableEpisode = new List(); - foreach (var season in child.SeasonRequests) - { - foreach (var episode in season.Episodes) - { - if (episode.Available) - { - continue; - } - - var foundEp = await seriesEpisodes.FirstOrDefaultAsync( - x => x.EpisodeNumber == episode.EpisodeNumber && - x.SeasonNumber == episode.Season.SeasonNumber); - - if (foundEp != null) - { - availableEpisode.Add(new AvailabilityModel - { - Id = episode.Id, - EpisodeNumber = episode.EpisodeNumber, - SeasonNumber = episode.Season.SeasonNumber - }); - episode.Available = true; - } - } - } - - if (availableEpisode.Any()) - { - await _tvRepo.Save(); - } - - // Check to see if all of the episodes in all seasons are available for this request - var allAvailable = child.SeasonRequests.All(x => x.Episodes.All(c => c.Available)); - if (allAvailable) - { - // We have fulfulled this request! - child.Available = true; - child.MarkedAsAvailable = DateTime.Now; - await _notificationService.Notify(new NotificationOptions - { - DateTime = DateTime.Now, - NotificationType = NotificationType.RequestAvailable, - RequestId = child.Id, - RequestType = RequestType.TvShow, - Recipient = child.RequestedUser.Email - }); - } - else if (availableEpisode.Any()) - { - var notification = new NotificationOptions - { - DateTime = DateTime.Now, - NotificationType = NotificationType.PartiallyAvailable, - RequestId = child.Id, - RequestType = RequestType.TvShow, - Recipient = child.RequestedUser.Email, - }; - notification.Substitutes.Add("Season", availableEpisode.First().SeasonNumber.ToString()); - notification.Substitutes.Add("Episodes", string.Join(", ", availableEpisode.Select(x => x.EpisodeNumber))); - notification.Substitutes.Add("EpisodesCount", $"{availableEpisode.Count}"); - notification.Substitutes.Add("SeasonEpisodes", string.Join(", ", availableEpisode.Select(x => $"{x.SeasonNumber}x{x.EpisodeNumber}" ))); - await _notificationService.Notify(notification); - } + ProcessTvShow(seriesEpisodes, child); } await _tvRepo.Save(); diff --git a/src/Ombi.Schedule/Jobs/Plex/PlexAvailabilityChecker.cs b/src/Ombi.Schedule/Jobs/Plex/PlexAvailabilityChecker.cs index 6b878f551..6e467b0a0 100644 --- a/src/Ombi.Schedule/Jobs/Plex/PlexAvailabilityChecker.cs +++ b/src/Ombi.Schedule/Jobs/Plex/PlexAvailabilityChecker.cs @@ -10,7 +10,6 @@ using Ombi.Core.Services; using Ombi.Helpers; using Ombi.Hubs; using Ombi.Notifications.Models; -using Ombi.Schedule.Jobs.Plex.Models; using Ombi.Settings.Settings.Models; using Ombi.Store.Entities; using Ombi.Store.Entities.Requests; @@ -20,26 +19,19 @@ using Quartz; namespace Ombi.Schedule.Jobs.Plex { - public class PlexAvailabilityChecker : IPlexAvailabilityChecker + public class PlexAvailabilityChecker : AvailabilityChecker, IPlexAvailabilityChecker { public PlexAvailabilityChecker(IPlexContentRepository repo, ITvRequestRepository tvRequest, IMovieRequestRepository movies, INotificationHelper notification, ILogger log, IHubContext hub, IFeatureService featureService) + : base(tvRequest, notification, log, hub) { - _tvRepo = tvRequest; _repo = repo; _movieRepo = movies; - _notificationService = notification; - _log = log; - _notification = hub; _featureService = featureService; } - private readonly ITvRequestRepository _tvRepo; private readonly IMovieRequestRepository _movieRepo; private readonly IPlexContentRepository _repo; - private readonly INotificationHelper _notificationService; - private readonly ILogger _log; - private readonly IHubContext _notification; private readonly IFeatureService _featureService; public async Task Execute(IJobExecutionContext job) @@ -47,20 +39,20 @@ namespace Ombi.Schedule.Jobs.Plex try { - await _notification.Clients.Clients(NotificationHub.AdminConnectionIds) + await _hub.Clients.Clients(NotificationHub.AdminConnectionIds) .SendAsync(NotificationHub.NotificationEvent, "Plex Availability Check Started"); await ProcessMovies(); await ProcessTv(); } catch (Exception e) { - await _notification.Clients.Clients(NotificationHub.AdminConnectionIds) + await _hub.Clients.Clients(NotificationHub.AdminConnectionIds) .SendAsync(NotificationHub.NotificationEvent, "Plex Availability Check Failed"); _log.LogError(e, "Exception thrown in Plex availbility checker"); return; } - await _notification.Clients.Clients(NotificationHub.AdminConnectionIds) + await _hub.Clients.Clients(NotificationHub.AdminConnectionIds) .SendAsync(NotificationHub.NotificationEvent, "Plex Availability Check Finished"); } @@ -113,71 +105,7 @@ namespace Ombi.Schedule.Jobs.Plex } - var availableEpisode = new List(); - foreach (var season in child.SeasonRequests) - { - foreach (var episode in season.Episodes) - { - if (episode.Available) - { - continue; - } - var foundEp = await seriesEpisodes.AnyAsync( - x => x.EpisodeNumber == episode.EpisodeNumber && - x.SeasonNumber == episode.Season.SeasonNumber); - - if (foundEp) - { - availableEpisode.Add(new AvailabilityModel - { - Id = episode.Id, - EpisodeNumber = episode.EpisodeNumber, - SeasonNumber = episode.Season.SeasonNumber - }); - episode.Available = true; - } - } - } - - if (availableEpisode.Any()) - { - await _tvRepo.Save(); - } - - // Check to see if all of the episodes in all seasons are available for this request - var allAvailable = child.SeasonRequests.All(x => x.Episodes.All(c => c.Available)); - if (allAvailable) - { - child.Available = true; - child.MarkedAsAvailable = DateTime.UtcNow; - _log.LogInformation("[PAC] - Child request {0} is now available, sending notification", $"{child.Title} - {child.Id}"); - // We have ful-fulled this request! - await _tvRepo.Save(); - await _notificationService.Notify(new NotificationOptions - { - DateTime = DateTime.Now, - NotificationType = NotificationType.RequestAvailable, - RequestId = child.Id, - RequestType = RequestType.TvShow, - Recipient = child.RequestedUser.Email - }); - } - else if (availableEpisode.Any()) - { - var notification = new NotificationOptions - { - DateTime = DateTime.Now, - NotificationType = NotificationType.PartiallyAvailable, - RequestId = child.Id, - RequestType = RequestType.TvShow, - Recipient = child.RequestedUser.Email, - }; - notification.Substitutes.Add("Season", availableEpisode.First().SeasonNumber.ToString()); - notification.Substitutes.Add("Episodes", string.Join(", " ,availableEpisode.Select(x => x.EpisodeNumber))); - notification.Substitutes.Add("EpisodesCount", $"{availableEpisode.Count}"); - notification.Substitutes.Add("SeasonEpisodes", string.Join(", ", availableEpisode.Select(x => $"{x.SeasonNumber}x{x.EpisodeNumber}" ))); - await _notificationService.Notify(notification); - } + ProcessTvShow(seriesEpisodes, child); } await _tvRepo.Save(); diff --git a/src/Ombi.Store/Entities/IMediaServerContent.cs b/src/Ombi.Store/Entities/IMediaServerContent.cs index 25e4d5f50..fa6772fbd 100644 --- a/src/Ombi.Store/Entities/IMediaServerContent.cs +++ b/src/Ombi.Store/Entities/IMediaServerContent.cs @@ -29,10 +29,8 @@ namespace Ombi.Store.Entities public bool HasTheMovieDb => !string.IsNullOrEmpty(TheMovieDbId); } - public interface IMediaServerEpisode + public interface IMediaServerEpisode: IBaseMediaServerEpisode { - public int EpisodeNumber { get; set; } - public int SeasonNumber { get; set; } public string Title { get; set; } /// /// The Season key @@ -46,6 +44,12 @@ namespace Ombi.Store.Entities public IMediaServerContent SeriesIsIn(ICollection content); public bool IsIn(IMediaServerContent content); } + + public interface IBaseMediaServerEpisode + { + public int EpisodeNumber { get; set; } + public int SeasonNumber { get; set; } + } public enum MediaType { diff --git a/src/Ombi.Store/Entities/SonarrEpisodeCache.cs b/src/Ombi.Store/Entities/SonarrEpisodeCache.cs index 9f9d791f0..529e8b021 100644 --- a/src/Ombi.Store/Entities/SonarrEpisodeCache.cs +++ b/src/Ombi.Store/Entities/SonarrEpisodeCache.cs @@ -3,7 +3,7 @@ namespace Ombi.Store.Entities { [Table("SonarrEpisodeCache")] - public class SonarrEpisodeCache : Entity + public class SonarrEpisodeCache : Entity, IBaseMediaServerEpisode { public int SeasonNumber { get; set; } public int EpisodeNumber { get; set; }