OLD | NEW |
1 # This file is part of the Adblock Plus web scripts, | 1 # This file is part of the Adblock Plus web scripts, |
2 # Copyright (C) 2006-present eyeo GmbH | 2 # Copyright (C) 2006-present eyeo GmbH |
3 # | 3 # |
4 # Adblock Plus is free software: you can redistribute it and/or modify | 4 # Adblock Plus is free software: you can redistribute it and/or modify |
5 # it under the terms of the GNU General Public License version 3 as | 5 # it under the terms of the GNU General Public License version 3 as |
6 # published by the Free Software Foundation. | 6 # published by the Free Software Foundation. |
7 # | 7 # |
8 # Adblock Plus is distributed in the hope that it will be useful, | 8 # Adblock Plus is distributed in the hope that it will be useful, |
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 unaccounted.sort(key=lambda url: counts[url], reverse=True) | 81 unaccounted.sort(key=lambda url: counts[url], reverse=True) |
82 for i in range(0, len(unaccounted)): | 82 for i in range(0, len(unaccounted)): |
83 url = unaccounted[i] | 83 url = unaccounted[i] |
84 mark = ' [?]' | 84 mark = ' [?]' |
85 if url in knownURLs: | 85 if url in knownURLs: |
86 mark = '' | 86 mark = '' |
87 unaccounted[i] = '%5i %s%s' % (counts[url], url, mark) | 87 unaccounted[i] = '%5i %s%s' % (counts[url], url, mark) |
88 | 88 |
89 return (redirects, gone, unaccounted) | 89 return (redirects, gone, unaccounted) |
90 | 90 |
| 91 |
91 if __name__ == '__main__': | 92 if __name__ == '__main__': |
92 setupStderr() | 93 setupStderr() |
93 | 94 |
94 counts = {} | 95 counts = {} |
95 for i in range(1, 15): | 96 for i in range(1, 15): |
96 logPath = os.path.join(get_config().get('logs', 'dataPath'), get_config(
).get('logs', 'fileName') % i) | 97 logPath = os.path.join(get_config().get('logs', 'dataPath'), get_config(
).get('logs', 'fileName') % i) |
97 countSubscriptionRequests(logPath, counts) | 98 countSubscriptionRequests(logPath, counts) |
98 | 99 |
99 (redirects, gone, unaccounted) = loadSubscriptions(counts) | 100 (redirects, gone, unaccounted) = loadSubscriptions(counts) |
100 | 101 |
101 sendMail(get_config().get('subscriptions', 'reportTemplate'), { | 102 sendMail(get_config().get('subscriptions', 'reportTemplate'), { |
102 'redirects': redirects, | 103 'redirects': redirects, |
103 'gone': gone, | 104 'gone': gone, |
104 'unaccounted': unaccounted, | 105 'unaccounted': unaccounted, |
105 }) | 106 }) |
OLD | NEW |