summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFélix Sipma <felix.sipma@no-log.org>2015-11-06 09:00:47 +0100
committerFélix Sipma <felix.sipma@no-log.org>2015-11-06 09:00:47 +0100
commit99f5a5551b1c9cb3ba7fee80a8f10a2dd299f8c7 (patch)
tree63df3298f003a2239c2d3b33a23ac2ed128ddcae
parentf9b9ef82b05a6f1b470c9b9798189901bd54a897 (diff)
improve list name regex
-rwxr-xr-xpipermail_get_archives_mbox.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/pipermail_get_archives_mbox.py b/pipermail_get_archives_mbox.py
index 40e9da6..cf31f9e 100755
--- a/pipermail_get_archives_mbox.py
+++ b/pipermail_get_archives_mbox.py
@@ -7,8 +7,8 @@
# See http://sam.zoy.org/wtfpl/COPYING for more details.
"""
-Download pipermail archives from a given url, uncompress them if necessary, do
-string substitutions so that they could be opened in a mail reader and
+Download pipermail archives from a given url, uncompress them if necessary,
+do string substitutions so that they could be opened in a mail reader and
concatenate the result in a big mylistname_mbox.txt file.
"""
@@ -23,14 +23,14 @@ import tempfile
import shutil
if len(sys.argv) < 2:
- sys.exit('Usage: %(name)s pipermail-url\nExample: %(name)s http://lists.example.com/pipermail/mylist/' % { 'name': sys.argv[0] })
+ sys.exit('Usage: %(name)s pipermail-url\nExample: %(name)s http://lists.example.com/pipermail/mylist/' % {'name': sys.argv[0]})
url = re.sub(r'/$', '', sys.argv[1]) + '/'
try:
- archive = re.match(r'^.*/([\w]+)(/)?$', url).group(1) + "_mbox.txt"
-except AttributeError:
- archive = "pipermail_mbox.txt"
+ archive = re.match(r'^.*\/pipermail\/([a-zA-Z0-9-+._]+)', url).group(1) + ".mbox"
+except AttributeError:
+ archive = "pipermail.mbox"
print "INFO: Output file " + archive