Skip to content

Commit

Permalink
Changed download status messages
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenroy committed Sep 23, 2013
1 parent ef882a4 commit c9a67ef
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions xkcd_downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ def download(self,page_url):
t_path = img_path+".txt"
img_size = int(requests.head(image_url).headers["content-length"])
if os.path.exists(img_path)==False or img_size!=int(os.path.getsize(img_path)):
print_lock.acquire()
print "Downloading",i
print_lock.release()
r = requests.get(image_url,stream = True)
with open(img_path, 'wb') as f:
for chunk in r.iter_content(chunk_size=1024):
if chunk:
f.write(chunk)
f.flush()
print_lock.acquire()
print "Downloaded",i
print_lock.release()
t_size = len(page_dict["transcript"])
if os.path.exists(t_path)==False or t_size!=int(os.path.getsize(t_path)):
f = open(t_path,'w')
Expand Down

0 comments on commit c9a67ef

Please sign in to comment.