Skip to content

Commit

Permalink
update #807
Browse files Browse the repository at this point in the history
add new config `checkLastModified` in `[DownloadControl]` section to compare last-modified time with works date, require setlastmodified = True in config.ini to work properly.
  • Loading branch information
Nandaka committed Oct 19, 2020
1 parent 1811610 commit afc0bfc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions PixivConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ class PixivConfig():
ConfigItem("DownloadControl", "enableInfiniteLoop", False),
ConfigItem("DownloadControl", "useBlacklistMembers", False),
ConfigItem("DownloadControl", "downloadResized", False),
ConfigItem("DownloadControl", "checkLastModified", True),
]

proxy = {"http": "", "https": "", }
Expand Down
8 changes: 8 additions & 0 deletions PixivDownloadHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@ def download_image(caller,
PixivHelper.print_and_log('info', f"\rLocal file exists: {filename}")
return (PixivConstant.PIXIVUTIL_SKIP_DUPLICATE, filename_save)

# Issue #807
if config.checkLastModified and os.path.isfile(filename_save) and image is not None:
local_timestamp = os.path.getmtime(filename_save)
remote_timestamp = time.mktime(image.worksDateDateTime.timetuple())
if local_timestamp == remote_timestamp:
PixivHelper.print_and_log('info', f"\rLocal file timestamp match with remote: {filename} => {image.worksDateDateTime}")
return (PixivConstant.PIXIVUTIL_SKIP_DUPLICATE, filename_save)

remote_file_size = get_remote_filesize(url, referer, config, notifier)

# 576
Expand Down

0 comments on commit afc0bfc

Please sign in to comment.