jlegewie / zotfile

Zotero plugin to manage your attachments: automatically rename, move, and attach PDFs (or other files) to Zotero items, sync PDFs from your Zotero library to your (mobile) PDF reader (e.g. an iPad, Android tablet, etc.), and extract PDF annotations.
4.05k stars 282 forks source link

Can I use the arXiv ID or other types of Identifier to generate the filename? #554

Open foice opened 3 years ago

foice commented 3 years ago

I see the list of standard wildcards and the possibility to create custom wildcards. I do not see any clear way to use the arXiv ID or some other ID (fungible in Add item(s) by Identifier) to create the filename. Is there any way to include the Identifier in the filename?

raivivek commented 3 years ago

Not sure if there's a support for additional metadata items, but perhaps the wildcard for "Publication/Publisher" should work in this case? Based on what I can see on my end, it contains the ID corresponding to that arXiv article.

Edit: Looks like you can define custom wildcards as shown here

foice commented 3 years ago

The %p field is taken by the Journal on which it appeared. As far as I can see only when it's fresh on arXiv you will find the arXiv coordinates in the %p field. For arXiv paper the URL field contains the arXiv identifier, so the URL would seem more consistent to get arXiv info.

The truth in my opinion is that the Identifier, being good enough to fetch the full info on the paper, should be available in the data on the paper, so that one can derive a filename from it (even using custom wildcards, on which I am trying to make some progress)

foice commented 3 years ago

Just in case, I have put together a collection of standard wildcards that might do the job. Here is the JSON definition. I think I still need to find a way to use %N (for arXiv number), and if that fails use %o (for DOI) or if that fails use %r (for reportNumber) or whatever order each user may like to prioritize.

{
    "N": {
        "field": "url",
        "operations": [
            {
                "function": "exec",
                "regex": "\/(?:.(?!\/))+$"
            }
        ]
    },

    "o": {
        "field": "DOI",
        "operations": [
            {
                "function": "replace",
                "regex": "\/",
                "replacement": "-"

            }
        ]
    },

    "r": {
        "field": "reportNumber",
        "operations": [
            {
                "function": "exec",
                "regex": ".*"
            }
        ]
    }

}