-
-
Notifications
You must be signed in to change notification settings - Fork 991
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
Added an additional channel for downloading the metadata of an entire post or gallery #511
Conversation
Metadata_bypostPP is a subclass of MetadataPP, which is a subclass of PostProcessor. I'm not sure if this is a quirk of the tests or if you'd prefer the change. |
In general, I think this is pretty neat, but I'd rather do things a slight bit (or completely) different:
if self.config("write-content"): # option name should be something different
post["extension"] = "txt"
yield Message.Url, "text:" + (content or ""), post You can also run all tests on your own machine:
|
I'm not familiar with the codebase, so I wasn't sure how to go about adding an entirely new handler, which is why I tried to route through existing paths where I could, but I'll give it a shot. I would slightly prefer using the pluggable postprocessor system instead of trying to hardcode a text-only dump, although the URL idea is appealing |
I hate to re-implement the same metadata behavior in two places, since the metadata about the gallery has the same formatting and options as the standard metadata, but if that's how you'd prefer it, here's that isolated at 59759dd. |
I should note that this has the side effect of re-saving metadata even if the target gallery/files already exist, but that doesn't come at the expense of any additional downloads, because gallery-dl has to get the metadata in order to compute the destination path anyway. |
Check seems to have failed due to something unrelated? |
Sorry this took so long. I've now merged your commits into master (excluding the last one, because copy-pasting the other I've tested this with the following as config file and it works as it should:
Thank you for the contribution and my apologies for any inconveniences. |
Notice: Exec postprocessor after Metadata with bypost:true does not trigger to run! |
This is a potential way to resolve #461
Uses a new message,
Metadata
, a new kwarg,metadata_only
, and a new "postprocessor",Metadata_Bypost
.The preprocessor only uses the
prepare
function, so it does not depend on a successful file download.Messages go through the standard
handle_url
route, andhandle_url
calls all postprocessorprepare
functions. Then, if themetadata_only
flag is set, it exits prematurely (like it does when the file exists.)When this postprocessor is enabled (without the
Metadata
postprocessor at all), metadata is correctly saved for each post once, including posts that don't have any other media to download.