Skip to content

Commit

Permalink
bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mtill committed Aug 31, 2017
1 parent 0cce1dc commit 1c88d19
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
16 changes: 9 additions & 7 deletions config_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,13 @@

sites = [

{'name': 'example-webpage',
{'name': 'example-css',
'parsers': [uri(uri='https://github.com/mtill', contenttype='html'),
css(contentcss='div')
]
},

{'name': 'example-xpath',
'parsers': [uri(uri='https://example-webpage.com/test', contenttype='html'),
xpath(contentxpath='//div[contains(concat(\' \', normalize-space(@class), \' \'), \' package-version-header \')]')
]
Expand All @@ -34,9 +40,7 @@

#os.chdir('/path-to-data-dir/MailWebsiteChanges-data')

subjectPostfix = 'A website has been updated!'

enableMailNotifications = True
enableMailNotifications = False
maxMailsPerSession = -1
sender = 'me@mymail.com'
smtphost = 'mysmtpprovider.com'
Expand All @@ -46,9 +50,7 @@
smtppwd = 'mypassword'
receiver = 'me2@mymail.com'

os.chdir('/var/cache/mwc')

enableRSSFeed = True
enableRSSFeed = False
rssfile = 'feed.xml'
maxFeeds = 100

5 changes: 3 additions & 2 deletions mwctools.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import subprocess

from lxml import etree
from cssselect import GenericTranslator
import re


Expand Down Expand Up @@ -44,7 +45,7 @@ def getSubject(textContent):
global maxTitleLength

if textContent == None or textContent == '':
return config.subjectPostfix
return 'A website has been updated'
textContent = re.sub(' +', ' ', re.sub('\s', ' ', textContent)).strip()
return (textContent[:maxTitleLength] + ' [..]') if len(textContent) > maxTitleLength else textContent

Expand Down Expand Up @@ -192,7 +193,7 @@ def __init__(self, contentcss, titlecss=None, contenttype='html'):

# input: [Content], output: [Content]
def performAction(self, contentList):
return self.xpathparser.parse(contentList)
return self.xpathparser.performAction(contentList)


class RegExParser(Parser):
Expand Down

0 comments on commit 1c88d19

Please sign in to comment.