This is another of my hacks to quickly add references to my BibTeX files using Alfred.
I am not a fan of Mendeley, Zotero, and other online tools to maintain a bibliography. I am a bit old school and I prefer to keep my own clean bib file and using JabRef to navigate it. I started using JabRef when it was in version 1.3, and it’s stood the test of time.
Installing the Zotero translate server is pretty straightforward
git clone --recurse-submodules https://github.com/zotero/translation-server cd translation-server npm install npm start
Once your server is running, you can use Alfred to access it easily. My workflow is a simple wrapper around the following bash script, which uses the DOI to return a formatted BibTeX entry.
JsonOutput=`curl -d $1 -H 'Content-Type: text/plain' http://127.0.0.1:1969/search` BibTeXOutput=`curl -d "$JsonOutput" -H 'Content-Type: application/json' 'http://127.0.0.1:1969/export?format=bibtex'` echo -n $BibTeXOutput
The proof is again in the pudding.