-
Notifications
You must be signed in to change notification settings - Fork 28
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
base: main
Are you sure you want to change the base?
Conversation
…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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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:
- download gif image
- dont download gif, but download the seperated images, and rename each of them
- just ignore all the ugoiras
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](https://private-user-images.githubusercontent.com/76583862/311024834-19833a26-cc41-4b15-ba9f-bf085261d55a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwNTc5NDgsIm5iZiI6MTczOTA1NzY0OCwicGF0aCI6Ii83NjU4Mzg2Mi8zMTEwMjQ4MzQtMTk4MzNhMjYtY2M0MS00YjE1LWJhOWYtYmYwODUyNjFkNTVhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA4VDIzMzQwOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWVhNmI5ZDU5NmFjZWZiNDk2N2I2ZDU4MTAzYmVmMmVlZmU1YmFkM2Y2NTRlZGM4OTYxYTdjYTQ3ZGQxMTFjNWQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.q-WPlr3lsVC9XyjZXJHLv-Qjq9e6o41jcvkVraM4UW8)
2:In the
_make_gif_for_ugoira
function, adding theignore_cleanup_errors=True
parameter toTemporaryDirectory
(defaulting toFalse
) 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 theignore_cleanup_errors
parameter ofTemporaryDirectory
, and instead let the users experiencing the problem modifyignore_cleanup_errors
toTrue
and manually delete the files in the temporary directory?### ]