MCPcopy Create free account
hub / github.com/pyload/pyload / _progress

Method _progress

module/plugins/hoster/YoutubeCom.py:206–231  ·  view source on GitHub ↗
(self, process, duration)

Source from the content-addressed store, hash-verified

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
234class YoutubeCom(Hoster):

Callers 1

runMethod · 0.95

Calls 3

setProgressMethod · 0.80
readMethod · 0.45
searchMethod · 0.45

Tested by

no test coverage detected