Added a new setting for the Netflix option, we can now disable it appearing in the search.

Stopped the Emby newsletter sending out all TV shows every time.
This commit is contained in:
tidusjar 2017-03-18 22:00:52 +00:00
parent 9ca3ee4058
commit 2b27559277
7 changed files with 16 additions and 8 deletions

View file

@ -53,9 +53,9 @@ namespace Ombi.Core.Migration.Migrations
} }
public int Version => 22000; public int Version => 22000;
private ISettingsService<CustomizationSettings> Customization { get; } private ISettingsService<CustomizationSettings> Customization { get; }
private ISettingsService<PlexSettings> PlexSettings { get; } private ISettingsService<PlexSettings> PlexSettings { get; }
private IRepository<RecentlyAddedLog> Log { get; } private IRepository<RecentlyAddedLog> Log { get; }
private IRepository<PlexContent> PlexContent { get; } private IRepository<PlexContent> PlexContent { get; }
private IRepository<PlexEpisodes> PlexEpisodes { get; } private IRepository<PlexEpisodes> PlexEpisodes { get; }
@ -68,6 +68,7 @@ namespace Ombi.Core.Migration.Migrations
AddNewColumns(con); AddNewColumns(con);
UpdateSchema(con, Version); UpdateSchema(con, Version);
UpdateRecentlyAdded(con); UpdateRecentlyAdded(con);
} }
private void UpdateRecentlyAdded(IDbConnection con) private void UpdateRecentlyAdded(IDbConnection con)
@ -124,10 +125,9 @@ namespace Ombi.Core.Migration.Migrations
{ {
var settings = Customization.GetSettings(); var settings = Customization.GetSettings();
settings.EnableIssues = true; settings.EnableIssues = true;
settings.EnableNetflixResults = true;
Customization.SaveSettings(settings); Customization.SaveSettings(settings);
} }
} }
} }

View file

@ -55,6 +55,6 @@ namespace Ombi.Core.SettingModels
public bool NewSearch { get; set; } public bool NewSearch { get; set; }
public bool EnableIssues { get; set; } public bool EnableIssues { get; set; }
public bool EnableNetflixResults { get; set; }
} }
} }

View file

@ -116,6 +116,7 @@ namespace Ombi.Services.Jobs.RecentlyAddedNewsletter
var filteredMovies = movie.Where(m => recentlyAdded.All(x => x.ProviderId != m.ProviderId)).ToList(); var filteredMovies = movie.Where(m => recentlyAdded.All(x => x.ProviderId != m.ProviderId)).ToList();
var filteredEp = episodes.Where(m => recentlyAdded.All(x => x.ProviderId != m.ProviderId)).ToList(); var filteredEp = episodes.Where(m => recentlyAdded.All(x => x.ProviderId != m.ProviderId)).ToList();
var filteredSeries = series.Where(m => recentlyAdded.All(x => x.ProviderId != m.ProviderId)).ToList();
var info = new List<EmbyRecentlyAddedModel>(); var info = new List<EmbyRecentlyAddedModel>();
foreach (var m in filteredMovies) foreach (var m in filteredMovies)
@ -133,7 +134,7 @@ namespace Ombi.Services.Jobs.RecentlyAddedNewsletter
newsletter.MovieCount = info.Count; newsletter.MovieCount = info.Count;
info.Clear(); info.Clear();
foreach (var t in series) foreach (var t in filteredSeries)
{ {
var i = Api.GetInformation(t.EmbyId, Ombi.Api.Models.Emby.EmbyMediaType.Series, var i = Api.GetInformation(t.EmbyId, Ombi.Api.Models.Emby.EmbyMediaType.Series,
embySettings.ApiKey, embySettings.AdministratorId, embySettings.FullUri); embySettings.ApiKey, embySettings.AdministratorId, embySettings.FullUri);

View file

@ -49,7 +49,8 @@ using PlexMediaType = Ombi.Store.Models.Plex.PlexMediaType;
namespace Ombi.Services.Jobs.RecentlyAddedNewsletter namespace Ombi.Services.Jobs.RecentlyAddedNewsletter
{ {
public class PlexRecentlyAddedNewsletter : HtmlTemplateGenerator, IPlexNewsletter public class
PlexRecentlyAddedNewsletter : HtmlTemplateGenerator, IPlexNewsletter
{ {
public PlexRecentlyAddedNewsletter(IPlexApi api, ISettingsService<PlexSettings> plexSettings, public PlexRecentlyAddedNewsletter(IPlexApi api, ISettingsService<PlexSettings> plexSettings,
ISettingsService<EmailNotificationSettings> email, ISettingsService<EmailNotificationSettings> email,

View file

@ -24,6 +24,7 @@ Function.prototype.bind = function (parent) {
$(function () { $(function () {
var netflixEnabled = $('#enableNetflix').text() == 'True';
var useNewSearch = $('#useNewSearch').text() == 'True'; var useNewSearch = $('#useNewSearch').text() == 'True';
var searchSource = useNewSearch ? $("#search-templateNew").html() : $("#search-template").html(); var searchSource = useNewSearch ? $("#search-templateNew").html() : $("#search-template").html();
var seasonsSource = $("#seasons-template").html(); var seasonsSource = $("#seasons-template").html();
@ -416,6 +417,9 @@ $(function () {
}; };
function checkNetflix(title, id) { function checkNetflix(title, id) {
if (!netflixEnabled) {
return;
}
var url = createBaseUrl(base, '/searchextension/netflix/' + title); var url = createBaseUrl(base, '/searchextension/netflix/' + title);
$.ajax(url).success(function (results) { $.ajax(url).success(function (results) {

View file

@ -106,6 +106,7 @@
@*@Html.Checkbox(Model.Settings.NewSearch, "NewSearch", "Use New Search")*@ @*@Html.Checkbox(Model.Settings.NewSearch, "NewSearch", "Use New Search")*@
@Html.Checkbox(Model.Settings.EnableIssues, "EnableIssues", "Enable Issues") @Html.Checkbox(Model.Settings.EnableIssues, "EnableIssues", "Enable Issues")
@Html.Checkbox(Model.Settings.EnableNetflixResults, "EnableNetflixResults", "Enable Netflix results to be shown in the search")
<div class="form-group"> <div class="form-group">
<div> <div>
<button type="submit" id="save" class="btn btn-primary-outline">Submit</button> <button type="submit" id="save" class="btn btn-primary-outline">Submit</button>

View file

@ -14,6 +14,7 @@
<div> <div>
<div hidden="hidden" id="useNewSearch">@Model.CustomizationSettings.NewSearch</div> <div hidden="hidden" id="useNewSearch">@Model.CustomizationSettings.NewSearch</div>
<div hidden="hidden" id="enableNetflix">@Model.CustomizationSettings.EnableNetflixResults</div>
<h1 id="searchTitle">@UI.Search_Title</h1> <h1 id="searchTitle">@UI.Search_Title</h1>
<h4>@string.Format(UI.Search_Paragraph, Model.Emby ? "Emby" : "Plex")</h4> <h4>@string.Format(UI.Search_Paragraph, Model.Emby ? "Emby" : "Plex")</h4>
<br /> <br />