diff --git a/Old/Ombi.UI/Content/favicon.ico b/Old/Ombi.UI/Content/favicon.ico index a98e878e4..f5155a9f3 100644 Binary files a/Old/Ombi.UI/Content/favicon.ico and b/Old/Ombi.UI/Content/favicon.ico differ diff --git a/Old/Ombi.UI/Content/favicon/android-icon-144x144.png b/Old/Ombi.UI/Content/favicon/android-icon-144x144.png index 5c32f5c66..eb85d051a 100644 Binary files a/Old/Ombi.UI/Content/favicon/android-icon-144x144.png and b/Old/Ombi.UI/Content/favicon/android-icon-144x144.png differ diff --git a/Old/Ombi.UI/Content/favicon/android-icon-192x192.png b/Old/Ombi.UI/Content/favicon/android-icon-192x192.png index 89a5b5a41..940f8e3b1 100644 Binary files a/Old/Ombi.UI/Content/favicon/android-icon-192x192.png and b/Old/Ombi.UI/Content/favicon/android-icon-192x192.png differ diff --git a/Old/Ombi.UI/Content/favicon/android-icon-36x36.png b/Old/Ombi.UI/Content/favicon/android-icon-36x36.png index 3d4ee0379..c204add51 100644 Binary files a/Old/Ombi.UI/Content/favicon/android-icon-36x36.png and b/Old/Ombi.UI/Content/favicon/android-icon-36x36.png differ diff --git a/Old/Ombi.UI/Content/favicon/android-icon-48x48.png b/Old/Ombi.UI/Content/favicon/android-icon-48x48.png index 3f22d26b4..fcddefa19 100644 Binary files a/Old/Ombi.UI/Content/favicon/android-icon-48x48.png and b/Old/Ombi.UI/Content/favicon/android-icon-48x48.png differ diff --git a/Old/Ombi.UI/Content/favicon/android-icon-72x72.png b/Old/Ombi.UI/Content/favicon/android-icon-72x72.png index fd76364cb..0443b415d 100644 Binary files a/Old/Ombi.UI/Content/favicon/android-icon-72x72.png and b/Old/Ombi.UI/Content/favicon/android-icon-72x72.png differ diff --git a/Old/Ombi.UI/Content/favicon/android-icon-96x96.png b/Old/Ombi.UI/Content/favicon/android-icon-96x96.png index a362acfd8..ebf17d47d 100644 Binary files a/Old/Ombi.UI/Content/favicon/android-icon-96x96.png and b/Old/Ombi.UI/Content/favicon/android-icon-96x96.png differ diff --git a/Old/Ombi.UI/Content/favicon/apple-icon-114x114.png b/Old/Ombi.UI/Content/favicon/apple-icon-114x114.png index eb6b1fab2..3a119ba27 100644 Binary files a/Old/Ombi.UI/Content/favicon/apple-icon-114x114.png and b/Old/Ombi.UI/Content/favicon/apple-icon-114x114.png differ diff --git a/Old/Ombi.UI/Content/favicon/apple-icon-120x120.png b/Old/Ombi.UI/Content/favicon/apple-icon-120x120.png index af175eedb..2a8a25cac 100644 Binary files a/Old/Ombi.UI/Content/favicon/apple-icon-120x120.png and b/Old/Ombi.UI/Content/favicon/apple-icon-120x120.png differ diff --git a/Old/Ombi.UI/Content/favicon/apple-icon-144x144.png b/Old/Ombi.UI/Content/favicon/apple-icon-144x144.png index 5c32f5c66..eb85d051a 100644 Binary files a/Old/Ombi.UI/Content/favicon/apple-icon-144x144.png and b/Old/Ombi.UI/Content/favicon/apple-icon-144x144.png differ diff --git a/Old/Ombi.UI/Content/favicon/apple-icon-152x152.png b/Old/Ombi.UI/Content/favicon/apple-icon-152x152.png index ff8f6284d..3daed78d7 100644 Binary files a/Old/Ombi.UI/Content/favicon/apple-icon-152x152.png and b/Old/Ombi.UI/Content/favicon/apple-icon-152x152.png differ diff --git a/Old/Ombi.UI/Content/favicon/apple-icon-180x180.png b/Old/Ombi.UI/Content/favicon/apple-icon-180x180.png index 473575679..cc256e079 100644 Binary files a/Old/Ombi.UI/Content/favicon/apple-icon-180x180.png and b/Old/Ombi.UI/Content/favicon/apple-icon-180x180.png differ diff --git a/Old/Ombi.UI/Content/favicon/apple-icon-57x57.png b/Old/Ombi.UI/Content/favicon/apple-icon-57x57.png index d62ebe2f7..26f8a5a70 100644 Binary files a/Old/Ombi.UI/Content/favicon/apple-icon-57x57.png and b/Old/Ombi.UI/Content/favicon/apple-icon-57x57.png differ diff --git a/Old/Ombi.UI/Content/favicon/apple-icon-60x60.png b/Old/Ombi.UI/Content/favicon/apple-icon-60x60.png index 2eaed9413..509a763fc 100644 Binary files a/Old/Ombi.UI/Content/favicon/apple-icon-60x60.png and b/Old/Ombi.UI/Content/favicon/apple-icon-60x60.png differ diff --git a/Old/Ombi.UI/Content/favicon/apple-icon-72x72.png b/Old/Ombi.UI/Content/favicon/apple-icon-72x72.png index fd76364cb..0443b415d 100644 Binary files a/Old/Ombi.UI/Content/favicon/apple-icon-72x72.png and b/Old/Ombi.UI/Content/favicon/apple-icon-72x72.png differ diff --git a/Old/Ombi.UI/Content/favicon/apple-icon-76x76.png b/Old/Ombi.UI/Content/favicon/apple-icon-76x76.png index b16ee1aeb..d71df1d0c 100644 Binary files a/Old/Ombi.UI/Content/favicon/apple-icon-76x76.png and b/Old/Ombi.UI/Content/favicon/apple-icon-76x76.png differ diff --git a/Old/Ombi.UI/Content/favicon/apple-icon-precomposed.png b/Old/Ombi.UI/Content/favicon/apple-icon-precomposed.png index 40142b749..940f8e3b1 100644 Binary files a/Old/Ombi.UI/Content/favicon/apple-icon-precomposed.png and b/Old/Ombi.UI/Content/favicon/apple-icon-precomposed.png differ diff --git a/Old/Ombi.UI/Content/favicon/apple-icon.png b/Old/Ombi.UI/Content/favicon/apple-icon.png index 40142b749..940f8e3b1 100644 Binary files a/Old/Ombi.UI/Content/favicon/apple-icon.png and b/Old/Ombi.UI/Content/favicon/apple-icon.png differ diff --git a/Old/Ombi.UI/Content/favicon/favicon-16x16.png b/Old/Ombi.UI/Content/favicon/favicon-16x16.png index bd6ac2d9d..1f0a8fb72 100644 Binary files a/Old/Ombi.UI/Content/favicon/favicon-16x16.png and b/Old/Ombi.UI/Content/favicon/favicon-16x16.png differ diff --git a/Old/Ombi.UI/Content/favicon/favicon-32x32.png b/Old/Ombi.UI/Content/favicon/favicon-32x32.png index 4758d38b7..64ccccc93 100644 Binary files a/Old/Ombi.UI/Content/favicon/favicon-32x32.png and b/Old/Ombi.UI/Content/favicon/favicon-32x32.png differ diff --git a/Old/Ombi.UI/Content/favicon/favicon-96x96.png b/Old/Ombi.UI/Content/favicon/favicon-96x96.png index a362acfd8..ebf17d47d 100644 Binary files a/Old/Ombi.UI/Content/favicon/favicon-96x96.png and b/Old/Ombi.UI/Content/favicon/favicon-96x96.png differ diff --git a/Old/Ombi.UI/Content/favicon/ms-icon-144x144.png b/Old/Ombi.UI/Content/favicon/ms-icon-144x144.png index 5c32f5c66..eb85d051a 100644 Binary files a/Old/Ombi.UI/Content/favicon/ms-icon-144x144.png and b/Old/Ombi.UI/Content/favicon/ms-icon-144x144.png differ diff --git a/Old/Ombi.UI/Content/favicon/ms-icon-150x150.png b/Old/Ombi.UI/Content/favicon/ms-icon-150x150.png index 33ba50221..d9c7b3f01 100644 Binary files a/Old/Ombi.UI/Content/favicon/ms-icon-150x150.png and b/Old/Ombi.UI/Content/favicon/ms-icon-150x150.png differ diff --git a/Old/Ombi.UI/Content/favicon/ms-icon-310x310.png b/Old/Ombi.UI/Content/favicon/ms-icon-310x310.png index a2044bbb1..578010f98 100644 Binary files a/Old/Ombi.UI/Content/favicon/ms-icon-310x310.png and b/Old/Ombi.UI/Content/favicon/ms-icon-310x310.png differ diff --git a/Old/Ombi.UI/Content/favicon/ms-icon-70x70.png b/Old/Ombi.UI/Content/favicon/ms-icon-70x70.png index f3566d7c7..6129e84bc 100644 Binary files a/Old/Ombi.UI/Content/favicon/ms-icon-70x70.png and b/Old/Ombi.UI/Content/favicon/ms-icon-70x70.png differ diff --git a/Old/Ombi.UI/Content/images/emby-logo-dark.jpg b/Old/Ombi.UI/Content/images/emby-logo-dark.jpg deleted file mode 100644 index 838667b78..000000000 Binary files a/Old/Ombi.UI/Content/images/emby-logo-dark.jpg and /dev/null differ diff --git a/Old/Ombi.UI/Content/images/emby-logo-dark.png b/Old/Ombi.UI/Content/images/emby-logo-dark.png new file mode 100644 index 000000000..e09c28cc0 Binary files /dev/null and b/Old/Ombi.UI/Content/images/emby-logo-dark.png differ diff --git a/Old/Ombi.UI/Content/images/emby-logo.png b/Old/Ombi.UI/Content/images/emby-logo.png index a6c51ff23..225a25f9f 100644 Binary files a/Old/Ombi.UI/Content/images/emby-logo.png and b/Old/Ombi.UI/Content/images/emby-logo.png differ diff --git a/Old/Ombi.UI/Content/images/logo original.png b/Old/Ombi.UI/Content/images/logo original.png index c3071e331..e010f5f9a 100644 Binary files a/Old/Ombi.UI/Content/images/logo original.png and b/Old/Ombi.UI/Content/images/logo original.png differ diff --git a/Old/Ombi.UI/Content/images/logo.png b/Old/Ombi.UI/Content/images/logo.png index 560a817e6..d52f82417 100644 Binary files a/Old/Ombi.UI/Content/images/logo.png and b/Old/Ombi.UI/Content/images/logo.png differ diff --git a/Old/Ombi.UI/Content/images/plex-logo-reversed.png b/Old/Ombi.UI/Content/images/plex-logo-reversed.png index 1e754b342..e896b31ed 100644 Binary files a/Old/Ombi.UI/Content/images/plex-logo-reversed.png and b/Old/Ombi.UI/Content/images/plex-logo-reversed.png differ diff --git a/Old/Ombi.UI/Content/images/plex-logo.png b/Old/Ombi.UI/Content/images/plex-logo.png index 33355e291..55b85c33f 100644 Binary files a/Old/Ombi.UI/Content/images/plex-logo.png and b/Old/Ombi.UI/Content/images/plex-logo.png differ diff --git a/Old/Ombi.UI/Ombi.UI.csproj b/Old/Ombi.UI/Ombi.UI.csproj index 1118a196f..d07262f25 100644 --- a/Old/Ombi.UI/Ombi.UI.csproj +++ b/Old/Ombi.UI/Ombi.UI.csproj @@ -471,7 +471,7 @@ PreserveNewest - + PreserveNewest diff --git a/Old/Ombi.UI/Views/UserWizard/Index.cshtml b/Old/Ombi.UI/Views/UserWizard/Index.cshtml index 734a9e4a5..f45510709 100644 --- a/Old/Ombi.UI/Views/UserWizard/Index.cshtml +++ b/Old/Ombi.UI/Views/UserWizard/Index.cshtml @@ -36,7 +36,7 @@
diff --git a/src/Ombi.Core/Engine/Interfaces/IMovieRequestEngine.cs b/src/Ombi.Core/Engine/Interfaces/IMovieRequestEngine.cs index 46d59be80..6559b13ef 100644 --- a/src/Ombi.Core/Engine/Interfaces/IMovieRequestEngine.cs +++ b/src/Ombi.Core/Engine/Interfaces/IMovieRequestEngine.cs @@ -15,5 +15,6 @@ namespace Ombi.Core.Engine.Interfaces Task RemoveMovieRequest(int requestId); Task UpdateMovieRequest(MovieRequests request); + Task ApproveMovie(MovieRequests request); } } \ No newline at end of file diff --git a/src/Ombi.Core/Engine/Interfaces/ITvRequestEngine.cs b/src/Ombi.Core/Engine/Interfaces/ITvRequestEngine.cs index 5066b7ad5..760a784de 100644 --- a/src/Ombi.Core/Engine/Interfaces/ITvRequestEngine.cs +++ b/src/Ombi.Core/Engine/Interfaces/ITvRequestEngine.cs @@ -13,10 +13,13 @@ namespace Ombi.Core.Engine.Interfaces Task RequestTvShow(SearchTvShowViewModel tv); Task> SearchTvRequest(string search); + Task>>> SearchTvRequestTree(string search); Task UpdateTvRequest(TvRequests request); + Task>>> GetRequestsTreeNode(int count, int position); Task> GetAllChldren(int tvId); Task UpdateChildRequest(ChildRequests request); Task RemoveTvChild(int requestId); + Task ApproveChildRequest(ChildRequests request); } } \ No newline at end of file diff --git a/src/Ombi.Core/Engine/MovieRequestEngine.cs b/src/Ombi.Core/Engine/MovieRequestEngine.cs index 80306fc0b..fe31bdf19 100644 --- a/src/Ombi.Core/Engine/MovieRequestEngine.cs +++ b/src/Ombi.Core/Engine/MovieRequestEngine.cs @@ -141,6 +141,42 @@ namespace Ombi.Core.Engine return results; } + /// + /// This is the method that is triggered by pressing Approve on the requests page + /// + /// + /// + public async Task ApproveMovie(MovieRequests request) + { + if (request.Approved) + { + var result = await Sender.Send(request); + if (result.Success && result.MovieSent) + { + return new RequestEngineResult + { + RequestAdded = true + }; + } + if (!result.Success) + { + Logger.LogWarning("Tried auto sending movie but failed. Message: {0}", result.Message); + return new RequestEngineResult + { + Message = result.Message, + ErrorMessage = result.Message, + RequestAdded = false + }; + } + // If there are no providers then it's successful but movie has not been sent + } + + return new RequestEngineResult + { + RequestAdded = true + }; + } + /// /// Updates the movie request. /// diff --git a/src/Ombi.Core/Engine/TreeNode.cs b/src/Ombi.Core/Engine/TreeNode.cs index 1744b8ffd..14f2f4cb0 100644 --- a/src/Ombi.Core/Engine/TreeNode.cs +++ b/src/Ombi.Core/Engine/TreeNode.cs @@ -11,4 +11,13 @@ namespace Ombi.Core.Engine public bool Leaf { get; set; } public bool Expanded { get; set; } } + + public class TreeNode + { + public string Label { get; set; } + public T Data { get; set; } + public List> Children { get; set; } + public bool Leaf { get; set; } + public bool Expanded { get; set; } + } } \ No newline at end of file diff --git a/src/Ombi.Core/Engine/TvRequestEngine.cs b/src/Ombi.Core/Engine/TvRequestEngine.cs index 51be4d7ab..df3ff79e2 100644 --- a/src/Ombi.Core/Engine/TvRequestEngine.cs +++ b/src/Ombi.Core/Engine/TvRequestEngine.cs @@ -37,7 +37,7 @@ namespace Ombi.Core.Engine private INotificationHelper NotificationHelper { get; } private ITvMazeApi TvApi { get; } private IMapper Mapper { get; } - private ITvSender TvSender {get;} + private ITvSender TvSender { get; } private IAuditRepository Audit { get; } public async Task RequestTvShow(SearchTvShowViewModel tv) @@ -51,7 +51,7 @@ namespace Ombi.Core.Engine .CreateChild(tv, user.Id); await tvBuilder.BuildEpisodes(tv); - + var ruleResults = await RunRequestRules(tvBuilder.ChildRequest); var results = ruleResults as RuleResult[] ?? ruleResults.ToArray(); if (results.Any(x => !x.Success)) @@ -122,6 +122,12 @@ namespace Ombi.Core.Engine return allRequests; } + public async Task>>> GetRequestsTreeNode(int count, int position) + { + var allRequests = await TvRepository.Get().Skip(position).Take(count).ToListAsync(); + return ParseIntoTreeNode(allRequests); + } + public async Task> GetRequests() { var allRequests = TvRepository.Get(); @@ -132,7 +138,7 @@ namespace Ombi.Core.Engine { return await TvRepository.GetChild().Where(x => x.ParentRequestId == tvId).ToListAsync(); } - + public async Task> SearchTvRequest(string search) { var allRequests = TvRepository.Get(); @@ -140,21 +146,42 @@ namespace Ombi.Core.Engine return results; } + public async Task>>> SearchTvRequestTree(string search) + { + var allRequests = TvRepository.Get(); + var results = await allRequests.Where(x => x.Title.Contains(search, CompareOptions.IgnoreCase)).ToListAsync(); + return ParseIntoTreeNode(results); + } + public async Task UpdateTvRequest(TvRequests request) { await Audit.Record(AuditType.Updated, AuditArea.TvRequest, $"Updated Request {request.Title}", Username); var allRequests = TvRepository.Get(); var results = await allRequests.FirstOrDefaultAsync(x => x.Id == request.Id); - // TODO need to check if we need to approve any child requests since they may have updated await TvRepository.Update(results); return results; } + public async Task ApproveChildRequest(ChildRequests request) + { + if (request.Approved) + { + await Audit.Record(AuditType.Approved, AuditArea.TvRequest, $"Approved Request {request.Title}", Username); + // Autosend + await TvSender.SendToSonarr(request); + } + await TvRepository.UpdateChild(request); + return new RequestEngineResult + { + RequestAdded = true + }; + } + public async Task UpdateChildRequest(ChildRequests request) { await Audit.Record(AuditType.Updated, AuditArea.TvRequest, $"Updated Request {request.Title}", Username); - + await TvRepository.UpdateChild(request); return request; } @@ -164,7 +191,7 @@ namespace Ombi.Core.Engine var request = await TvRepository.GetChild().FirstOrDefaultAsync(x => x.Id == requestId); var all = TvRepository.Db.TvRequests.Include(x => x.ChildRequests); var parent = all.FirstOrDefault(x => x.Id == request.ParentRequestId); - + // Is this the only child? If so delete the parent if (parent.ChildRequests.Count <= 1) { @@ -201,6 +228,41 @@ namespace Ombi.Core.Engine return await AfterRequest(model.ChildRequests.FirstOrDefault()); } + private static List>> ParseIntoTreeNode(IEnumerable result) + { + var node = new List>>(); + + foreach (var value in result) + { + node.Add(new TreeNode> + { + Data = value, + Children = new List>> + { + new TreeNode> + { + Data = SortEpisodes(value.ChildRequests), + Leaf = true + } + } + }); + } + return node; + } + + private static List SortEpisodes(List items) + { + foreach (var value in items) + { + foreach (var requests in value.SeasonRequests) + { + requests.Episodes.OrderBy(x => x.EpisodeNumber); + } + } + return items; + } + + private async Task AfterRequest(ChildRequests model) { var sendRuleResult = await RunSpecificRule(model, SpecificRules.CanSendNotification); @@ -209,7 +271,7 @@ namespace Ombi.Core.Engine NotificationHelper.NewRequest(model); } - if(model.Approved) + if (model.Approved) { // Autosend await TvSender.SendToSonarr(model); @@ -221,8 +283,8 @@ namespace Ombi.Core.Engine //public async Task> GetApprovedRequests() //{ // var allRequests = TvRepository.Get(); - - + + //} //public async Task> GetNewRequests() diff --git a/src/Ombi.Core/Engine/TvSearchEngine.cs b/src/Ombi.Core/Engine/TvSearchEngine.cs index 28aa6061a..862dde5a5 100644 --- a/src/Ombi.Core/Engine/TvSearchEngine.cs +++ b/src/Ombi.Core/Engine/TvSearchEngine.cs @@ -19,13 +19,14 @@ using Ombi.Store.Entities.Requests; using Ombi.Store.Repository.Requests; using Ombi.Store.Entities; using Microsoft.AspNetCore.Identity; +using Microsoft.EntityFrameworkCore; namespace Ombi.Core.Engine { public class TvSearchEngine : BaseMediaEngine, ITvSearchEngine { public TvSearchEngine(IPrincipal identity, IRequestServiceMain service, ITvMazeApi tvMaze, IMapper mapper, ISettingsService plexSettings, - ISettingsService embySettings, IPlexContentRepository repo, ITraktApi trakt, IRuleEvaluator r, UserManager um) + ISettingsService embySettings, IPlexContentRepository repo, IEmbyContentRepository embyRepo, ITraktApi trakt, IRuleEvaluator r, UserManager um) : base(identity, service, r, um) { TvMazeApi = tvMaze; @@ -34,6 +35,7 @@ namespace Ombi.Core.Engine EmbySettings = embySettings; PlexContentRepo = repo; TraktApi = trakt; + EmbyContentRepo = embyRepo; } private ITvMazeApi TvMazeApi { get; } @@ -41,6 +43,7 @@ namespace Ombi.Core.Engine private ISettingsService PlexSettings { get; } private ISettingsService EmbySettings { get; } private IPlexContentRepository PlexContentRepo { get; } + private IEmbyContentRepository EmbyContentRepo { get; } private ITraktApi TraktApi { get; } public async Task> Search(string searchTerm) @@ -175,11 +178,31 @@ namespace Ombi.Core.Engine { if (embySettings.Enable) { - //var embyShow = EmbyChecker.GetTvShow(embyCached.ToArray(), t.show.name, t.show.premiered?.Substring(0, 4), providerId); - //if (embyShow != null) - //{ - // viewT.Available = true; - //} + var content = await EmbyContentRepo.Get(item.Id.ToString()); + + if (content != null) + { + item.Available = true; + } + + // Let's go through the episodes now + if (item.SeasonRequests.Any()) + { + var allEpisodes = EmbyContentRepo.GetAllEpisodes().Include(x => x.Series); + foreach (var season in item.SeasonRequests) + { + foreach (var episode in season.Episodes) + { + var epExists = await allEpisodes.FirstOrDefaultAsync(x => + x.EpisodeNumber == episode.EpisodeNumber && x.SeasonNumber == season.SeasonNumber && item.Id.ToString() == x.Series.ProviderId); + if (epExists != null) + { + episode.Available = true; + } + } + } + } + } if (plexSettings.Enable) { @@ -190,6 +213,24 @@ namespace Ombi.Core.Engine item.Available = true; item.PlexUrl = content.Url; } + // Let's go through the episodes now + if (item.SeasonRequests.Any()) + { + var allEpisodes = PlexContentRepo.GetAllEpisodes(); + foreach (var season in item.SeasonRequests) + { + foreach (var episode in season.Episodes) + { + var epExists = await allEpisodes.FirstOrDefaultAsync(x => + x.EpisodeNumber == episode.EpisodeNumber && x.SeasonNumber == season.SeasonNumber); + if (epExists != null) + { + episode.Available = true; + } + } + } + } + } if (item.Id > 0) diff --git a/src/Ombi.Schedule/Jobs/Emby/EmbyEpisodeCacher.cs b/src/Ombi.Schedule/Jobs/Emby/EmbyEpisodeCacher.cs index 9031993ff..d6e8878aa 100644 --- a/src/Ombi.Schedule/Jobs/Emby/EmbyEpisodeCacher.cs +++ b/src/Ombi.Schedule/Jobs/Emby/EmbyEpisodeCacher.cs @@ -77,6 +77,12 @@ namespace Ombi.Schedule.Jobs.Emby foreach (var ep in allEpisodes.Items) { + if (ep.LocationType.Equals("Virtual", StringComparison.CurrentCultureIgnoreCase)) + { + // This means that we don't actully have the file, it's just Emby being nice and showing future stuff + continue; + } + var epInfo = await _api.GetEpisodeInformation(ep.Id, server.ApiKey, server.AdministratorId, server.FullUri); if (epInfo?.ProviderIds?.Tvdb == null) { diff --git a/src/Ombi.Schedule/Jobs/Ombi/OmbiAutomaticUpdater.cs b/src/Ombi.Schedule/Jobs/Ombi/OmbiAutomaticUpdater.cs index a7cc8179e..831d562d6 100644 --- a/src/Ombi.Schedule/Jobs/Ombi/OmbiAutomaticUpdater.cs +++ b/src/Ombi.Schedule/Jobs/Ombi/OmbiAutomaticUpdater.cs @@ -108,31 +108,8 @@ namespace Ombi.Schedule.Jobs.Ombi } else { - // Linux - if (desc.Contains("ubuntu", CompareOptions.IgnoreCase)) - { - // Ubuntu - Logger.LogInformation(LoggingEvents.Updater, "We are ubuntu"); - download = updates.Downloads.FirstOrDefault(x => x.Name.Contains("ubuntu", CompareOptions.IgnoreCase)); - - } - else if (desc.Contains("debian", CompareOptions.IgnoreCase)) - { - // Debian - Logger.LogInformation(LoggingEvents.Updater, "We are debian"); - download = updates.Downloads.FirstOrDefault(x => x.Name.Contains("debian", CompareOptions.IgnoreCase)); - } - else if (desc.Contains("centos", CompareOptions.IgnoreCase)) - { - // Centos - Logger.LogInformation(LoggingEvents.Updater, "We are centos"); - download = updates.Downloads.FirstOrDefault(x => x.Name.Contains("centos", - CompareOptions.IgnoreCase)); - } - else - { - return; - } + Logger.LogInformation(LoggingEvents.Updater, "We are linux"); + download = updates.Downloads.FirstOrDefault(x => x.Name.Contains("linux", CompareOptions.IgnoreCase)); } if (download == null) { @@ -201,7 +178,7 @@ namespace Ombi.Schedule.Jobs.Ombi { UseShellExecute = false, CreateNoWindow = true, - FileName = Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location),"TempUpdate",$"Ombi.Updater{updaterExtension}"), + FileName = Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), "TempUpdate", $"Ombi.Updater{updaterExtension}"), Arguments = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location) + " " + extension }; using (var proc = new Process { StartInfo = start }) @@ -212,7 +189,7 @@ namespace Ombi.Schedule.Jobs.Ombi } } catch (Exception e) - { + { Ctx.WriteLine(e); throw; } diff --git a/src/Ombi.Store/Entities/ApplicationConfiguration.cs b/src/Ombi.Store/Entities/ApplicationConfiguration.cs index adf7e3342..a16335ab2 100644 --- a/src/Ombi.Store/Entities/ApplicationConfiguration.cs +++ b/src/Ombi.Store/Entities/ApplicationConfiguration.cs @@ -14,6 +14,7 @@ namespace Ombi.Store.Entities Url, Port, FanartTv, - TheMovieDb + TheMovieDb, + StoragePath } } \ No newline at end of file diff --git a/src/Ombi/ClientApp/app/app.component.html b/src/Ombi/ClientApp/app/app.component.html index f79b9ff03..9c5a9562d 100644 --- a/src/Ombi/ClientApp/app/app.component.html +++ b/src/Ombi/ClientApp/app/app.component.html @@ -27,6 +27,9 @@ +
-
+

