OLD | NEW |
---|---|
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import os | 5 import os |
6 import signal | 6 import signal |
7 import tempfile | 7 import tempfile |
8 import time | |
8 | 9 |
9 from pylib import cmd_helper | 10 from pylib import cmd_helper |
10 | 11 |
11 # TODO(jbudorick) Remove once telemetry gets switched over. | 12 # TODO(jbudorick) Remove once telemetry gets switched over. |
12 import pylib.android_commands | 13 import pylib.android_commands |
13 import pylib.device.device_utils | 14 import pylib.device.device_utils |
14 | 15 |
15 | 16 |
16 class VideoRecorder(object): | 17 class VideoRecorder(object): |
17 """Records a screen capture video from an Android Device (KitKat or newer). | 18 """Records a screen capture video from an Android Device (KitKat or newer). |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
75 self._recorder.wait() | 76 self._recorder.wait() |
76 | 77 |
77 def Pull(self, host_file=None): | 78 def Pull(self, host_file=None): |
78 """Pull resulting video file from the device. | 79 """Pull resulting video file from the device. |
79 | 80 |
80 Args: | 81 Args: |
81 host_file: Path to the video file to store on the host. | 82 host_file: Path to the video file to store on the host. |
82 Returns: | 83 Returns: |
83 Output video file name on the host. | 84 Output video file name on the host. |
84 """ | 85 """ |
85 host_file_name = host_file or ('screen-recording-%s.mp4' % | 86 host_file_name = ( |
86 self._device.old_interface.GetTimestamp()) | 87 host_file |
88 or 'screen-recording-%s.mp4' % time.strftime('%Y%m%dT%H%M%S', | |
perezju
2015/03/30 16:01:17
there is a _GetTimeStamp in device_utils.py, maybe
jbudorick
2015/03/30 16:42:14
Maybe. I'll look at doing that in a separate CL +
| |
89 time.localtime())) | |
87 host_file_name = os.path.abspath(host_file_name) | 90 host_file_name = os.path.abspath(host_file_name) |
88 self._device.old_interface.EnsureHostDirectory(host_file_name) | |
89 self._device.PullFile(self._device_file, host_file_name) | 91 self._device.PullFile(self._device_file, host_file_name) |
90 self._device.RunShellCommand('rm -f "%s"' % self._device_file) | 92 self._device.RunShellCommand('rm -f "%s"' % self._device_file) |
91 return host_file_name | 93 return host_file_name |
OLD | NEW |