From 520f0722afaeaa984313dfdcbdcd87da58c47082 Mon Sep 17 00:00:00 2001 From: JackDandy Date: Sat, 23 Jan 2016 23:39:50 +0000 Subject: [PATCH] Change emails to Unicode aware. --- CHANGES.md | 1 + sickbeard/notifiers/emailnotify.py | 51 +++++++++++------------------- 2 files changed, 20 insertions(+), 32 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 52e8fafc..c8c8290f 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -20,6 +20,7 @@ * Update SimpleJSON library 3.8.0 (a37a9bd) to 3.8.1 (6022794) * Update Six compatibility library 1.9.0 (r400) to 1.10.0 (r405) * Change refactor email notifier +* Change emails to Unicode aware ### 0.11.3 (2016-01-16 20:00:00 UTC) diff --git a/sickbeard/notifiers/emailnotify.py b/sickbeard/notifiers/emailnotify.py index badf794e..49692559 100644 --- a/sickbeard/notifiers/emailnotify.py +++ b/sickbeard/notifiers/emailnotify.py @@ -54,20 +54,22 @@ class EmailNotifier: if not sickbeard.USE_EMAIL and not force: return - ep_name = ep_name.encode('utf-8', 'replace') - show = self._parse_ep(ep_name) - to = self._generate_recipients(show) + show = ep_name.split(' - ')[0] + to = self._get_recipients(show) if not any(to): logger.log(u'No email recipients to notify, skipping', logger.WARNING) return + logger.log(u'Email recipients to notify: %s' % to, logger.DEBUG) + try: msg = MIMEMultipart('alternative') msg.attach(MIMEText( '' + '

SickGear Notification - %s

\n' % title + - '

Show: ' + re.search('(.+?) -.+', ep_name).group(1) + - '

\n

Episode: ' + re.search('.+ - (.+?-.+) -.+', ep_name).group(1) + + '

Show: ' + show.encode('ascii', 'xmlcharrefreplace') + + '

\n

Episode: ' + + unicode(re.search('.+ - (.+?-.+) -.+', ep_name).group(1)).encode('ascii', 'xmlcharrefreplace') + extra + '

\n\n' + '