DevLog: Download status notification

  • After a bit of work, added a download status notification to trial.py
  • The logic is fairly simple –
  • Get the content size of the file by parsing metadata , something like openedUrl.info() and query for getheaders(“Content-Size”)[0]
  • Returns a dictionary – contaning size of file at [0], Now read the file by temporary blocks of memory
  • say block_size = 1 * 1024 (or if you give 10*1024 its just gona affect your refresh rate or loop cycle rate, no much difference)
  • Now read the contents of file block by block and sum it up in file_size_read, Maybe a buffer = url.read(block_size) will do
  • For every cycle of read loop,  ( file_size_read / file_size )* 100  will furnish me the percentage of file downloaded at every refresh, It’s that simple.
  • So polished it, disintegrated the code into reusable function modules and pushed it up

This can also be named as “How To Get Screwed In Numerical Methods Modal Exam Tomorrow”

Advertisements

Speak:

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s