-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
[postprocessor:mtime] add 'value' option #2739
Conversation
It would be better to put most of the work into Something like this in value = options.get("value")
if value:
self._get = formatter.parse(value, None, util.identity).format_map
else:
self._get = operator.itemgetter(options.get("key", "date")) This would also need an else:
key = options.get("key", "date")
self._get = lambda kwdict: kwdict.get(key)
You should make the underline as long as the heading itself: mtime.value
--------- and I'd rather add a note to
than what the last line says. The default value should be noted as plain |
6d94620
to
6ef887c
Compare
Just commenting to acknowledge that the checks have failed. |
Concerning the failed tests, you can just remove the 3 lines here, or at least the gallery-dl/test/test_postprocessor.py Lines 353 to 355 in 90ae48c
If you for some reason feel like it, you can add some additional tests for To run those tests locally, use |
6ef887c
to
c15f0cc
Compare
Are those test changes acceptable? |
They are. Thank you very much. |
Some of this jargon is over my head, but does this merge address that fact that all of my postprocessors fail to preserve the date modified of the base post that they're related to? Like I download an image, the date becomes the date on the website's server of the date the artist uploaded the image, then I run a postprocessor to save the description that the artist wrote along with that image, but this description just uses the current date on my computer instead of remembering the image's date? Or is that not what this is about? If that is what this is about, what's the syntax I have to add to my postprocessor to enable this new date saving feature? |
@left1000 This PR is about adding a more flexible way of getting a value for the What you want is to enable the {
"name": "metadata",
"mtime": true,
"...": "..."
} |
Closes #2721.
I'm not at all familiar with reStructuredText, so I based a lot of the doc changes on other options.
I'm also not sure if setting
self.value_fmt
and then settingself._value_fmt
is necessary, again I saw another place where something similar was done so I went with it for now.I was also considering wrapping the value of
mtime.key
in braces as the default format string formtime.value
, and using it as the only value formtime
. Currently it defaults to an empty string.A review is welcome.