Allegato "newsletter-dev.py"
Scarica 1 #!/usr/bin/env python
2 # newsletter.py
3 #
4 # Copyright (C) 2008 Luca Falavigna
5 #
6 # Author: Luca Falavigna <dktrkranz@ubuntu.com>
7 #
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; version 3 of the License.
11 #
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
16 #
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
20
21 from datetime import datetime
22 from re import split, findall, DOTALL
23 from urllib2 import Request, urlopen
24
25 uploaders = dict()
26 months = {'Jan': 1, 'Feb': 2, 'Mar': 3, 'Apr': 4, 'May': 5, 'Jun': 6, 'Jul': 7, 'Aug': 8, 'Sep': 9, 'Oct': 10, 'Nov': 11, 'Dec': 12}
27 start = datetime(2011, 10, 31) # Works since 22/09/2008 only, for older packages please use revno 7
28 stop = datetime(2011, 11, 6) # Works since 22/09/2008 only, for older packages please use revno 7
29 italianuploaders = ('Paolo Rotolo',
30 'Riccardo Coccioli',
31 'Andrea Colangelo',
32 'Matthew East',
33 'Luca Falavigna',
34 'Devid Filoni',
35 'Devid Antonio Filoni',
36 'Andrea Gasparini',
37 'Alessandro Ghersi',
38 'Paolo Naldini',
39 'Salvatore Palma',
40 'Lorenzo De Liso',
41 'Alessio Treglia',
42 'Leo Iannacone',
43 'Paolo Sammicheli')
44 distros = ('precise',
45 'oneiric',
46 'natty',
47 'maverick',
48 'lucid')
49
50 def get_pkgs(pkg):
51 pkglist = findall('\s+\S+\s+(\S+)\s+(\d+)\s+[\d+\:]+\s+(\d+).*Source: (\S+).*Version: (\S+).*Distribution: (\S+).*Changed-By: ([\w\s]+) <', pkg, DOTALL)
52 for italianuploader in italianuploaders:
53 for pkg in pkglist:
54 if pkg[6] == italianuploader:
55 now = datetime(int(pkg[2]), months[pkg[0]], int(pkg[1]))
56 if now >= start and now <= stop:
57 if not uploaders.has_key(italianuploader):
58 uploaders[pkg[6]] = list()
59 uploaders[pkg[6]].append(' * [https://launchpad.net/ubuntu/%s/+source/%s/%s %s %s], per %s' \
60 % (pkg[5], pkg[3], pkg[4], pkg[3], pkg[4], pkg[5]))
61
62 for distro in distros:
63 req = Request('https://lists.ubuntu.com/archives/%s-changes.mbox/%s-changes.mbox' % (distro, distro))
64 req.add_header('Referer', 'https://lists.ubuntu.com/')
65 data = urlopen(req).read()
66 for rawpkg in split('From bounces@', data):
67 get_pkgs(rawpkg)
68 for uploader in uploaders.keys():
69 print '\n=== %s ===\n' % uploader
70 for pkg in uploaders[uploader]:
71 print pkg
Allegati
Per riferirsi agli allegati di una pagina, usare attachment:NOME_FILE, come mostrato qui sotto nell'elenco degli allegati. NON usare l'URL che si trova in corrispondenza del collegamento [scarica], potrebbe cambiare in futuro.Non รจ consentito inserire allegati su questa pagina.