OLD | NEW |
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-2013 Eyeo GmbH | 4 # Copyright (C) 2006-2013 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 if match: | 142 if match: |
143 if match.group(1) == "Fennec": | 143 if match.group(1) == "Fennec": |
144 return "Firefox Mobile", match.group(2) | 144 return "Firefox Mobile", match.group(2) |
145 else: | 145 else: |
146 return match.group(1), match.group(2) | 146 return match.group(1), match.group(2) |
147 | 147 |
148 match = re.search(r"\bFirefox/(\d+\.\d+)", ua) | 148 match = re.search(r"\bFirefox/(\d+\.\d+)", ua) |
149 if match: | 149 if match: |
150 if re.search(r"\bMobile;", ua): | 150 if re.search(r"\bMobile;", ua): |
151 return "Firefox Mobile", match.group(1) | 151 return "Firefox Mobile", match.group(1) |
| 152 elif re.search(r"\bTablet;", ua): |
| 153 return "Firefox Tablet", match.group(1) |
152 else: | 154 else: |
153 return "Firefox", match.group(1) | 155 return "Firefox", match.group(1) |
154 | 156 |
155 match = re.search(r"\brv:(\d+)\.(\d+)(?:\.(\d+))?", ua) | 157 match = re.search(r"\brv:(\d+)\.(\d+)(?:\.(\d+))?", ua) |
156 if match and re.search(r"\bGecko/", ua): | 158 if match and re.search(r"\bGecko/", ua): |
157 if match.group(3) and int(match.group(1)) < 2: | 159 if match.group(3) and int(match.group(1)) < 2: |
158 return "Gecko", "%s.%s.%s" % (match.group(1), match.group(2), match.group(
3)) | 160 return "Gecko", "%s.%s.%s" % (match.group(1), match.group(2), match.group(
3)) |
159 else: | 161 else: |
160 return "Gecko", "%s.%s" % (match.group(1), match.group(2)) | 162 return "Gecko", "%s.%s" % (match.group(1), match.group(2)) |
161 | 163 |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 parser.add_argument("mirror_name", nargs="?", help="Name of the mirror server
that the file belongs to") | 534 parser.add_argument("mirror_name", nargs="?", help="Name of the mirror server
that the file belongs to") |
533 parser.add_argument("server_type", nargs="?", help="Server type like download,
update or subscription") | 535 parser.add_argument("server_type", nargs="?", help="Server type like download,
update or subscription") |
534 parser.add_argument("log_file", nargs="?", help="Log file path, can be a local
file path, http:// or ssh:// URL") | 536 parser.add_argument("log_file", nargs="?", help="Log file path, can be a local
file path, http:// or ssh:// URL") |
535 args = parser.parse_args() | 537 args = parser.parse_args() |
536 | 538 |
537 if args.mirror_name and args.server_type and args.log_file: | 539 if args.mirror_name and args.server_type and args.log_file: |
538 sources = [(args.mirror_name, args.server_type, args.log_file)] | 540 sources = [(args.mirror_name, args.server_type, args.log_file)] |
539 else: | 541 else: |
540 sources = get_stats_files() | 542 sources = get_stats_files() |
541 parse_sources(sources, args.factor, args.verbose) | 543 parse_sources(sources, args.factor, args.verbose) |
OLD | NEW |