Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1: Add a parameter to specify whether to download GIFs. 2: Resolve errors when downloading GIFs. #51

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

wohaoeRiver
Copy link

1: Add a download_gif parameter to the PixivSource, allowing to choose whether to download GIFs when using any of the three download methods provided by Pixiv. true indicates download, flase indicates no download
image

2:In the _make_gif_for_ugoira function, adding the ignore_cleanup_errors=True parameter to TemporaryDirectory (defaulting to False) aims to ignore errors that occur during the cleanup of the temporary directory, such as files being in use by other programs and unable to be deleted, thus avoiding raising exceptions. However, this approach may result in files generated during git downloads in the temporary directory not being deleted automatically, requiring manual deletion. [On the issues page, I found that someone raised this question in 23 years, and I read his reply, but I still don't understand the reason for this question UwU. Perhaps in the official version, it's better not to modify the ignore_cleanup_errors parameter of TemporaryDirectory, and instead let the users experiencing the problem modify ignore_cleanup_errors to True and manually delete the files in the temporary directory?### ]

…d gif when downloading images. 2:TemporaryDirectory ignore cleanup errors in _make_gif_for_ugoira (The TemporaryDirectory needs to be manually cleared after it is enabled)
BasePixivSource.__init__(self, group_name, select, no_ai, refresh_token, download_silent)
self.user_id = user_id
self.type = type
self.filter = filter
self.req_auth = req_auth
self.download_gif = download_gif
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better to pass this value at __init__

BasePixivSource.__init__(self, group_name, select, no_ai, refresh_token, download_silent)
self.mode = mode
self.filter = filter
self.date = date
self.req_auth = req_auth
self.download_gif = download_gif
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the same, better to pass it at __init__.

@@ -204,6 +205,7 @@ def __init__(self, word: str, search_target: _SearchTargetTyping = "partial_matc
self.end_date = end_date
self.filter = filter
self.req_auth = req_auth
self.download_gif = download_gif
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better to pass it at __init__

@@ -60,9 +60,10 @@ def _remove_pixiv_json(obj):

class BasePixivSource(WebDataSource):
def __init__(self, group_name: str = 'pixiv', select: _SelectTyping = 'large',
no_ai: bool = False, refresh_token: Optional[str] = None, download_silent: bool = True):
no_ai: bool = False, refresh_token: Optional[str] = None, download_silent: bool = True, download_gif: bool = True):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider using name download_ugoira instead of download_gif?

'url': zip_url,
}
yield f'{illust["id"]}', gif_image, meta
if self.download_gif:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think maybe it's better to give use a selection, like:

  1. download gif image
  2. dont download gif, but download the seperated images, and rename each of them
  3. just ignore all the ugoiras

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants