Skip to content

Commit

Permalink
Minor Code change
Browse files Browse the repository at this point in the history
Signed-off-by: Victor Otieno Omondi <[email protected]>
  • Loading branch information
vickz84259 committed Jul 20, 2015
1 parent e686faf commit 312c026
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions scripts/download_xkcd.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
# download_xkcd.py - Downloads comics from xkcd.com.

__author__ = 'Victor Otieno Omondi'
__version__ = '2.0.1-alpha'
__version__ = '2.1.1-alpha'

# Standard library modules
import logging
import Queue
import time

# Third-Party modules
import requests
Expand All @@ -16,8 +17,8 @@
import argument
import workers

url_workers = 4
download_workers = 6
url_workers = 10
download_workers = 8

url_queue = Queue.Queue()
download_queue = Queue.Queue()
Expand Down Expand Up @@ -69,7 +70,8 @@ def main():

except Exception, e:
logger.exception('There was a problem: {}'.format(str(e)))
print 'Error logged.'
print e
print 'Error logged'


def download_comic(path, start=1, end=0):
Expand Down Expand Up @@ -99,6 +101,8 @@ def download_comic(path, start=1, end=0):
for i in range(start, end):
url_queue.put('http://xkcd.com/{}/info.0.json'.format(i))

time.sleep(5)

for i in range(download_workers):
t = workers.DownloadWorker(path, download_queue)
t.setDaemon(True)
Expand Down

0 comments on commit 312c026

Please sign in to comment.