OLD | NEW |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Archives or replays webpages and creates SKPs in a Google Storage location. | 6 """Archives or replays webpages and creates SKPs in a Google Storage location. |
7 | 7 |
8 To archive webpages and store SKP files (archives should be rarely updated): | 8 To archive webpages and store SKP files (archives should be rarely updated): |
9 | 9 |
10 cd skia | 10 cd skia |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
381 # skia_yahooanswers_desktop -> skia, yahooanswers, desktop | 381 # skia_yahooanswers_desktop -> skia, yahooanswers, desktop |
382 _, page_name, device = ps_basename.split('_') | 382 _, page_name, device = ps_basename.split('_') |
383 basename = '%s_%s' % (DEVICE_TO_PLATFORM_PREFIX[device], page_name) | 383 basename = '%s_%s' % (DEVICE_TO_PLATFORM_PREFIX[device], page_name) |
384 return basename[:MAX_SKP_BASE_NAME_LEN] + '.skp' | 384 return basename[:MAX_SKP_BASE_NAME_LEN] + '.skp' |
385 | 385 |
386 def _GetChromiumSkpFileName(self, page_set, site): | 386 def _GetChromiumSkpFileName(self, page_set, site): |
387 """Returns the SKP file name for Chromium page sets.""" | 387 """Returns the SKP file name for Chromium page sets.""" |
388 # /path/to/http___mobile_news_sandbox_pt0 -> http___mobile_news_sandbox_pt0 | 388 # /path/to/http___mobile_news_sandbox_pt0 -> http___mobile_news_sandbox_pt0 |
389 _, webpage = os.path.split(site) | 389 _, webpage = os.path.split(site) |
390 # http___mobile_news_sandbox_pt0 -> mobile_news_sandbox_pt0 | 390 # http___mobile_news_sandbox_pt0 -> mobile_news_sandbox_pt0 |
391 webpage = webpage.lstrip('http___').lstrip('https___') | 391 if webpage.startswith('http___'): |
392 webpage = webpage[7:] | |
borenet
2015/03/31 15:29:53
I prefer something like this:
prefix = 'http___'
| |
393 elif webpage.startswith('https___'): | |
394 webpage = webpage[8:] | |
392 # /path/to/skia_yahooanswers_desktop.py -> skia_yahooanswers_desktop.py | 395 # /path/to/skia_yahooanswers_desktop.py -> skia_yahooanswers_desktop.py |
393 ps_filename = os.path.basename(page_set) | 396 ps_filename = os.path.basename(page_set) |
394 # http___mobile_news_sandbox -> pagesetprefix_http___mobile_news_sandbox | 397 # http___mobile_news_sandbox -> pagesetprefix_http___mobile_news_sandbox |
395 basename = '%s_%s' % (CHROMIUM_PAGE_SETS_TO_PREFIX[ps_filename], webpage) | 398 basename = '%s_%s' % (CHROMIUM_PAGE_SETS_TO_PREFIX[ps_filename], webpage) |
396 return basename[:MAX_SKP_BASE_NAME_LEN] + '.skp' | 399 return basename[:MAX_SKP_BASE_NAME_LEN] + '.skp' |
397 | 400 |
398 def _RenameSkpFiles(self, page_set): | 401 def _RenameSkpFiles(self, page_set): |
399 """Rename generated SKP files into more descriptive names. | 402 """Rename generated SKP files into more descriptive names. |
400 | 403 |
401 Look into the subdirectory of TMP_SKP_DIR and find the most interesting | 404 Look into the subdirectory of TMP_SKP_DIR and find the most interesting |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
550 default=None) | 553 default=None) |
551 option_parser.add_option( | 554 option_parser.add_option( |
552 '', '--non-interactive', action='store_true', | 555 '', '--non-interactive', action='store_true', |
553 help='Runs the script without any prompts. If this flag is specified and ' | 556 help='Runs the script without any prompts. If this flag is specified and ' |
554 '--skia_tools is specified then the debugger is not run.', | 557 '--skia_tools is specified then the debugger is not run.', |
555 default=False) | 558 default=False) |
556 options, unused_args = option_parser.parse_args() | 559 options, unused_args = option_parser.parse_args() |
557 | 560 |
558 playback = SkPicturePlayback(options) | 561 playback = SkPicturePlayback(options) |
559 sys.exit(playback.Run()) | 562 sys.exit(playback.Run()) |
OLD | NEW |