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

[postprocessors]how to not create file when keyword not exists #5592

Closed
maplestory03 opened this issue May 14, 2024 · 2 comments
Closed

[postprocessors]how to not create file when keyword not exists #5592

maplestory03 opened this issue May 14, 2024 · 2 comments

Comments

@maplestory03
Copy link

 "postprocessors": [
        {
            "name": "metadata",
            "event": "post",
            "filename": "00_{category}/{gid}/{token}.url",
            "mode": "custom",
            "content-format": ["[InternetShortcut]\nURL=https://{category}.org/g/{gid}/{token}"]
        },
         {
            "name": "metadata",
            "event": "post",
            "filename": "00_{category}_{title}.url",
            "mode": "custom",
            "content-format": ["[InternetShortcut]\nURL=https://{category}.org/g/{gid}/{token}"]
        },
        {
            "name": "metadata",
            "event": "post",
            "filename": "00_{category}_{title_jpn}.url",
            "mode": "custom",
            "content-format": ["[InternetShortcut]\nURL=https://{category}.org/g/{gid}/{token}"]
        }
    ]

create file when "title_jpn" exists, do not create file when "title_jpn" not exists
this way will create if title_jpn not exists: 00_{category}_.url
how to fix it?

@Hrxn
Copy link
Contributor

Hrxn commented May 14, 2024

You can use the "filter" option in a post-processor.

        {
            "name": "metadata",
            "event": "post",
            "filename": "00_{category}_{title_jpn}.url",
            "mode": "custom",
            "content-format": ["[InternetShortcut]\nURL=https://{category}.org/g/{gid}/{token}"],

            "filter": "locals().get('title_jpn')"
        }

This post-processor should only run if "title_jpn" exists.

@maplestory03
Copy link
Author

You can use the "filter" option in a post-processor.

        {
            "name": "metadata",
            "event": "post",
            "filename": "00_{category}_{title_jpn}.url",
            "mode": "custom",
            "content-format": ["[InternetShortcut]\nURL=https://{category}.org/g/{gid}/{token}"],

            "filter": "locals().get('title_jpn')"
        }

This post-processor should only run if "title_jpn" exists.

works ,thank you

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

No branches or pull requests

3 participants