Currently Online

The media server is currently online diff --git a/src/Ombi/ClientApp/app/landingpage/landingpage.component.ts b/src/Ombi/ClientApp/app/landingpage/landingpage.component.ts index bfa96fb9e..f5d13420b 100644 --- a/src/Ombi/ClientApp/app/landingpage/landingpage.component.ts +++ b/src/Ombi/ClientApp/app/landingpage/landingpage.component.ts @@ -29,6 +29,8 @@ export class LandingPageComponent implements OnInit { }); - this.landingPageService.getServerStatus().subscribe(x => this.mediaServerStatus = x); + this.landingPageService.getServerStatus().subscribe(x => { + this.mediaServerStatus = x; + }); } } diff --git a/src/Ombi/ClientApp/app/login/login.component.html b/src/Ombi/ClientApp/app/login/login.component.html index 1e621e1aa..9458b07fc 100644 --- a/src/Ombi/ClientApp/app/login/login.component.html +++ b/src/Ombi/ClientApp/app/login/login.component.html @@ -9,7 +9,7 @@ include the remember me checkbox
-
+

@@ -68,7 +68,7 @@ Available Processing Request
-
Pending Approval
+
Pending Approval
diff --git a/src/Ombi/ClientApp/app/requests/tvrequest-children.component.ts b/src/Ombi/ClientApp/app/requests/tvrequest-children.component.ts index d6ca8d432..5bccbd17e 100644 --- a/src/Ombi/ClientApp/app/requests/tvrequest-children.component.ts +++ b/src/Ombi/ClientApp/app/requests/tvrequest-children.component.ts @@ -1,6 +1,6 @@ import { Component, Input } from "@angular/core"; import { IChildRequests, IEpisodesRequests } from "../interfaces"; -import { RequestService } from "../services"; +import { NotificationService, RequestService } from "../services"; @Component({ selector:"tvrequests-children", @@ -9,7 +9,9 @@ import { RequestService } from "../services"; export class TvRequestChildrenComponent { @Input() public childRequests: IChildRequests[]; @Input() public isAdmin: boolean; - constructor(private requestService: RequestService ) { } + constructor(private requestService: RequestService, + private notificationService: NotificationService) { } + public removeRequest(request: IChildRequests) { this.requestService.deleteChild(request) .subscribe(); @@ -36,8 +38,21 @@ export class TvRequestChildrenComponent { public approve(request: IChildRequests) { request.approved = true; request.denied = false; - this.requestService.updateChild(request) - .subscribe(); + request.seasonRequests.forEach((season) => { + season.episodes.forEach((ep) => { + ep.approved = true; + }); + }); + this.requestService.approveChild(request) + .subscribe(x => { + if (x.requestAdded) { + this.notificationService.success("Request Approved", + `Request has been approved successfully`); + } else { + this.notificationService.warning("Request Approved", x.message ? x.message : x.errorMessage); + request.approved = false; + } + }); } public denySeasonRequest(request: IChildRequests) { diff --git a/src/Ombi/ClientApp/app/requests/tvrequests.component.html b/src/Ombi/ClientApp/app/requests/tvrequests.component.html index e515ee47a..22021fa28 100644 --- a/src/Ombi/ClientApp/app/requests/tvrequests.component.html +++ b/src/Ombi/ClientApp/app/requests/tvrequests.component.html @@ -19,11 +19,6 @@ (scrolled)="loadMore()">-->
- @@ -63,7 +58,7 @@
- +
diff --git a/src/Ombi/ClientApp/app/requests/tvrequests.component.ts b/src/Ombi/ClientApp/app/requests/tvrequests.component.ts index eed66b1cc..f46d1d86b 100644 --- a/src/Ombi/ClientApp/app/requests/tvrequests.component.ts +++ b/src/Ombi/ClientApp/app/requests/tvrequests.component.ts @@ -1,8 +1,7 @@ -import { Component, OnDestroy, OnInit, ViewEncapsulation } from "@angular/core"; +import { Component, OnInit } from "@angular/core"; import "rxjs/add/operator/debounceTime"; import "rxjs/add/operator/distinctUntilChanged"; import "rxjs/add/operator/map"; -import "rxjs/add/operator/takeUntil"; import { Subject } from "rxjs/Subject"; import "rxjs/add/operator/debounceTime"; @@ -13,18 +12,14 @@ import { AuthService } from "../auth/auth.service"; import { RequestService } from "../services"; import { TreeNode } from "primeng/primeng"; -import { IChildRequests, IEpisodesRequests, INewSeasonRequests, ITvRequests } from "../interfaces"; +import { ITvRequests } from "../interfaces"; @Component({ selector: "tv-requests", templateUrl: "./tvrequests.component.html", styleUrls: ["./tvrequests.component.scss"], - //Was required to turn off encapsulation since CSS only should be overridden for this component - //However when encapsulation is on angular injects prefixes to all classes so css selectors - //Stop working - encapsulation: ViewEncapsulation.None, }) -export class TvRequestsComponent implements OnInit, OnDestroy { +export class TvRequestsComponent implements OnInit { public tvRequests: TreeNode[]; public searchChanged = new Subject(); @@ -35,23 +30,20 @@ export class TvRequestsComponent implements OnInit, OnDestroy { private currentlyLoaded: number; private amountToLoad: number; - private subscriptions = new Subject(); constructor(private requestService: RequestService, private auth: AuthService) { this.searchChanged .debounceTime(600) // Wait Xms afterthe last event before emitting last event .distinctUntilChanged() // only emit if value is different from previous value - .takeUntil(this.subscriptions) .subscribe(x => { this.searchText = x as string; if (this.searchText === "") { this.resetSearch(); return; } - this.requestService.searchTvRequests(this.searchText) - .takeUntil(this.subscriptions) - .subscribe(m => this.tvRequests = this.transformData(m)); + this.requestService.searchTvRequestsTree(this.searchText) + .subscribe(m => this.tvRequests = m); }); } public openClosestTab(el: any) { @@ -78,30 +70,7 @@ export class TvRequestsComponent implements OnInit, OnDestroy { } } } - public transformData(data: ITvRequests[]): TreeNode[] { - const temp: TreeNode[] = []; - data.forEach((value) => { - temp.push({ - data: value, - children: [{ - data: this.fixEpisodeSort(value.childRequests), leaf: true, - }], - leaf: false, - }); - }, this); - return temp; - } - public fixEpisodeSort(items: IChildRequests[]) { - items.forEach((value) => { - value.seasonRequests.forEach((requests: INewSeasonRequests) => { - requests.episodes.sort((a: IEpisodesRequests, b: IEpisodesRequests) => { - return a.episodeNumber - b.episodeNumber; - }); - }); - }); - return items; - } public ngOnInit() { this.amountToLoad = 1000; this.currentlyLoaded = 5; @@ -116,10 +85,9 @@ export class TvRequestsComponent implements OnInit, OnDestroy { //if you scroll really quickly then you start getting duplicates of movies //since it's async and some subsequent results return first and then incrementer //is increased so you see movies which had already been gotten show up... - this.requestService.getTvRequests(this.amountToLoad, this.currentlyLoaded + 1) - .takeUntil(this.subscriptions) + this.requestService.getTvRequestsTree(this.amountToLoad, this.currentlyLoaded + 1) .subscribe(x => { - this.tvRequests.push.apply(this.tvRequests, this.transformData(x)); + this.tvRequests = x; this.currentlyLoaded = this.currentlyLoaded + this.amountToLoad; }); } @@ -128,87 +96,15 @@ export class TvRequestsComponent implements OnInit, OnDestroy { this.searchChanged.next(text.target.value); } - public removeRequest(request: ITvRequests) { - this.requestService.removeTvRequest(request); - this.removeRequestFromUi(request); - } - - public changeAvailability(request: IChildRequests, available: boolean) { - request.available = available; - - //this.updateRequest(request); - } - - //Was already here but not sure what's using it...' - //public approve(request: IChildRequests) { - // request.approved = true; - // request.denied = false; - // //this.updateRequest(request); - //} - public approve(request: IChildRequests) { - request.approved = true; - request.denied = false; - this.requestService.updateChild(request) - .subscribe(); - } - //Was already here but not sure what's using it...' - //public deny(request: IChildRequests) { - // request.approved = false; - // request.denied = true; - // //this.updateRequest(request); - //} - public deny(request: IChildRequests) { - request.approved = false; - request.denied = true; - this.requestService.updateChild(request) - .subscribe(); - } - - public approveSeasonRequest(request: IChildRequests) { - request.approved = true; - request.denied = false; - this.requestService.updateTvRequest(this.selectedSeason) - .subscribe(); - } - - public denySeasonRequest(request: IChildRequests) { - request.approved = false; - request.denied = true; - this.requestService.updateTvRequest(this.selectedSeason) - .subscribe(); - } - public showChildren(request: ITvRequests) { this.selectedSeason = request; this.showChildDialogue = true; } - public getColour(ep: IEpisodesRequests): string { - if (ep.available) { - return "lime"; - } - if (ep.approved) { - return "#00c0ff"; - } - return "white"; - } - - public ngOnDestroy() { - this.subscriptions.next(); - this.subscriptions.complete(); - } - - //private updateRequest(request: ITvRequests) { - // this.requestService.updateTvRequest(request) - // .takeUntil(this.subscriptions) - // .subscribe(x => request = x); - //} - private loadInit() { - this.requestService.getTvRequests(this.amountToLoad, 0) - .takeUntil(this.subscriptions) + this.requestService.getTvRequestsTree(this.amountToLoad, 0) .subscribe(x => { - this.tvRequests = this.transformData(x); + this.tvRequests = x; }); } @@ -216,11 +112,4 @@ export class TvRequestsComponent implements OnInit, OnDestroy { this.currentlyLoaded = 5; this.loadInit(); } - - private removeRequestFromUi(key: ITvRequests) { - const index = this.tvRequests.findIndex(x => x.data === key); - if (index > -1) { - this.tvRequests.splice(index, 1); - } - } } diff --git a/src/Ombi/ClientApp/app/search/seriesinformation.component.html b/src/Ombi/ClientApp/app/search/seriesinformation.component.html index ce71207be..5b546b722 100644 --- a/src/Ombi/ClientApp/app/search/seriesinformation.component.html +++ b/src/Ombi/ClientApp/app/search/seriesinformation.component.html @@ -55,14 +55,15 @@ Available - Processing Request - Pending Approval + Processing Request + Selected + Pending Approval Not Requested - - + + diff --git a/src/Ombi/ClientApp/app/search/seriesinformation.component.ts b/src/Ombi/ClientApp/app/search/seriesinformation.component.ts index 34124acd9..4b68ba305 100644 --- a/src/Ombi/ClientApp/app/search/seriesinformation.component.ts +++ b/src/Ombi/ClientApp/app/search/seriesinformation.component.ts @@ -54,10 +54,12 @@ export class SeriesInformationComponent implements OnInit, OnDestroy { public addRequest(episode: IEpisodesRequests) { episode.requested = true; + episode.selected = true; } public removeRequest(episode: IEpisodesRequests) { episode.requested = false; + episode.selected = false; } public ngOnDestroy() { diff --git a/src/Ombi/ClientApp/app/search/tvsearch.component.html b/src/Ombi/ClientApp/app/search/tvsearch.component.html index 8a9f6051a..a6e6ae7fb 100644 --- a/src/Ombi/ClientApp/app/search/tvsearch.component.html +++ b/src/Ombi/ClientApp/app/search/tvsearch.component.html @@ -59,7 +59,7 @@ Air Date: {{node.data.firstAired | date: 'dd/MM/yyyy'}} - Available + Available diff --git a/src/Ombi/ClientApp/app/services/applications/plex.service.ts b/src/Ombi/ClientApp/app/services/applications/plex.service.ts index de71f6ccb..75e2d8148 100644 --- a/src/Ombi/ClientApp/app/services/applications/plex.service.ts +++ b/src/Ombi/ClientApp/app/services/applications/plex.service.ts @@ -6,7 +6,7 @@ import { Observable } from "rxjs/Rx"; import { ServiceAuthHelpers } from "../service.helpers"; -import { IPlexAuthentication, IPlexLibraries, IPlexServerViewModel } from "../../interfaces"; +import { IPlexAuthentication, IPlexLibResponse, IPlexServerViewModel } from "../../interfaces"; import { IPlexServer } from "../../interfaces"; @Injectable() @@ -23,7 +23,7 @@ export class PlexService extends ServiceAuthHelpers { return this.http.post(`${this.url}servers`, JSON.stringify({ login, password }), { headers: this.headers }).map(this.extractData); } - public getLibraries(plexSettings: IPlexServer): Observable { + public getLibraries(plexSettings: IPlexServer): Observable { return this.http.post(`${this.url}Libraries`, JSON.stringify(plexSettings), { headers: this.headers }).map(this.extractData).catch(this.handleError); } diff --git a/src/Ombi/ClientApp/app/services/request.service.ts b/src/Ombi/ClientApp/app/services/request.service.ts index 13714f757..adc24f2eb 100644 --- a/src/Ombi/ClientApp/app/services/request.service.ts +++ b/src/Ombi/ClientApp/app/services/request.service.ts @@ -3,6 +3,7 @@ import { Http } from "@angular/http"; import { AuthHttp } from "angular2-jwt"; import { Observable } from "rxjs/Rx"; +import { TreeNode } from "primeng/primeng"; import { IRequestEngineResult } from "../interfaces"; import { IChildRequests, IMovieRequests, IRequestCountModel, IRequestGrid, ITvRequests } from "../interfaces"; import { ISearchMovieResult } from "../interfaces"; @@ -23,6 +24,10 @@ export class RequestService extends ServiceAuthHelpers { return this.http.post(`${this.url}TV/`, JSON.stringify(tv), { headers: this.headers }).map(this.extractData); } + public approveMovie(movie: IMovieRequests): Observable { + return this.http.post(`${this.url}Movie/Approve`, JSON.stringify(movie), { headers: this.headers }).map(this.extractData); + } + public getMovieRequests(count: number, position: number): Observable { return this.http.get(`${this.url}movie/${count}/${position}`).map(this.extractData); } @@ -44,6 +49,11 @@ export class RequestService extends ServiceAuthHelpers { .catch(this.handleError); } + public getTvRequestsTree(count: number, position: number): Observable { + return this.http.get(`${this.url}tv/${count}/${position}/tree`).map(this.extractData) + .catch(this.handleError); + } + public getChildRequests(requestId: number): Observable { return this.http.get(`${this.url}tv/${requestId}/child`).map(this.extractData) .catch(this.handleError); @@ -51,6 +61,10 @@ export class RequestService extends ServiceAuthHelpers { public searchTvRequests(search: string): Observable { return this.http.get(`${this.url}tv/search/${search}`).map(this.extractData); + } + + public searchTvRequestsTree(search: string): Observable { + return this.http.get(`${this.url}tv/search/${search}/tree`).map(this.extractData); } public removeTvRequest(request: ITvRequests) { @@ -62,6 +76,9 @@ export class RequestService extends ServiceAuthHelpers { } public updateChild(child: IChildRequests): Observable { return this.http.put(`${this.url}tv/child`, JSON.stringify(child), { headers: this.headers }).map(this.extractData); + } + public approveChild(child: IChildRequests): Observable { + return this.http.post(`${this.url}tv/child/approve`, JSON.stringify(child), { headers: this.headers }).map(this.extractData); } public deleteChild(child: IChildRequests): Observable { return this.http.delete(`${this.url}tv/child/${child.id}`, { headers: this.headers }).map(this.extractData); diff --git a/src/Ombi/ClientApp/app/services/service.helpers.ts b/src/Ombi/ClientApp/app/services/service.helpers.ts index 8a8019651..702b6db3c 100644 --- a/src/Ombi/ClientApp/app/services/service.helpers.ts +++ b/src/Ombi/ClientApp/app/services/service.helpers.ts @@ -1,4 +1,5 @@ import { Headers, Http, Response } from "@angular/http"; +import "rxjs/add/observable/throw"; import { Observable } from "rxjs/Observable"; import { AuthHttp } from "angular2-jwt"; diff --git a/src/Ombi/ClientApp/app/settings/emby/emby.component.html b/src/Ombi/ClientApp/app/settings/emby/emby.component.html index 16f3e2d8b..78b2fed02 100644 --- a/src/Ombi/ClientApp/app/settings/emby/emby.component.html +++ b/src/Ombi/ClientApp/app/settings/emby/emby.component.html @@ -24,7 +24,7 @@

-
+

@@ -76,23 +76,20 @@
- +
-
-
-
+
-
\ No newline at end of file diff --git a/src/Ombi/ClientApp/app/settings/emby/emby.component.ts b/src/Ombi/ClientApp/app/settings/emby/emby.component.ts index d1c84a4aa..522490e0c 100644 --- a/src/Ombi/ClientApp/app/settings/emby/emby.component.ts +++ b/src/Ombi/ClientApp/app/settings/emby/emby.component.ts @@ -39,7 +39,7 @@ export class EmbyComponent implements OnInit { public test(server: IEmbyServer) { this.testerService.embyTest(server).subscribe(x => { - if (x) { + if (x === true) { this.notificationService.success("Connected", `Successfully connected to the Emby server ${server.name}!`); } else { this.notificationService.error("Connected", `We could not connect to the Emby server ${server.name}!`); diff --git a/src/Ombi/ClientApp/app/settings/notifications/pushover.component.ts b/src/Ombi/ClientApp/app/settings/notifications/pushover.component.ts index 8851577ee..3fb5f9591 100644 --- a/src/Ombi/ClientApp/app/settings/notifications/pushover.component.ts +++ b/src/Ombi/ClientApp/app/settings/notifications/pushover.component.ts @@ -58,11 +58,10 @@ export class PushoverComponent implements OnInit { this.testerService.pushoverTest(form.value).subscribe(x => { if (x) { - this.notificationService.success("Successful", "Successfully sent a Pushbullet message, please check the discord channel"); + this.notificationService.success("Successful", "Successfully sent a Pushover message"); } else { - this.notificationService.success("Error", "There was an error when sending the Pushbullet message. Please check your settings"); + this.notificationService.success("Error", "There was an error when sending the Pushover message. Please check your settings"); } }); - } } diff --git a/src/Ombi/ClientApp/app/settings/plex/plex.component.ts b/src/Ombi/ClientApp/app/settings/plex/plex.component.ts index 52136b271..19b9417d1 100644 --- a/src/Ombi/ClientApp/app/settings/plex/plex.component.ts +++ b/src/Ombi/ClientApp/app/settings/plex/plex.component.ts @@ -60,7 +60,7 @@ export class PlexComponent implements OnInit, OnDestroy { public testPlex(server: IPlexServer) { this.testerService.plexTest(server).subscribe(x => { - if (x) { + if (x === true) { this.notificationService.success("Connected", `Successfully connected to the Plex server ${server.name}!`); } else { this.notificationService.error("Connected", `We could not connect to the Plex server ${server.name}!`); @@ -90,15 +90,19 @@ export class PlexComponent implements OnInit, OnDestroy { } this.plexService.getLibraries(server).subscribe(x => { server.plexSelectedLibraries = []; - x.mediaContainer.directory.forEach((item, index) => { - const lib: IPlexLibrariesSettings = { - key: item.key, - title: item.title, - enabled: false, - }; - server.plexSelectedLibraries.push(lib); - }); - }, + if (x.successful) { + x.data.mediaContainer.directory.forEach((item) => { + const lib: IPlexLibrariesSettings = { + key: item.key, + title: item.title, + enabled: false, + }; + server.plexSelectedLibraries.push(lib); + }); + } else { + this.notificationService.error("Error", x.message); + } + }, err => { this.notificationService.error("Error", err); }); } diff --git a/src/Ombi/ClientApp/app/wizard/mediaserver/mediaserver.component.html b/src/Ombi/ClientApp/app/wizard/mediaserver/mediaserver.component.html index de9989ac7..0973a2ad6 100644 --- a/src/Ombi/ClientApp/app/wizard/mediaserver/mediaserver.component.html +++ b/src/Ombi/ClientApp/app/wizard/mediaserver/mediaserver.component.html @@ -7,7 +7,7 @@
diff --git a/src/Ombi/Controllers/External/PlexController.cs b/src/Ombi/Controllers/External/PlexController.cs index b9d0446f6..b04e08650 100644 --- a/src/Ombi/Controllers/External/PlexController.cs +++ b/src/Ombi/Controllers/External/PlexController.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; using Ombi.Api.Plex; using Ombi.Api.Plex.Models; using Ombi.Attributes; @@ -18,14 +19,17 @@ namespace Ombi.Controllers.External [Produces("application/json")] public class PlexController : Controller { - public PlexController(IPlexApi plexApi, ISettingsService plexSettings) + public PlexController(IPlexApi plexApi, ISettingsService plexSettings, + ILogger logger) { PlexApi = plexApi; PlexSettings = plexSettings; + _log = logger; } private IPlexApi PlexApi { get; } private ISettingsService PlexSettings { get; } + private readonly ILogger _log; /// /// Signs into the Plex API. @@ -88,11 +92,29 @@ namespace Ombi.Controllers.External /// The settings. /// [HttpPost("Libraries")] - public async Task GetPlexLibraries([FromBody] PlexServers settings) + public async Task GetPlexLibraries([FromBody] PlexServers settings) { - var libs = await PlexApi.GetLibrarySections(settings.PlexAuthToken, settings.FullUri); + try + { + var libs = await PlexApi.GetLibrarySections(settings.PlexAuthToken, settings.FullUri); + + return new PlexLibrariesResponse + { + Successful = true, + Data = libs + }; + } + catch (Exception e) + { + _log.LogWarning(e,"Error thrown when attempting to obtain the plex libs"); - return libs; + var message = e.InnerException != null ? $"{e.Message} - {e.InnerException.Message}" : e.Message; + return new PlexLibrariesResponse + { + Successful = false, + Message = message + }; + } } /// diff --git a/src/Ombi/Controllers/LandingPageController.cs b/src/Ombi/Controllers/LandingPageController.cs index 0582a931d..e495f2cf3 100644 --- a/src/Ombi/Controllers/LandingPageController.cs +++ b/src/Ombi/Controllers/LandingPageController.cs @@ -36,58 +36,55 @@ namespace Ombi.Controllers { var model = new MediaSeverAvailibilityViewModel(); - model.ServersAvailable = 3; - model.ServersUnavailable = 1; - return model; - //var plex = await _plexSettings.GetSettingsAsync(); - //if (plex.Enable) - //{ - - // foreach (var s in plex.Servers) - // { - // try - // { - // var result = await _plexApi.GetStatus(s.PlexAuthToken, s.FullUri); - // if (!string.IsNullOrEmpty(result.MediaContainer?.version)) - // { - // model.ServersAvailable++; - // } - // else - // { - // model.ServersUnavailable++; - // } - // } - // catch (Exception) - // { - // model.ServersUnavailable++; - // } - // } - //} + var plex = await _plexSettings.GetSettingsAsync(); + if (plex.Enable) + { + + foreach (var s in plex.Servers) + { + try + { + var result = await _plexApi.GetStatus(s.PlexAuthToken, s.FullUri); + if (!string.IsNullOrEmpty(result.MediaContainer?.version)) + { + model.ServersAvailable++; + } + else + { + model.ServersUnavailable++; + } + } + catch (Exception) + { + model.ServersUnavailable++; + } + } + } - //var emby = await _embySettings.GetSettingsAsync(); - //if (emby.Enable) - //{ - // foreach (var server in emby.Servers) - // { - // try - // { - // var result = await _embyApi.GetUsers(server.FullUri, server.ApiKey); - // if (result.Any()) - // { - // model.ServersAvailable++; - // } - // else - // { - // model.ServersUnavailable++; - // } - // } - // catch (Exception) - // { - // model.ServersUnavailable++; - // } - // } - //} - //return model; + var emby = await _embySettings.GetSettingsAsync(); + if (emby.Enable) + { + foreach (var server in emby.Servers) + { + try + { + var result = await _embyApi.GetUsers(server.FullUri, server.ApiKey); + if (result.Any()) + { + model.ServersAvailable++; + } + else + { + model.ServersUnavailable++; + } + } + catch (Exception) + { + model.ServersUnavailable++; + } + } + } + return model; } } } \ No newline at end of file diff --git a/src/Ombi/Controllers/RequestController.cs b/src/Ombi/Controllers/RequestController.cs index fb9a40f6e..914278c90 100644 --- a/src/Ombi/Controllers/RequestController.cs +++ b/src/Ombi/Controllers/RequestController.cs @@ -89,6 +89,29 @@ namespace Ombi.Controllers return await MovieRequestEngine.UpdateMovieRequest(model); } + /// + /// Updates the specified movie request. + /// + /// The model. + /// + [HttpPost("movie/approve")] + public async Task ApproveMovie([FromBody] MovieRequests model) + { + return await MovieRequestEngine.ApproveMovie(model); + } + + /// + /// Gets the tv requests. + /// + /// The count of items you want to return. + /// The position. + /// + [HttpGet("tv/{count:int}/{position:int}/tree")] + public async Task>>> GetTvRequestsTree(int count, int position) + { + return await TvRequestEngine.GetRequestsTreeNode(count, position); + } + /// /// Gets the tv requests. /// @@ -98,16 +121,7 @@ namespace Ombi.Controllers [HttpGet("tv/{count:int}/{position:int}")] public async Task> GetTvRequests(int count, int position) { - try - { - - return await TvRequestEngine.GetRequests(count, position); - } - catch (System.Exception e) - { - Debug.WriteLine(e.Message); - throw; - } + return await TvRequestEngine.GetRequests(count, position); } /// @@ -142,6 +156,17 @@ namespace Ombi.Controllers return await TvRequestEngine.SearchTvRequest(searchTerm); } + /// + /// Searches for a specific tv request + /// + /// The search term. + /// + [HttpGet("tv/search/{searchTerm}/tree")] + public async Task>>> SearchTvTree(string searchTerm) + { + return await TvRequestEngine.SearchTvRequestTree(searchTerm); + } + /// /// Deletes the a specific tv request /// @@ -175,6 +200,17 @@ namespace Ombi.Controllers return await TvRequestEngine.UpdateChildRequest(child); } + /// + /// Updates the a specific child request + /// + /// The model. + /// + [HttpPost("tv/child/approve")] + public async Task ApproveChild([FromBody] ChildRequests child) + { + return await TvRequestEngine.ApproveChildRequest(child); + } + /// /// Deletes the a specific tv request /// diff --git a/src/Ombi/Controllers/SettingsController.cs b/src/Ombi/Controllers/SettingsController.cs index 208ddc2d7..98e2ae399 100644 --- a/src/Ombi/Controllers/SettingsController.cs +++ b/src/Ombi/Controllers/SettingsController.cs @@ -141,7 +141,7 @@ namespace Ombi.Controllers public async Task PlexSettings([FromBody]PlexSettings plex) { var result = await Save(plex); - if (result) + if (result && plex.Enable) { BackgroundJob.Enqueue(() => _plexContentCacher.CacheContent()); } @@ -166,14 +166,17 @@ namespace Ombi.Controllers [HttpPost("emby")] public async Task EmbySettings([FromBody]EmbySettings emby) { - foreach (var server in emby.Servers) + if (emby.Enable) { - var users = await _embyApi.GetUsers(server.FullUri, server.ApiKey); - var admin = users.FirstOrDefault(x => x.Policy.IsAdministrator); - server.AdministratorId = admin?.Id; + foreach (var server in emby.Servers) + { + var users = await _embyApi.GetUsers(server.FullUri, server.ApiKey); + var admin = users.FirstOrDefault(x => x.Policy.IsAdministrator); + server.AdministratorId = admin?.Id; + } } var result = await Save(emby); - if (result) + if (result && emby.Enable) { BackgroundJob.Enqueue(() => _embyContentCacher.Start()); } diff --git a/src/Ombi/Models/External/PlexLibrariesResponse.cs b/src/Ombi/Models/External/PlexLibrariesResponse.cs new file mode 100644 index 000000000..d1033f12e --- /dev/null +++ b/src/Ombi/Models/External/PlexLibrariesResponse.cs @@ -0,0 +1,38 @@ +#region Copyright +// /************************************************************************ +// Copyright (c) 2017 Jamie Rees +// File: PlexLibrariesResponse.cs +// Created By: Jamie Rees +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// ************************************************************************/ +#endregion + +using Ombi.Api.Plex.Models; + +namespace Ombi.Models.External +{ + public class PlexLibrariesResponse + { + public PlexContainer Data { get; set; } + public bool Successful { get; set; } + public string Message { get; set; } + } +} \ No newline at end of file diff --git a/src/Ombi/Ombi.csproj b/src/Ombi/Ombi.csproj index d548f5d27..62d4725a5 100644 --- a/src/Ombi/Ombi.csproj +++ b/src/Ombi/Ombi.csproj @@ -24,12 +24,16 @@ + + + + @@ -77,11 +81,6 @@ - - - - - diff --git a/src/Ombi/Program.cs b/src/Ombi/Program.cs index 2b341630d..ad726d184 100644 --- a/src/Ombi/Program.cs +++ b/src/Ombi/Program.cs @@ -19,11 +19,13 @@ namespace Ombi int port = 0; string host = string.Empty; + string storagePath = string.Empty; Parser.Default.ParseArguments(args) .WithParsed(o => { port = o.Port; host = o.Host; + storagePath = o.StoragePath; }); UrlArgs = $"{host}:{port}"; @@ -46,7 +48,7 @@ namespace Ombi Type = ConfigurationTypes.Port, Value = "5000" }; - + ctx.ApplicationConfigurations.Add(url); ctx.ApplicationConfigurations.Add(dbPort); ctx.SaveChanges(); @@ -87,5 +89,10 @@ namespace Ombi [Option('p', "port", Required = false, HelpText = "The port, default is 5000", Default = 5000)] public int Port { get; set; } + + + [Option('s', "storage", Required = false, HelpText = "Storage path, where we save the logs and database")] + public string StoragePath { get; set; } + } } diff --git a/src/Ombi/Startup.cs b/src/Ombi/Startup.cs index 6b553abc7..1db038f70 100644 --- a/src/Ombi/Startup.cs +++ b/src/Ombi/Startup.cs @@ -168,7 +168,12 @@ namespace Ombi app.UseAuthentication(); //ApiKeyMiddlewear(app, serviceProvider); - + app.UseSwaggerUI(c => + { + c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1"); + c.ShowJsonEditor(); + }); + app.UseMvc(routes => { routes.MapRoute( @@ -179,11 +184,6 @@ namespace Ombi name: "spa-fallback", defaults: new { controller = "Home", action = "Index" }); }); - app.UseSwaggerUI(c => - { - c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1"); - c.ShowJsonEditor(); - }); } private static void ApiKeyMiddlewear(IApplicationBuilder app, IServiceProvider serviceProvider) diff --git a/src/Ombi/tslint.json b/src/Ombi/tslint.json index 746e08bcd..73a2ee413 100644 --- a/src/Ombi/tslint.json +++ b/src/Ombi/tslint.json @@ -23,6 +23,9 @@ true, "allow-new" ], + "no-trailing-whitespace": [ + false + ], "max-classes-per-file": [ false ], diff --git a/src/Ombi/wwwroot/images/emby-logo-dark.jpg b/src/Ombi/wwwroot/images/emby-logo-dark.jpg deleted file mode 100644 index 838667b78..000000000 Binary files a/src/Ombi/wwwroot/images/emby-logo-dark.jpg and /dev/null differ diff --git a/src/Ombi/wwwroot/images/emby-logo-dark.png b/src/Ombi/wwwroot/images/emby-logo-dark.png new file mode 100644 index 000000000..e09c28cc0 Binary files /dev/null and b/src/Ombi/wwwroot/images/emby-logo-dark.png differ diff --git a/src/Ombi/wwwroot/images/emby-logo.png b/src/Ombi/wwwroot/images/emby-logo.png index a6c51ff23..225a25f9f 100644 Binary files a/src/Ombi/wwwroot/images/emby-logo.png and b/src/Ombi/wwwroot/images/emby-logo.png differ diff --git a/src/Ombi/wwwroot/images/icons_16.png b/src/Ombi/wwwroot/images/icons_16.png index 09d6ec7f8..3e3b58105 100644 Binary files a/src/Ombi/wwwroot/images/icons_16.png and b/src/Ombi/wwwroot/images/icons_16.png differ diff --git a/src/Ombi/wwwroot/images/logo original.png b/src/Ombi/wwwroot/images/logo original.png index c3071e331..1a0af8d4d 100644 Binary files a/src/Ombi/wwwroot/images/logo original.png and b/src/Ombi/wwwroot/images/logo original.png differ diff --git a/src/Ombi/wwwroot/images/logo.png b/src/Ombi/wwwroot/images/logo.png index 560a817e6..d52f82417 100644 Binary files a/src/Ombi/wwwroot/images/logo.png and b/src/Ombi/wwwroot/images/logo.png differ diff --git a/src/Ombi/wwwroot/images/ms-icon-150x150.png b/src/Ombi/wwwroot/images/ms-icon-150x150.png index 33ba50221..d9c7b3f01 100644 Binary files a/src/Ombi/wwwroot/images/ms-icon-150x150.png and b/src/Ombi/wwwroot/images/ms-icon-150x150.png differ diff --git a/src/Ombi/wwwroot/images/ms-icon-310x310.png b/src/Ombi/wwwroot/images/ms-icon-310x310.png index a2044bbb1..578010f98 100644 Binary files a/src/Ombi/wwwroot/images/ms-icon-310x310.png and b/src/Ombi/wwwroot/images/ms-icon-310x310.png differ diff --git a/src/Ombi/wwwroot/images/plex-logo-reversed.png b/src/Ombi/wwwroot/images/plex-logo-reversed.png index 1e754b342..e896b31ed 100644 Binary files a/src/Ombi/wwwroot/images/plex-logo-reversed.png and b/src/Ombi/wwwroot/images/plex-logo-reversed.png differ diff --git a/src/Ombi/wwwroot/images/plex-logo.png b/src/Ombi/wwwroot/images/plex-logo.png index 33355e291..55b85c33f 100644 Binary files a/src/Ombi/wwwroot/images/plex-logo.png and b/src/Ombi/wwwroot/images/plex-logo.png differ diff --git a/src/Ombi/wwwroot/images/slider_handles.png b/src/Ombi/wwwroot/images/slider_handles.png index 0fddde5fe..24eaa825b 100644 Binary files a/src/Ombi/wwwroot/images/slider_handles.png and b/src/Ombi/wwwroot/images/slider_handles.png differ diff --git a/src/Ombi/wwwroot/images/slider_handles@2x.png b/src/Ombi/wwwroot/images/slider_handles@2x.png index d8c901ec8..ce52f6d8f 100644 Binary files a/src/Ombi/wwwroot/images/slider_handles@2x.png and b/src/Ombi/wwwroot/images/slider_handles@2x.png differ diff --git a/src/Ombi/wwwroot/images/ui-bg_flat_0_aaaaaa_40x100.png b/src/Ombi/wwwroot/images/ui-bg_flat_0_aaaaaa_40x100.png index 5b5dab2ab..18630805c 100644 Binary files a/src/Ombi/wwwroot/images/ui-bg_flat_0_aaaaaa_40x100.png and b/src/Ombi/wwwroot/images/ui-bg_flat_0_aaaaaa_40x100.png differ diff --git a/src/Ombi/wwwroot/images/ui-bg_flat_75_ffffff_40x100.png b/src/Ombi/wwwroot/images/ui-bg_flat_75_ffffff_40x100.png index ac8b229af..e36540bbf 100644 Binary files a/src/Ombi/wwwroot/images/ui-bg_flat_75_ffffff_40x100.png and b/src/Ombi/wwwroot/images/ui-bg_flat_75_ffffff_40x100.png differ diff --git a/src/Ombi/wwwroot/images/ui-bg_glass_55_fbf9ee_1x400.png b/src/Ombi/wwwroot/images/ui-bg_glass_55_fbf9ee_1x400.png index ad3d6346e..859310c21 100644 Binary files a/src/Ombi/wwwroot/images/ui-bg_glass_55_fbf9ee_1x400.png and b/src/Ombi/wwwroot/images/ui-bg_glass_55_fbf9ee_1x400.png differ diff --git a/src/Ombi/wwwroot/images/ui-bg_glass_65_ffffff_1x400.png b/src/Ombi/wwwroot/images/ui-bg_glass_65_ffffff_1x400.png index 42ccba269..2393f81e1 100644 Binary files a/src/Ombi/wwwroot/images/ui-bg_glass_65_ffffff_1x400.png and b/src/Ombi/wwwroot/images/ui-bg_glass_65_ffffff_1x400.png differ diff --git a/src/Ombi/wwwroot/images/ui-bg_glass_75_dadada_1x400.png b/src/Ombi/wwwroot/images/ui-bg_glass_75_dadada_1x400.png index 5a46b47cb..67cb37e3d 100644 Binary files a/src/Ombi/wwwroot/images/ui-bg_glass_75_dadada_1x400.png and b/src/Ombi/wwwroot/images/ui-bg_glass_75_dadada_1x400.png differ diff --git a/src/Ombi/wwwroot/images/ui-bg_glass_75_e6e6e6_1x400.png b/src/Ombi/wwwroot/images/ui-bg_glass_75_e6e6e6_1x400.png index 86c2baa65..ac5f2248d 100644 Binary files a/src/Ombi/wwwroot/images/ui-bg_glass_75_e6e6e6_1x400.png and b/src/Ombi/wwwroot/images/ui-bg_glass_75_e6e6e6_1x400.png differ diff --git a/src/Ombi/wwwroot/images/ui-bg_glass_95_fef1ec_1x400.png b/src/Ombi/wwwroot/images/ui-bg_glass_95_fef1ec_1x400.png index 4443fdc1a..108b69b1a 100644 Binary files a/src/Ombi/wwwroot/images/ui-bg_glass_95_fef1ec_1x400.png and b/src/Ombi/wwwroot/images/ui-bg_glass_95_fef1ec_1x400.png differ diff --git a/src/Ombi/wwwroot/images/ui-bg_highlight-soft_75_cccccc_1x100.png b/src/Ombi/wwwroot/images/ui-bg_highlight-soft_75_cccccc_1x100.png index 7c9fa6c6e..e05db0794 100644 Binary files a/src/Ombi/wwwroot/images/ui-bg_highlight-soft_75_cccccc_1x100.png and b/src/Ombi/wwwroot/images/ui-bg_highlight-soft_75_cccccc_1x100.png differ diff --git a/src/Ombi/wwwroot/images/ui-icons_222222_256x240.png b/src/Ombi/wwwroot/images/ui-icons_222222_256x240.png index b273ff111..420821918 100644 Binary files a/src/Ombi/wwwroot/images/ui-icons_222222_256x240.png and b/src/Ombi/wwwroot/images/ui-icons_222222_256x240.png differ diff --git a/src/Ombi/wwwroot/images/ui-icons_2e83ff_256x240.png b/src/Ombi/wwwroot/images/ui-icons_2e83ff_256x240.png index 84defe6e8..8b33291f0 100644 Binary files a/src/Ombi/wwwroot/images/ui-icons_2e83ff_256x240.png and b/src/Ombi/wwwroot/images/ui-icons_2e83ff_256x240.png differ diff --git a/src/Ombi/wwwroot/images/ui-icons_454545_256x240.png b/src/Ombi/wwwroot/images/ui-icons_454545_256x240.png index 59bd45b90..ec4e2a2da 100644 Binary files a/src/Ombi/wwwroot/images/ui-icons_454545_256x240.png and b/src/Ombi/wwwroot/images/ui-icons_454545_256x240.png differ diff --git a/src/Ombi/wwwroot/images/ui-icons_cd0a0a_256x240.png b/src/Ombi/wwwroot/images/ui-icons_cd0a0a_256x240.png index 2ab019b73..edba56ad4 100644 Binary files a/src/Ombi/wwwroot/images/ui-icons_cd0a0a_256x240.png and b/src/Ombi/wwwroot/images/ui-icons_cd0a0a_256x240.png differ diff --git a/src/Ombi/wwwroot/images/ui-icons_ffffff_256x240.png b/src/Ombi/wwwroot/images/ui-icons_ffffff_256x240.png index 42f8f992c..bb12524de 100644 Binary files a/src/Ombi/wwwroot/images/ui-icons_ffffff_256x240.png and b/src/Ombi/wwwroot/images/ui-icons_ffffff_256x240.png differ