summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2019-07-14 10:10:27 +0200
committerJörg Frings-Fürst <debian@jff.email>2019-07-14 10:10:27 +0200
commit85a84567ef0c2f0949953d81929ce7794fbcad2d (patch)
treeda63e80e3ea0d9e0d4a45e60e75960ffb58b1835
parent5b672f2e2521b0f0e932c9b3d76b1f2db27c7201 (diff)
parent4fa0bf4b0c3644078fb9b5c3e7f604f6f6e442d2 (diff)
Update upstream source from tag 'upstream/2.0.5'
Update to upstream version '2.0.5' with Debian dir da8d3ecbd521f52ac641e3c966f4a5e22b64aaeb
-rw-r--r--.gitignore2
-rwxr-xr-xmwc.py8
-rwxr-xr-xmwctools.py7
3 files changed, 10 insertions, 7 deletions
diff --git a/.gitignore b/.gitignore
index 91ef9c0..4ccd411 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,4 +4,4 @@
/*.txt
*~
*.pyc
-.pc
+
diff --git a/mwc.py b/mwc.py
index 6a48317..22a9dca 100755
--- a/mwc.py
+++ b/mwc.py
@@ -4,6 +4,8 @@
# Copyright: (2013-2017) Michael Till Beck <Debianguru@gmx.de>
# License: GPL-2.0+
+#test
+
import io
from lxml import etree
import hashlib
@@ -78,7 +80,7 @@ def sendmail(receiver, subject, content, sendAsHtml, link, encoding=None):
else:
if link is not None:
content = link + '\n\n' + content
- mail = MIMEText(content, 'text', encoding)
+ mail = MIMEText(content, 'plain', encoding)
mail['From'] = config.sender
mail['To'] = receiver
@@ -93,7 +95,7 @@ def sendmail(receiver, subject, content, sendAsHtml, link, encoding=None):
if config.smtpusername is not None:
mailsession.login(config.smtpusername, config.smtppwd)
- mailsession.sendmail(config.sender, receiver.split(','), mail.as_string())
+ mailsession.send_message(mail)
# returns a list of all content that is stored locally for a specific site
@@ -170,7 +172,7 @@ def pollWebsites():
sessionHashes.append(contenthash)
changedContents.append(content)
- subject = '[' + site['name'] + '] ' + content.title
+ subject = '[' + site['name'] + '] ' + ("Update available" if content.title is None else content.title)
print(' ' + subject)
if config.enableMailNotifications and len(fileHashes) > 0:
sendAsHtml = (content.contenttype == 'html')
diff --git a/mwctools.py b/mwctools.py
index cefbbf0..1dca2e6 100755
--- a/mwctools.py
+++ b/mwctools.py
@@ -33,12 +33,13 @@ class Receiver(Parser):
class Content:
- def __init__(self, uri, encoding, title, content, contenttype):
+ def __init__(self, uri, encoding, title, content, contenttype, additional=None):
self.uri = uri
self.encoding = encoding
self.title = title
self.content = content
self.contenttype = contenttype
+ self.additional = additional
# returns a short subject line
@@ -106,13 +107,13 @@ class CommandReceiver(Receiver):
contentList = []
# run command and retrieve output
- process = subprocess.Popen(self.command, stdout=subprocess.PIPE, shell=True, close_fds=True)
+ process = subprocess.Popen(self.command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True, close_fds=True)
thefile = process.stdout
result = thefile.read().decode(self.encoding, errors='ignore')
thefile.close()
if process.wait() != 0:
- raise Exception("process terminated with an error")
+ raise Exception("process terminated with an error: " + str(process.stderr) + "\n" + result)
contentList.append(Content(uri=None, encoding=self.encoding, title=None, content=result, contenttype=self.contenttype))
return contentList