| Left: | ||
| Right: |
| 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-2014 Eyeo GmbH | 4 # Copyright (C) 2006-2014 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 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 421 else: | 421 else: |
| 422 ignored.add(info["file"]) | 422 ignored.add(info["file"]) |
| 423 return None | 423 return None |
| 424 | 424 |
| 425 if "addonName" in info: | 425 if "addonName" in info: |
| 426 info["fullAddon"] = "%s %s" % (info["addonName"], info["addonVersion"]) | 426 info["fullAddon"] = "%s %s" % (info["addonName"], info["addonVersion"]) |
| 427 if "application" in info: | 427 if "application" in info: |
| 428 info["fullApplication"] = "%s %s" % (info["application"], info["applicationV ersion"]) | 428 info["fullApplication"] = "%s %s" % (info["application"], info["applicationV ersion"]) |
| 429 if "platform" in info: | 429 if "platform" in info: |
| 430 info["fullPlatform"] = "%s %s" % (info["platform"], info["platformVersion"]) | 430 info["fullPlatform"] = "%s %s" % (info["platform"], info["platformVersion"]) |
| 431 | |
|
Felix Dahlke
2014/05/22 08:30:38
Unrelated whitespace change?
Sebastian Noack
2014/05/22 08:40:39
Done.
| |
| 432 return info | 431 return info |
| 433 | 432 |
| 434 def add_record(info, section, ignore_fields=()): | 433 def add_record(info, section, ignore_fields=()): |
| 435 section["hits"] = section.get("hits", 0) + 1 | 434 section["hits"] = section.get("hits", 0) + 1 |
| 436 section["bandwidth"] = section.get("bandwidth", 0) + info["size"] | 435 section["bandwidth"] = section.get("bandwidth", 0) + info["size"] |
| 437 | 436 |
| 438 if len(ignore_fields) < 2: | 437 if len(ignore_fields) < 2: |
| 439 for field in map(lambda f: f["name"], common.fields): | 438 for field in map(lambda f: f["name"], common.fields): |
| 440 if field in ignore_fields or field not in info: | 439 if field in ignore_fields or field not in info: |
| 441 continue | 440 continue |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 546 parser.add_argument("mirror_name", nargs="?", help="Name of the mirror server that the file belongs to") | 545 parser.add_argument("mirror_name", nargs="?", help="Name of the mirror server that the file belongs to") |
| 547 parser.add_argument("server_type", nargs="?", help="Server type like download, update or subscription") | 546 parser.add_argument("server_type", nargs="?", help="Server type like download, update or subscription") |
| 548 parser.add_argument("log_file", nargs="?", help="Log file path, can be a local file path, http:// or ssh:// URL") | 547 parser.add_argument("log_file", nargs="?", help="Log file path, can be a local file path, http:// or ssh:// URL") |
| 549 args = parser.parse_args() | 548 args = parser.parse_args() |
| 550 | 549 |
| 551 if args.mirror_name and args.server_type and args.log_file: | 550 if args.mirror_name and args.server_type and args.log_file: |
| 552 sources = [(args.mirror_name, args.server_type, args.log_file)] | 551 sources = [(args.mirror_name, args.server_type, args.log_file)] |
| 553 else: | 552 else: |
| 554 sources = get_stats_files() | 553 sources = get_stats_files() |
| 555 parse_sources(sources, args.factor, args.verbose) | 554 parse_sources(sources, args.factor, args.verbose) |
| LEFT | RIGHT |