Provisionning pdf from shell
Hello,
Is there any command to send a pdf (or any other type of) file into my opened zotero library with a shell command ?
I work under linux and for certain activities, I would need to script my zotero provisioning.
Anyone to help ?
Thanks,
Olivier
Is there any command to send a pdf (or any other type of) file into my opened zotero library with a shell command ?
I work under linux and for certain activities, I would need to script my zotero provisioning.
Anyone to help ?
Thanks,
Olivier
We're planning to make it possible to "open" local PDFs via Zotero and then run metadata retrieval on them, though that would result in a prompt in the UI (similar to when you open a RIS file via Zotero).
There are ways to script this entirely locally, but they'd be a bit more complicated, so see if the API approach works first.
thank you Dan for your response. As I understand it, pyzotero methods like "Zotero.attachment_..." could help me then.
However, I'd prefer to talk directly with a local zotero opened instance really. What I would need is simply to send pdf files into my zotero library from a shell (or a shell script). I suspect that it's possible to send some commands to do that to the localhost through port 23119 ?
Olivier
https://forums.zotero.org/discussion/75569/client-scripting-api-with-zotero-standalone-v5
Let's go for investigations :-)
I've been able to push a web page into my library from a shell using the three following three commands :
#get the web page to store
$ curl -fsSo /tmp/doc http://url-to-store
# generate the json db file to be used by zotero
$ jq -cn --arg uri http://url-to-store --rawfile html /tmp/tmpdoc '{url: $uri, html: $html, cookie: ""}' > /tmp/tmpjson
# push to zotero with method "saveSnapshot"
$ curl -vfH Expect: -H 'Content-Type: application/json' --data-binary "@/tmp/tmpjson" "http://localhost:23119/connector/saveSnapshot"
Unfortunatly, I have not been able to push a pdf file since I have not found which method/json format should be used to push a binary file such as pdf.
Could you help ?
Thanks,
---
Olivier
https://github.com/sdx23/zotadd
Feedback welcome.
Myself, I extremely rarely use the URL of an attachment, so I'm just gonna life with it.
I was wondering how should I specify a specific library/collection into which all documents pushed with zotadd would be stored.
For example, I plan to push certain incoming mails automatically to a specific library called "mails" into a specific collection called "incoming".
I have tried to include in the json part of "zotadd" a parameter "collection", but it doesn't work. Any help ?
Here's what it does basically:
1. Use the zotero connector api to ask it to save a snapshot of the url
2. Wait a delay
3. Use playwright to save the webpage as a local pdf (with some tricks to expand dropdowns etc)
4. Create a small webserver that serves the pdf at a local url
5. Ask zotero to save the content at this new url, in effect saving the pdf like if it was online
6. Use pyzotero to modify the url of that pdf to the original url, add tags, make it an attachment to the original webpage, move to specified collection
That's basically it.
I made it to be used as a cli tool and hosted on pypi.
https://github.com/thiswillbeyourgithub/save_to_zotero