From 76ea31d1747d8d95ec7ac75be750176beb452f66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sun, 6 Aug 2017 19:52:14 +0200 Subject: New upstream version 1.7.6 --- README.md | 3 +++ config_template.py | 3 ++- mwc.py | 23 +++++++++++++++++++---- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index d008527..8e78da6 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,8 @@ sites = [ Regular expression. If XPath/CSS selector is defined, the regular expression is applied afterwards. * encoding (optional; default: 'utf-8') Character encoding of the website, e.g., 'utf-8' or 'iso-8859-1'. + * splitregex (optional) + only works if type is set to 'text'; defines that content should be split to chunks based on the defined regex expression. * receiver (optional) Overrides global receiver specification. * user-agent (optional) @@ -79,6 +81,7 @@ sites = [
 
 enableMailNotifications = True   #enable/disable notification messages; if set to False, only send error messages
+maxMailsPerSession = -1   #max. number of mails to send per session; ignored when set to -1
 subjectPostfix = 'A website has been updated!'
 
 sender = 'me@mymail.com'
diff --git a/config_template.py b/config_template.py
index 02f7579..f394e52 100644
--- a/config_template.py
+++ b/config_template.py
@@ -15,7 +15,7 @@ sites = [
            'titleregex': '',
            'contentregex': '',
            'user-agent': 'Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:49.0) Gecko/20100101 Firefox/49.0',
-           'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
+           'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'
            'encoding': 'utf-8'},
 
           {'shortname': 'mywebsite2',
@@ -42,6 +42,7 @@ sites = [
 subjectPostfix = 'A website has been updated!'
 
 enableMailNotifications = True
+maxMailsPerSession = -1
 sender = 'me@mymail.com'
 smtphost = 'mysmtpprovider.com'
 useTLS = True
diff --git a/mwc.py b/mwc.py
index a0635a1..c420a74 100755
--- a/mwc.py
+++ b/mwc.py
@@ -69,6 +69,7 @@ def parseSite(site):
         contenttype = site.get('type', 'html')
         contentregex = site.get('contentregex', '')
         titleregex = site.get('titleregex', '')
+        splitregex = site.get('splitregex', '')
         enc = site.get('encoding', defaultEncoding)
 
         contentxpath = site.get('contentxpath', '')
@@ -96,7 +97,10 @@ def parseSite(site):
 
 
                 if contenttype == 'text' or (contentxpath == '' and titlexpath == ''):
-                        contents = [file.read().decode(enc)]
+                        thefullcontent = file.read().decode(enc)
+                        contents = [thefullcontent]
+                        if splitregex != '':
+                                contents = thefullcontent.split(splitregex)
                         titles = []
                 else:
                         baseuri = uri
@@ -248,13 +252,13 @@ def getFileContents(shortname):
 
 
 # updates list of content that is stored locally for a specific site
-def storeFileContents(shortname, parseResult):
+def storeFileContents(shortname, contents):
         for f in os.listdir('.'):
                 if f.startswith(shortname + '.') and f.endswith('.txt'):
                         os.remove(f)
 
         i = 0
-        for c in parseResult['contents']:
+        for c in contents:
                 file = open(shortname + '.' + str(i) + '.txt', 'wb')
                 file.write(c.encode('utf-8'))
                 file.close()
@@ -271,7 +275,11 @@ def pollWebsites():
                         feedXML = etree.parse(io.StringIO(emptyfeed))
 
         # start polling sites
+        sessionContents = []
+        mailsSent = 0
         for site in config.sites:
+                if config.maxMailsPerSession != -1 and mailsSent >= config.maxMailsPerSession:
+                        break
 
                 print('polling site [' + site['shortname'] + '] ...')
                 parseResult = parseSite(site)
@@ -283,6 +291,7 @@ def pollWebsites():
                         print('WARNING: ' + parseResult['warning'])
                         if config.enableMailNotifications:
                                 sendmail(receiver, subject, parseResult['warning'], False, None)
+                                mailsSent = mailsSent + 1
                         if config.enableRSSFeed:
                                 feedXML.xpath('//channel')[0].append(genFeedItem(subject, parseResult['warning'], site['uri'], 0))
                 else:
@@ -291,13 +300,18 @@ def pollWebsites():
                         fileContents = getFileContents(site['shortname'])
                         i = 0
                         for content in parseResult['contents']:
+                                if config.maxMailsPerSession != -1 and mailsSent >= config.maxMailsPerSession:
+                                        break
+
                                 if content not in fileContents:
                                         changes += 1
+                                        sessionContents.append(content)
 
                                         subject = '[' + site['shortname'] + '] ' + parseResult['titles'][i]
                                         print('    ' + subject)
                                         if config.enableMailNotifications and len(fileContents) > 0:
                                                 sendmail(receiver, subject, content, (site.get('type', 'html') == 'html'), site['uri'])
+                                                mailsSent = mailsSent + 1
 
                                         if config.enableRSSFeed:
                                                 feedXML.xpath('//channel')[0].append(genFeedItem(subject, content, site['uri'], changes))
@@ -305,7 +319,7 @@ def pollWebsites():
 
 
                         if changes > 0:
-                                storeFileContents(site['shortname'], parseResult)
+                                storeFileContents(site['shortname'], sessionContents)
                                 print('        ' + str(changes) + ' updates')
  
         # store feed
@@ -343,6 +357,7 @@ if __name__ == "__main__":
                         if site['shortname'] == dryrun:
                                 parseResult = parseSite(site)
                                 print(parseResult)
+                                print(str(len(parseResult['contents'])) + " results")
                                 break
         else:
                 try:
-- 
cgit v1.2.3


From e121929e4aca8e1ce8167d5c7e0661ac48d6327d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= 
Date: Sun, 6 Aug 2017 19:55:54 +0200
Subject: New upstream release

---
 debian/changelog | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 48ee0e8..44b9c3b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-mwc (1.7.5-1) UNRELEASED; urgency=medium
+mwc (1.7.6-1) UNRELEASED; urgency=medium
 
   * New upstream release.
   * Renumbering patches.
@@ -13,7 +13,7 @@ mwc (1.7.5-1) UNRELEASED; urgency=medium
   * debian/copyright:
     - Refresh copyright year at * and debian/*.
 
- -- Jörg Frings-Fürst   Tue, 18 Apr 2017 11:06:04 +0200
+ -- Jörg Frings-Fürst   Sun, 06 Aug 2017 19:52:54 +0200
 
 mwc (1.7.2-3) unstable; urgency=medium
 
-- 
cgit v1.2.3


From 2aa6f5ebd42d98f0d9a3b7d94076ac9b6ee1ba45 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= 
Date: Sun, 6 Aug 2017 20:16:36 +0200
Subject: New README.source to explain the branching model used; Declare
 compliance with Debian Policy 4.0.0

---
 .pc/.dpkg-source-unapply |  0
 .pc/.quilt_patches       |  1 +
 .pc/.quilt_series        |  1 +
 .pc/.version             |  1 +
 debian/README.source     | 18 ++++++++++++++++++
 debian/changelog         |  3 ++-
 debian/control           |  2 +-
 7 files changed, 24 insertions(+), 2 deletions(-)
 create mode 100644 .pc/.dpkg-source-unapply
 create mode 100644 .pc/.quilt_patches
 create mode 100644 .pc/.quilt_series
 create mode 100644 .pc/.version
 create mode 100644 debian/README.source

diff --git a/.pc/.dpkg-source-unapply b/.pc/.dpkg-source-unapply
new file mode 100644
index 0000000..e69de29
diff --git a/.pc/.quilt_patches b/.pc/.quilt_patches
new file mode 100644
index 0000000..6857a8d
--- /dev/null
+++ b/.pc/.quilt_patches
@@ -0,0 +1 @@
+debian/patches
diff --git a/.pc/.quilt_series b/.pc/.quilt_series
new file mode 100644
index 0000000..c206706
--- /dev/null
+++ b/.pc/.quilt_series
@@ -0,0 +1 @@
+series
diff --git a/.pc/.version b/.pc/.version
new file mode 100644
index 0000000..0cfbf08
--- /dev/null
+++ b/.pc/.version
@@ -0,0 +1 @@
+2
diff --git a/debian/README.source b/debian/README.source
new file mode 100644
index 0000000..e4f2b3d
--- /dev/null
+++ b/debian/README.source
@@ -0,0 +1,18 @@
+Hello,
+
+now I use the branching model from Vincent Driessen[1].
+
+I use the gitflow-avh[2]. with the Documentation[3].
+The Debian package can be found here[4].
+
+Please upload unattended uploads use a branch feature/.
+
+
+Many thanks.
+
+ -- Jörg Frings-Fürst   Fri, 02 Jun 2017 19:00:40 +0200
+
+[1] http://nvie.com/posts/a-successful-git-branching-model/
+[2] https://github.com/petervanderdoes/gitflow-avh
+[3] https://github.com/petervanderdoes/gitflow-avh/wiki
+[4] https://tracker.debian.org/pkg/git-flow
diff --git a/debian/changelog b/debian/changelog
index 44b9c3b..18767a8 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -5,13 +5,14 @@ mwc (1.7.6-1) UNRELEASED; urgency=medium
   * debian/patches/0105-try_mail.diff:
     - Replace undefined printf with print (Closes: #860494).
   * Rewrite debian/watch for archives without "v" in front of the version.
-  * Bump Standards-Version to 3.9.8.
+  * Declare compliance with Debian Policy 4.0.0. (No changes needed).
   * Bump compatlevel to 10 (no changes required):
     - Change debian/compat to 10.
     - At debian/control change requested version of debhelper to >= 10.
   * At debian/control change Vcs-Browser to secure URI.
   * debian/copyright:
     - Refresh copyright year at * and debian/*.
+  * New README.source to explain the branching model used.
 
  -- Jörg Frings-Fürst   Sun, 06 Aug 2017 19:52:54 +0200
 
diff --git a/debian/control b/debian/control
index 70dd2d3..f38df7d 100644
--- a/debian/control
+++ b/debian/control
@@ -6,7 +6,7 @@ Build-Depends:
  debhelper (>= 10),
  dh-python,
  python3-all
-Standards-Version: 3.9.8
+Standards-Version: 4.0.0
 Homepage: https://github.com/Debianguru/MailWebsiteChanges
 Vcs-Git: git://anonscm.debian.org/collab-maint/mwc.git
 Vcs-Browser: https://anonscm.debian.org/cgit/collab-maint/mwc.git
-- 
cgit v1.2.3


From 6c03e9d2fa808b9c5a223c4d01f4d0b848fe97f1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= 
Date: Sun, 6 Aug 2017 20:17:43 +0200
Subject: Add .pc to .gitignore

---
 .gitignore               | 1 +
 .pc/.dpkg-source-unapply | 0
 .pc/.quilt_patches       | 1 -
 .pc/.quilt_series        | 1 -
 .pc/.version             | 1 -
 5 files changed, 1 insertion(+), 3 deletions(-)
 delete mode 100644 .pc/.dpkg-source-unapply
 delete mode 100644 .pc/.quilt_patches
 delete mode 100644 .pc/.quilt_series
 delete mode 100644 .pc/.version

diff --git a/.gitignore b/.gitignore
index 4ccd411..f945b3b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,4 +4,5 @@
 /*.txt
 *~
 *.pyc
+.pc
 
diff --git a/.pc/.dpkg-source-unapply b/.pc/.dpkg-source-unapply
deleted file mode 100644
index e69de29..0000000
diff --git a/.pc/.quilt_patches b/.pc/.quilt_patches
deleted file mode 100644
index 6857a8d..0000000
--- a/.pc/.quilt_patches
+++ /dev/null
@@ -1 +0,0 @@
-debian/patches
diff --git a/.pc/.quilt_series b/.pc/.quilt_series
deleted file mode 100644
index c206706..0000000
--- a/.pc/.quilt_series
+++ /dev/null
@@ -1 +0,0 @@
-series
diff --git a/.pc/.version b/.pc/.version
deleted file mode 100644
index 0cfbf08..0000000
--- a/.pc/.version
+++ /dev/null
@@ -1 +0,0 @@
-2
-- 
cgit v1.2.3