Redo newsletter template using tables

This commit is contained in:
JonnyWong16 2018-03-24 00:02:31 -07:00
commit 3f7edc3635
6 changed files with 780 additions and 620 deletions

View file

@ -20,6 +20,7 @@ import geoip2.database, geoip2.errors
import gzip
import hashlib
import imghdr
from itertools import izip_longest
import ipwhois, ipwhois.exceptions, ipwhois.utils
from IPy import IP
import json
@ -974,3 +975,10 @@ def momentjs_to_arrow(format, duration=False):
for f in invalid_formats:
format = format.replace(f, '')
return format
def grouper(iterable, n, fillvalue=None):
"Collect data into fixed-length chunks or blocks"
# grouper('ABCDEFG', 3, 'x') --> ABC DEF Gxx
args = [iter(iterable)] * n
return izip_longest(fillvalue=fillvalue, *args)

View file

@ -413,7 +413,7 @@ class Newsletter(object):
os.makedirs(newsletter_folder)
try:
with open(newsletter_file_fp, 'w') as n_file:
with open(newsletter_file_fp, 'wb') as n_file:
n_file.write(self.newsletter.encode('utf-8'))
logger.info(u"Tautulli Newsletters :: %s newsletter saved to %s" % (self.NAME, newsletter_file))
@ -661,8 +661,8 @@ class RecentlyAdded(Newsletter):
if self.is_preview or plexpy.CONFIG.NEWSLETTER_SELF_HOSTED:
for item in movies + shows + albums:
item['thumb_hash'] = set_hash_image_info(img=item['thumb'],
width=300,
height=450,
width=150,
height=225,
fallback='poster')
item['art_hash'] = set_hash_image_info(img=item['art'],
width=500,