Skip to content
This repository has been archived by the owner on Sep 29, 2019. It is now read-only.

don't download the file which exist #7

Merged
merged 3 commits into from
May 23, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions driveit.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from base import SharedBase

import os

def main_loop(ref_box):
for ref_tuple in ref_box:
Expand All @@ -8,8 +8,11 @@ def main_loop(ref_box):
for page in range(1, total_page + 1):
link = website_object.get_image_link(parent_link, page)
try:
website_object.down(comic_name, parent_link, link, parent_title, page)
print('%s page %d has been downloaded successfully' % (parent_title, page))
if os.path.exists(base.get_path(comic_name, parent_title, page, 'jpg')):
print('%s page %d has been downloaded before' % (parent_title, page))
else:
website_object.down(comic_name, parent_link, link, parent_title, page)
print('%s page %d has been downloaded successfully' % (parent_title, page))
except:
print('Error occurred when downloading %s, Page %d.' % (parent_title, page))

Expand Down
11 changes: 1 addition & 10 deletions sites.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,22 +65,13 @@ def get_name(self):

def get_parent_info(self):
ref_box = []
soup_box = self.flyleaf_soup.findAll('ul', {'class': 'nr6 lan2', 'id': 'cbc_1'})
soup_box = self.flyleaf_soup.findAll('ul', {'class': 'nr6 lan2'})
for border in soup_box:
for li in border.findAll('li'):
if li.a.has_attr('title'):
ref_link = li.a['href']
ref_title = li.a['title']
print(ref_link,ref_title)
ref_box.insert(0, (ref_title, ref_link))
soup_box = self.flyleaf_soup.findAll('ul', {'class': 'nr6 lan2', 'id': 'cbc_2'})
for border in soup_box:
for li in border.findAll('li'):
if li.a.has_attr('title'):
ref_link = li.a['href']
ref_title = li.a['title']
print(ref_link,ref_title)
ref_box.insert(0, (ref_title, ref_link))
return ref_box

def get_page_info(self, parent_link):
Expand Down