| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 | 2 |
| 3 # This file is part of Adblock Plus <https://adblockplus.org/>, | 3 # This file is part of Adblock Plus <https://adblockplus.org/>, |
| 4 # Copyright (C) 2006-present eyeo GmbH | 4 # Copyright (C) 2006-present 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, |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 cwd=config['abp2blocklist_path'], | 76 cwd=config['abp2blocklist_path'], |
| 77 stdin=subprocess.PIPE, stdout=subprocess.PIPE) | 77 stdin=subprocess.PIPE, stdout=subprocess.PIPE) |
| 78 threading.Thread(target=pipe_in, args=(process, filter_lists)).start() | 78 threading.Thread(target=pipe_in, args=(process, filter_lists)).start() |
| 79 block_list['rules'] = json.load(process.stdout) | 79 block_list['rules'] = json.load(process.stdout) |
| 80 if process.wait(): | 80 if process.wait(): |
| 81 raise Exception('abp2blocklist returned %s' % process.returncode) | 81 raise Exception('abp2blocklist returned %s' % process.returncode) |
| 82 | 82 |
| 83 with open(path, 'wb') as destination_file: | 83 with open(path, 'wb') as destination_file: |
| 84 json.dump(block_list, destination_file, indent=2, separators=(',', ': ')
) | 84 json.dump(block_list, destination_file, indent=2, separators=(',', ': ')
) |
| 85 | 85 |
| 86 |
| 86 if __name__ == '__main__': | 87 if __name__ == '__main__': |
| 87 update_abp2blocklist() | 88 update_abp2blocklist() |
| 88 | 89 |
| 89 easylist = download_filter_list(config['easylist_url']) | 90 easylist = download_filter_list(config['easylist_url']) |
| 90 exceptionrules = download_filter_list(config['exceptionrules_url']) | 91 exceptionrules = download_filter_list(config['exceptionrules_url']) |
| 91 | 92 |
| 92 write_block_list([easylist], | 93 write_block_list([easylist], |
| 93 config['easylist_content_blocker_path'], | 94 config['easylist_content_blocker_path'], |
| 94 config['easylist_content_blocker_expires']) | 95 config['easylist_content_blocker_expires']) |
| 95 write_block_list([easylist, exceptionrules], | 96 write_block_list([easylist, exceptionrules], |
| 96 config['combined_content_blocker_path'], | 97 config['combined_content_blocker_path'], |
| 97 config['combined_content_blocker_expires']) | 98 config['combined_content_blocker_expires']) |
| OLD | NEW |