Merged
This commit is contained in:
commit
a77b9c9d09
2 changed files with 3 additions and 4 deletions
3
4grab.py
3
4grab.py
|
@ -31,6 +31,7 @@ parser = optparse.OptionParser()
|
||||||
downloader = download.Downloader(progressbar.Progress)
|
downloader = download.Downloader(progressbar.Progress)
|
||||||
|
|
||||||
def walk_with_wizard(baseurl):
|
def walk_with_wizard(baseurl):
|
||||||
|
wzrd_msg = "Pilates! *SHAZAM* Here they come!"
|
||||||
print "Alright, let me put on my robe and wizard hat."
|
print "Alright, let me put on my robe and wizard hat."
|
||||||
|
|
||||||
# Single or all
|
# Single or all
|
||||||
|
@ -48,12 +49,14 @@ def walk_with_wizard(baseurl):
|
||||||
else:
|
else:
|
||||||
thread = inp
|
thread = inp
|
||||||
inp = raw_input("Which category is this thread in? ")
|
inp = raw_input("Which category is this thread in? ")
|
||||||
|
print wzrd_msg
|
||||||
t = downloader.get_image_links("%s%s/res/" % (baseurl, inp), [thread])
|
t = downloader.get_image_links("%s%s/res/" % (baseurl, inp), [thread])
|
||||||
else:
|
else:
|
||||||
inp = raw_input("Which category would you like to download? ")
|
inp = raw_input("Which category would you like to download? ")
|
||||||
config.Configuration().set_category(inp)
|
config.Configuration().set_category(inp)
|
||||||
baseurl = "%s%s/" % (baseurl, config.Configuration().get_category())
|
baseurl = "%s%s/" % (baseurl, config.Configuration().get_category())
|
||||||
|
|
||||||
|
print wzrd_msg
|
||||||
t = downloader.get_thread_links(baseurl)
|
t = downloader.get_thread_links(baseurl)
|
||||||
t = downloader.get_image_links(baseurl, t)
|
t = downloader.get_image_links(baseurl, t)
|
||||||
(skipped, failed, downloaded, total) = downloader.get_images(t)
|
(skipped, failed, downloaded, total) = downloader.get_images(t)
|
||||||
|
|
|
@ -36,17 +36,13 @@ class Progress():
|
||||||
def show_progress(self, value):
|
def show_progress(self, value):
|
||||||
str_value = str(value)
|
str_value = str(value)
|
||||||
str_maxvalue = str(self.maxvalue)
|
str_maxvalue = str(self.maxvalue)
|
||||||
#true_maxwidth = self.maxwidth - 4 - len(str_value) - len(str_maxvalue)
|
|
||||||
true_maxwidth = self.__get_true_maxwidth(len(str_value), len(str_maxvalue))
|
true_maxwidth = self.__get_true_maxwidth(len(str_value), len(str_maxvalue))
|
||||||
#print true_maxwidth, ":", self.maxvalue, ":", value # for debugging purposes
|
|
||||||
|
|
||||||
if self.maxvalue == 0:
|
if self.maxvalue == 0:
|
||||||
progress = true_maxwidth
|
progress = true_maxwidth
|
||||||
else:
|
else:
|
||||||
progress = int(round((true_maxwidth/float(self.maxvalue))*value))
|
progress = int(round((true_maxwidth/float(self.maxvalue))*value))
|
||||||
|
|
||||||
#self.fd.write("\r%s/%s [%s%s]" % (str_value, str_maxvalue, self.prog_char * progress, self.fill_char * (true_maxwidth - progress)))
|
|
||||||
#self.fd.flush()
|
|
||||||
self.__write_progress(str_value, str_maxvalue, progress, true_maxwidth)
|
self.__write_progress(str_value, str_maxvalue, progress, true_maxwidth)
|
||||||
|
|
||||||
def __write_progress(self, str_value, str_maxvalue, progress, true_maxwidth):
|
def __write_progress(self, str_value, str_maxvalue, progress, true_maxwidth):
|
||||||
|
|
Loading…
Reference in a new issue