@ -202,14 +202,15 @@ namespace Ombi.Services.Jobs
}
}
string escapedHtml = new string ( html . Where ( c = > ! char . IsControl ( c ) ) . ToArray ( ) ) ;
Send ( newletterSettings , html , plexSettings , testEmail ) ;
Log . Debug ( escapedHtml ) ;
Send ( newletterSettings , escapedHtml , plexSettings , testEmail ) ;
}
}
private void GenerateMovieHtml ( List < RecentlyAddedChild > movies , PlexSettings plexSettings , StringBuilder sb )
private void GenerateMovieHtml ( List < RecentlyAddedChild > movies , PlexSettings plexSettings , StringBuilder sb )
{
{
var orderedMovies = movies . OrderByDescending ( x = > x ? . addedAt . UnixTimeStampToDateTime ( ) ) . ToList ( ) ? ? new List < RecentlyAddedChild > ( ) ;
var orderedMovies = movies . OrderByDescending ( x = > x ? . addedAt . UnixTimeStampToDateTime ( ) ) . ToList ( ) ? ? new List < RecentlyAddedChild > ( ) ;
sb . Append ( "<h1>New Movies:</h1><br /><br/>") ;
sb . Append ( "<h1>New Movies:</h1><br /><br />") ;
sb . Append (
sb . Append (
"<table border=\"0\" cellpadding=\"0\" align=\"center\" cellspacing=\"0\" style=\"border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%;\" width=\"100%\">" ) ;
"<table border=\"0\" cellpadding=\"0\" align=\"center\" cellspacing=\"0\" style=\"border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%;\" width=\"100%\">" ) ;
foreach ( var movie in orderedMovies )
foreach ( var movie in orderedMovies )
@ -259,13 +260,13 @@ namespace Ombi.Services.Jobs
}
}
}
}
sb . Append ( "</table><br /><br/>") ;
sb . Append ( "</table><br /><br />") ;
}
}
private void GenerateMovieHtml ( List < Metadata > movies , PlexSettings plexSettings , StringBuilder sb )
private void GenerateMovieHtml ( List < Metadata > movies , PlexSettings plexSettings , StringBuilder sb )
{
{
var orderedMovies = movies . OrderByDescending ( x = > x ? . addedAt . UnixTimeStampToDateTime ( ) ) . ToList ( ) ? ? new List < Metadata > ( ) ;
var orderedMovies = movies . OrderByDescending ( x = > x ? . addedAt . UnixTimeStampToDateTime ( ) ) . ToList ( ) ? ? new List < Metadata > ( ) ;
sb . Append ( "<h1>New Movies:</h1><br /><br/>") ;
sb . Append ( "<h1>New Movies:</h1><br /><br />") ;
sb . Append (
sb . Append (
"<table border=\"0\" cellpadding=\"0\" align=\"center\" cellspacing=\"0\" style=\"border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%;\" width=\"100%\">" ) ;
"<table border=\"0\" cellpadding=\"0\" align=\"center\" cellspacing=\"0\" style=\"border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%;\" width=\"100%\">" ) ;
foreach ( var movie in orderedMovies )
foreach ( var movie in orderedMovies )
@ -315,14 +316,14 @@ namespace Ombi.Services.Jobs
}
}
}
}
sb . Append ( "</table><br /><br/>") ;
sb . Append ( "</table><br /><br />") ;
}
}
private void GenerateTvHtml ( List < RecentlyAddedChild > tv , PlexSettings plexSettings , StringBuilder sb )
private void GenerateTvHtml ( List < RecentlyAddedChild > tv , PlexSettings plexSettings , StringBuilder sb )
{
{
var orderedTv = tv . OrderByDescending ( x = > x ? . addedAt . UnixTimeStampToDateTime ( ) ) . ToList ( ) ;
var orderedTv = tv . OrderByDescending ( x = > x ? . addedAt . UnixTimeStampToDateTime ( ) ) . ToList ( ) ;
// TV
// TV
sb . Append ( "<h1>New Episodes:</h1><br /><br/>") ;
sb . Append ( "<h1>New Episodes:</h1><br /><br />") ;
sb . Append (
sb . Append (
"<table border=\"0\" cellpadding=\"0\" align=\"center\" cellspacing=\"0\" style=\"border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%;\" width=\"100%\">" ) ;
"<table border=\"0\" cellpadding=\"0\" align=\"center\" cellspacing=\"0\" style=\"border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%;\" width=\"100%\">" ) ;
foreach ( var t in orderedTv )
foreach ( var t in orderedTv )
@ -375,14 +376,14 @@ namespace Ombi.Services.Jobs
EndLoopHtml ( sb ) ;
EndLoopHtml ( sb ) ;
}
}
}
}
sb . Append ( "</table><br /><br/>") ;
sb . Append ( "</table><br /><br />") ;
}
}
private void GenerateTvHtml ( List < Metadata > tv , PlexSettings plexSettings , StringBuilder sb )
private void GenerateTvHtml ( List < Metadata > tv , PlexSettings plexSettings , StringBuilder sb )
{
{
var orderedTv = tv . OrderByDescending ( x = > x ? . addedAt . UnixTimeStampToDateTime ( ) ) . ToList ( ) ;
var orderedTv = tv . OrderByDescending ( x = > x ? . addedAt . UnixTimeStampToDateTime ( ) ) . ToList ( ) ;
// TV
// TV
sb . Append ( "<h1>New Episodes:</h1><br /><br/>") ;
sb . Append ( "<h1>New Episodes:</h1><br /><br />") ;
sb . Append (
sb . Append (
"<table border=\"0\" cellpadding=\"0\" align=\"center\" cellspacing=\"0\" style=\"border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%;\" width=\"100%\">" ) ;
"<table border=\"0\" cellpadding=\"0\" align=\"center\" cellspacing=\"0\" style=\"border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%;\" width=\"100%\">" ) ;
foreach ( var t in orderedTv )
foreach ( var t in orderedTv )
@ -435,7 +436,7 @@ namespace Ombi.Services.Jobs
EndLoopHtml ( sb ) ;
EndLoopHtml ( sb ) ;
}
}
}
}
sb . Append ( "</table><br /><br/>") ;
sb . Append ( "</table><br /><br />") ;
}
}
private void Send ( NewletterSettings newletterSettings , string html , PlexSettings plexSettings , bool testEmail = false )
private void Send ( NewletterSettings newletterSettings , string html , PlexSettings plexSettings , bool testEmail = false )
@ -516,10 +517,12 @@ namespace Ombi.Services.Jobs
private void EndLoopHtml ( StringBuilder sb )
private void EndLoopHtml ( StringBuilder sb )
{
{
//NOTE: BR have to be in TD's as per html spec or it will be put outside of the table...
//Source: http://stackoverflow.com/questions/6588638/phantom-br-tag-rendered-by-browsers-prior-to-table-tag
sb . Append ( "<hr />" ) ;
sb . Append ( "<br />" ) ;
sb . Append ( "<br />" ) ;
sb . Append ( "</td>" ) ;
sb . Append ( "</td>" ) ;
sb . Append ( "<hr>" ) ;
sb . Append ( "<br>" ) ;
sb . Append ( "<br>" ) ;
sb . Append ( "</tr>" ) ;
sb . Append ( "</tr>" ) ;
}
}