def progress( loaded, total ): global bar_width, increm, start_time progr = int( round( loaded / increm ) ) if increm > 0 else 1 delta = datetime.datetime.now( ) - start_time delta = delta.seconds + delta.microseconds / 1000000 if opts.verbose: print_console( "[{}{}] {} {}/s eta: {}{}".format( "*" * progr, "_" * ( bar_width - progr ), utorrent_module.human_size( total ), utorrent_module.human_size( loaded / delta ), utorrent_module.human_time_delta( ( total - loaded ) / ( loaded / delta ) if loaded > 0 else 0 ), " " * 25 ), sep = "", end = "" ) print_console( "\b" * ( bar_width + 70 ), end = "" ) sys.stdout.flush( )
def fill( self, torrent ): self.hash_code, status, self.name, self.size, progress, self.downloaded, \ self.uploaded, ratio, self.ul_speed, self.dl_speed, self.eta, self.label, \ self.peers_connected, self.peers_total, self.seeds_connected, self.seeds_total, \ self.availability, self.queue_order, self.dl_remain = torrent self._utorrent.check_hash( self.hash_code ) self.progress = progress / 10. self.ratio = ratio / 1000. self.status = TorrentStatus( status, self.progress ) self.size_h = utorrent.human_size( self.size ) self.uploaded_h = utorrent.human_size( self.uploaded ) self.downloaded_h = utorrent.human_size( self.downloaded ) self.ul_speed_h = utorrent.human_size( self.ul_speed ) + "/s" self.dl_speed_h = utorrent.human_size( self.dl_speed ) + "/s" self.eta_h = utorrent.human_time_delta( self.eta ) self.availability_h = self.availability / 65535. self.dl_remain_h = utorrent.human_size( self.dl_remain )
def progress(range_start, loaded, total): global bar_width, tick_size, start_time if range_start is None: range_start = 0 progr = int(round((range_start + loaded) / tick_size)) if tick_size > 0 else 1 delta = datetime.datetime.now() - start_time delta = delta.seconds + delta.microseconds / 1000000 if opts.verbose: print_console("[{}{}] {} {}/s eta: {}{}".format( "*" * progr, "_" * (bar_width - progr), utorrent_module.human_size(total), utorrent_module.human_size(loaded / delta), utorrent_module.human_time_delta( (total - loaded) / (loaded / delta) if loaded > 0 else 0), " " * 25), sep="", end="") print_console("\b" * (bar_width + 70), end="") sys.stdout.flush()
def verbose_str( self ): return str( self ) + " Superseed:{} DHT:{} PEX:{} Queuing override:{} Seed ratio:{} Seed time:{}".format( self._tribool_status_str( self.superseed ), self._tribool_status_str( self.dht ), self._tribool_status_str( self.pex ), self._tribool_status_str( self.seed_override ), self.seed_ratio, utorrent.human_time_delta( self.seed_time ) )