Skip to content

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

Open
wohaoeRiver wants to merge 1 commit into
deepghs:mainfrom
wohaoeRiver:main
Open

1: Add a parameter to specify whether to download GIFs. 2: Resolve errors when downloading GIFs.#51
wohaoeRiver wants to merge 1 commit into
deepghs:mainfrom
wohaoeRiver:main

Conversation

@wohaoeRiver

Copy link
Copy Markdown

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)
Comment thread waifuc/source/pixiv.py
self.type = type
self.filter = filter
self.req_auth = req_auth
self.download_gif = download_gif

Copy link
Copy Markdown
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__

Comment thread waifuc/source/pixiv.py
self.filter = filter
self.date = date
self.req_auth = req_auth
self.download_gif = download_gif

Copy link
Copy Markdown
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__.

Comment thread waifuc/source/pixiv.py
self.end_date = end_date
self.filter = filter
self.req_auth = req_auth
self.download_gif = download_gif

Copy link
Copy Markdown
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__

Comment thread waifuc/source/pixiv.py
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
Copy Markdown
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?

Comment thread waifuc/source/pixiv.py
'url': zip_url,
}
yield f'{illust["id"]}', gif_image, meta
if self.download_gif:

Copy link
Copy Markdown
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