def screen_data(self, defrag=False):
status = self.status
text = Fore.WHITE
text += term.bold('Pyflix\n\n')
text += STATES[status.state]
text += term.yellow(' %.2f%% complete ' % (status.progress * 100))
rates = self.rates()
rate_text = '(down: %.1f kB/s up: %.1f kB/s peers: %d)\n' % \
(rates[0], rates[1], status.num_peers)
text += term.green(rate_text)
if defrag:
text += self.defrag()
text += Fore.WHITE
text += "\n\n"
if self._video_file is not None:
text += term.white("Serving ")
text += term.yellow(self.video_file[0])
text += term.white(" on ")
text += term.blue("http://localhost:%s\n") % self.port
text += term.white("Elapsed Time: ")
text += term.red(self.elapsed_time())
text += "\n"
return text
评论列表
文章目录