Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(164)

Side by Side Diff: build/android/screenshot.py

Issue 1315743004: [Android] Add a custom pylintrc for build/android/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix appurify_sanitized import-errors Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « build/android/pylintrc ('k') | build/android/symbolize.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 2
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """Takes a screenshot or a screen video capture from an Android device.""" 7 """Takes a screenshot or a screen video capture from an Android device."""
8 8
9 import logging 9 import logging
10 import optparse 10 import optparse
11 import os 11 import os
12 import sys 12 import sys
13 13
14 from devil.android import device_blacklist 14 from devil.android import device_blacklist
15 from devil.android import device_errors 15 from devil.android import device_errors
16 from devil.android import device_utils 16 from devil.android import device_utils
17 from pylib import screenshot 17 from pylib import screenshot
18 18
19 def _PrintMessage(heading, eol='\n'): 19 def _PrintMessage(heading, eol='\n'):
20 sys.stdout.write('%s%s' % (heading, eol)) 20 sys.stdout.write('%s%s' % (heading, eol))
21 sys.stdout.flush() 21 sys.stdout.flush()
22 22
23 23
24 def _CaptureScreenshot(device, host_file): 24 def _CaptureScreenshot(device, host_file):
25 host_file = device.TakeScreenshot(host_file) 25 host_file = device.TakeScreenshot(host_file)
26 _PrintMessage('Screenshot written to %s' % os.path.abspath(host_file)) 26 _PrintMessage('Screenshot written to %s' % os.path.abspath(host_file))
27 27
28 28
29 def _CaptureVideo(device, host_file, options): 29 def _CaptureVideo(device, host_file, options):
30 size = tuple(map(int, options.size.split('x'))) if options.size else None 30 size = (tuple(int(i) for i in options.size.split('x')) if options.size
31 else None)
31 recorder = screenshot.VideoRecorder(device, 32 recorder = screenshot.VideoRecorder(device,
32 megabits_per_second=options.bitrate, 33 megabits_per_second=options.bitrate,
33 size=size, 34 size=size,
34 rotate=options.rotate) 35 rotate=options.rotate)
35 try: 36 try:
36 recorder.Start() 37 recorder.Start()
37 _PrintMessage('Recording. Press Enter to stop...', eol='') 38 _PrintMessage('Recording. Press Enter to stop...', eol='')
38 raw_input() 39 raw_input()
39 finally: 40 finally:
40 recorder.Stop() 41 recorder.Stop()
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 97
97 if options.video: 98 if options.video:
98 _CaptureVideo(device, host_file, options) 99 _CaptureVideo(device, host_file, options)
99 else: 100 else:
100 _CaptureScreenshot(device, host_file) 101 _CaptureScreenshot(device, host_file)
101 return 0 102 return 0
102 103
103 104
104 if __name__ == '__main__': 105 if __name__ == '__main__':
105 sys.exit(main()) 106 sys.exit(main())
OLDNEW
« no previous file with comments | « build/android/pylintrc ('k') | build/android/symbolize.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698