| LEFT | RIGHT |
| 1 # coding: utf-8 | 1 # coding: utf-8 |
| 2 | 2 |
| 3 # This file is part of the Adblock Plus web scripts, | 3 # This file is part of the Adblock Plus web scripts, |
| 4 # Copyright (C) 2006-2015 Eyeo GmbH | 4 # Copyright (C) 2006-2015 Eyeo GmbH |
| 5 # | 5 # |
| 6 # Adblock Plus is free software: you can redistribute it and/or modify | 6 # Adblock Plus is free software: you can redistribute it and/or modify |
| 7 # it under the terms of the GNU General Public License version 3 as | 7 # it under the terms of the GNU General Public License version 3 as |
| 8 # published by the Free Software Foundation. | 8 # published by the Free Software Foundation. |
| 9 # | 9 # |
| 10 # Adblock Plus is distributed in the hope that it will be useful, | 10 # Adblock Plus is distributed in the hope that it will be useful, |
| 11 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 # GNU General Public License for more details. | 13 # GNU General Public License for more details. |
| 14 # | 14 # |
| 15 # You should have received a copy of the GNU General Public License | 15 # You should have received a copy of the GNU General Public License |
| 16 # along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 16 # along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
| 17 | 17 |
| 18 import codecs | 18 import codecs |
| 19 import json | 19 import json |
| 20 import time |
| 20 | 21 |
| 21 from sitescripts.notifications.parser import load_notifications | 22 from sitescripts.notifications.parser import load_notifications |
| 22 from sitescripts.utils import get_config, setupStderr | 23 from sitescripts.utils import get_config, setupStderr |
| 23 | 24 |
| 24 def generate_notifications(path): | 25 def generate_notifications(path): |
| 25 notifications = load_notifications() | 26 notifications = load_notifications() |
| 27 output = { |
| 28 "notifications": notifications, |
| 29 "version": time.strftime("%Y%m%d%H%M", time.gmtime()) |
| 30 } |
| 26 with codecs.open(path, "wb", encoding="utf-8") as file: | 31 with codecs.open(path, "wb", encoding="utf-8") as file: |
| 27 json.dump(notifications, file, ensure_ascii=False, indent=2, | 32 json.dump(output, file, ensure_ascii=False, indent=2, |
| 28 separators=(',', ': '), sort_keys=True) | 33 separators=(',', ': '), sort_keys=True) |
| 29 | 34 |
| 30 if __name__ == "__main__": | 35 if __name__ == "__main__": |
| 31 setupStderr() | 36 setupStderr() |
| 32 output = get_config().get("notifications", "output") | 37 output = get_config().get("notifications", "output") |
| 33 generate_notifications(output) | 38 generate_notifications(output) |
| LEFT | RIGHT |