Added the ability to turn off TV or Movies from the newsletter

pull/2142/head
Jamie 7 years ago
parent 5cc030b237
commit acb62f4768

@ -229,20 +229,20 @@ namespace Ombi.Schedule.Jobs.Ombi
return resolver.ParseMessage(template, curlys); return resolver.ParseMessage(template, curlys);
} }
private async Task<string> BuildHtml(IQueryable<PlexServerContent> plexContentToSend, IQueryable<EmbyContent> embyContentToSend, IQueryable<PlexEpisode> plexEpisodes, IQueryable<EmbyEpisode> embyEp) private async Task<string> BuildHtml(IQueryable<PlexServerContent> plexContentToSend, IQueryable<EmbyContent> embyContentToSend, IQueryable<PlexEpisode> plexEpisodes, IQueryable<EmbyEpisode> embyEp, NewsletterSettings settings)
{ {
var sb = new StringBuilder(); var sb = new StringBuilder();
var plexMovies = plexContentToSend.Where(x => x.Type == PlexMediaTypeEntity.Movie); var plexMovies = plexContentToSend.Where(x => x.Type == PlexMediaTypeEntity.Movie);
var embyMovies = embyContentToSend.Where(x => x.Type == EmbyMediaType.Movie); var embyMovies = embyContentToSend.Where(x => x.Type == EmbyMediaType.Movie);
if (plexMovies.Any() || embyMovies.Any()) if ((plexMovies.Any() || embyMovies.Any()) && !settings.DisableMovies)
{ {
sb.Append("<h1>New Movies:</h1><br /><br />"); sb.Append("<h1>New Movies:</h1><br /><br />");
await ProcessPlexMovies(plexMovies, sb); await ProcessPlexMovies(plexMovies, sb);
await ProcessEmbyMovies(embyMovies, sb); await ProcessEmbyMovies(embyMovies, sb);
} }
if (plexEpisodes.Any() || embyEp.Any()) if ((plexEpisodes.Any() || embyEp.Any()) && !settings.DisableTv)
{ {
sb.Append("<h1>New Episodes:</h1><br /><br />"); sb.Append("<h1>New Episodes:</h1><br /><br />");
await ProcessPlexTv(plexEpisodes, sb); await ProcessPlexTv(plexEpisodes, sb);

@ -2,6 +2,8 @@
{ {
public class NewsletterSettings : Settings public class NewsletterSettings : Settings
{ {
public bool DisableTv { get; set; }
public bool DisableMovies { get; set; }
public bool Enabled { get; set; } public bool Enabled { get; set; }
} }
} }

@ -57,6 +57,8 @@ export interface IDiscordNotifcationSettings extends INotificationSettings {
export interface INewsletterNotificationSettings extends INotificationSettings { export interface INewsletterNotificationSettings extends INotificationSettings {
notificationTemplate: INotificationTemplates; notificationTemplate: INotificationTemplates;
disableMovies: boolean;
disableTv: boolean;
} }
export interface ITelegramNotifcationSettings extends INotificationSettings { export interface ITelegramNotifcationSettings extends INotificationSettings {

@ -9,6 +9,16 @@
<div class="checkbox"> <div class="checkbox">
<input type="checkbox" id="enabled" [(ngModel)]="settings.enabled" ng-checked="settings.enabled"><label for="enabled">Enable</label> <input type="checkbox" id="enabled" [(ngModel)]="settings.enabled" ng-checked="settings.enabled"><label for="enabled">Enable</label>
</div> </div>
</div>
<div class="form-group">
<div class="checkbox">
<input type="checkbox" id="disableTv" [(ngModel)]="settings.disableTv" ng-checked="settings.disableTv"><label for="disableTv">Disable TV</label>
</div>
</div>
<div class="form-group">
<div class="checkbox">
<input type="checkbox" id="disableMovies" [(ngModel)]="settings.disableMovies" ng-checked="settings.disableMovies"><label for="disableMovies">Disable Movies</label>
</div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="control-label">Subject</label> <label class="control-label">Subject</label>

Loading…
Cancel
Save