| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 66 def loadSubscriptions(counts): | 66 def loadSubscriptions(counts): | 
| 67     global interval | 67     global interval | 
| 68 | 68 | 
| 69     subscriptions = subscriptionParser.readSubscriptions() | 69     subscriptions = subscriptionParser.readSubscriptions() | 
| 70 | 70 | 
| 71     knownURLs = {} | 71     knownURLs = {} | 
| 72     for subscription in subscriptions.values(): | 72     for subscription in subscriptions.values(): | 
| 73         for title, url, complete in subscription.variants: | 73         for title, url, complete in subscription.variants: | 
| 74             knownURLs[url] = True | 74             knownURLs[url] = True | 
| 75 | 75 | 
| 76     (redirectData, goneData) = subscriptionParser.getFallbackData() | 76     redirectData, goneData = subscriptionParser.getFallbackData() | 
| 77     redirects = processFile(redirectData, counts) | 77     redirects = processFile(redirectData, counts) | 
| 78     gone = processFile(goneData, counts) | 78     gone = processFile(goneData, counts) | 
| 79 | 79 | 
| 80     unaccounted = filter(lambda url: counts[url] >= 10, counts.keys()) | 80     unaccounted = filter(lambda url: counts[url] >= 10, counts.keys()) | 
| 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 | 
| 92 if __name__ == '__main__': | 92 if __name__ == '__main__': | 
| 93     setupStderr() | 93     setupStderr() | 
| 94 | 94 | 
| 95     counts = {} | 95     counts = {} | 
| 96     for i in range(1, 15): | 96     for i in range(1, 15): | 
| 97         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) | 
| 98         countSubscriptionRequests(logPath, counts) | 98         countSubscriptionRequests(logPath, counts) | 
| 99 | 99 | 
| 100     (redirects, gone, unaccounted) = loadSubscriptions(counts) | 100     redirects, gone, unaccounted = loadSubscriptions(counts) | 
| 101 | 101 | 
| 102     sendMail(get_config().get('subscriptions', 'reportTemplate'), { | 102     sendMail(get_config().get('subscriptions', 'reportTemplate'), { | 
| 103         'redirects': redirects, | 103         'redirects': redirects, | 
| 104         'gone': gone, | 104         'gone': gone, | 
| 105         'unaccounted': unaccounted, | 105         'unaccounted': unaccounted, | 
| 106     }) | 106     }) | 
| OLD | NEW | 
|---|