(self, process, duration)
| 204 | return duration |
| 205 | |
| 206 | def _progress(self, process, duration): |
| 207 | line = "" |
| 208 | last_line = "" |
| 209 | while True: |
| 210 | c = process.stderr.read(1) #: ffmpeg writes to stderr |
| 211 | |
| 212 | #: Quit loop on eof |
| 213 | if not c: |
| 214 | break |
| 215 | |
| 216 | elif c == "\r": |
| 217 | last_line = line.strip('\r\n') |
| 218 | line = "" |
| 219 | m = self._RE_TIME.search(last_line) |
| 220 | if m is not None: |
| 221 | current_time = sum(int(v) * [60 * 60 * 100, 60 * 100, 100, 1][i] |
| 222 | for i, v in enumerate(m.groups())) |
| 223 | if self.plugin: |
| 224 | progress = current_time * 100 / duration |
| 225 | self.plugin.pyfile.setProgress(progress) |
| 226 | |
| 227 | else: |
| 228 | line += c |
| 229 | continue |
| 230 | |
| 231 | return last_line #: Last line may contain error message |
| 232 | |
| 233 | |
| 234 | class YoutubeCom(Hoster): |
no test coverage detected