DEVONthink and Zotero - A New Attempt

Hello everyone.

I wrote an applescript two years ago that for a time, helped keep my Zotero and Devon in sync. It stopped working at some point and I didn’t have time to revisit the script:

After submitting my dissertation two weeks ago, I thought I would give this DEVONthink to Zotero thing another try…

I think I should rewrite the whole thing from scratch and instead of using the hack I used (connecting directly to the Zotero sqlite database in your Zotero folder and syncing from that) I would use the well developed Zotero API.

I wanted to get some ideas and feedback from folks here in case you have special requests on how you want it to work.

My thoughts so far:

  1. You activate the sync from within Devon

  2. The script interacts with your library through the Zotero API which means that
    a) you will require an internet connection
    b) you will have to create a “private key” through your Zotero account to get this set up

  3. The script will function one-way: it will look for any items not yet imported into Devon.
    a) Unless I can find or you suggest a better way of doing it, it will decide if an item has already been imported into Devon by whether or not there is a folder in the active devon database with an identical name as the item (this means trouble if you rename items - other id based method suggestions?)

  4. If there are any items not yet imported it will create a folder for that item, and a note file within that folder
    a) any preferences on what that file should be called? Last time I just named it the same as the folder
    b) what would you like in the note file? I can try to extract some of the metadata, but not sure what all I’ll have time to extract. Keep in mind there are so many different types of metadata etc.

  5. When adding new items, I will see if I can also grab any text in the Notes of Zotero for the given file

  6. I will explore the ability to (optionally) include any attached PDFs but I doubt I will have time for this as it involves a lot of file interaction.

  7. I will put the code for this on github as open source and hopefully others can build on the work.

Thoughts or requests?

Best, Konrad Lawson

NOTE: I don’t want to spend a huge amount of time on this, so I really don’t think I can create full two way syncing or update modified items and such. Happy to have volunteer coder collaborators

Hie Konrad
Happy to know you have submitted you dissertation… and are ready to find a new way to have Zotero and DTP working together.
I am far from the end of mine, and would much appreciate to see synced (even one way) the two basic softs I’m using everyday.
I cannot right now, but in the coming days, I’ll have a look at what features I would see useful, and get back here to tell you any suggestion.

Thanks Jean-Louis, I look forward to your ideas.

Hello Konrad,
I’ve tried to make out my thoughts on what would be really useful for me.
I assume it is different to start from naught or –as I am know– to find how to interact in a better way between existing collections on both sides (Z and DT).
The first key point for me would be to be able to have DT search functionalities work on Z datas. Thus it means to import in DT most relevant datas, such as: titles and author names, and any linked files as notes and pdfs.
I’m not sure importing tags would be relevant for me, since most often I catch book notices from Worldcat or other web database, that deliver too many tags irrelevant for me (and I don’t take/waste time removing useless ones).
The second key point is linked with the fact I use a single Z account for my whole library, whatever book I will register. And I use folders to separate different subjet-matters. On the contrary, in DT (Pro version), I use different databases for different areas, optimising search tools. Therefore… it would be so great if we could confirm item importation in DT before doing it. We could launch the script in different databases, selecting right things to be imported in each.
I don’t see a better way to know if a book is already in DT than through folders, as you suggest, since we cannot have a common sqlite-item-id both in Z an DT (otherwise would probably mean to have in Z a table dedicated to reproduce sqlite-item-id of books already stored in DT, where to check if book datas already imported). But in fact, I don’t mind importing twice a book, in case having changed folders in Z, since functionality exists in DT to see immediately duplicates items, and then to quickly remove them.
I hope my suggestions will help not to fade away your good motivation to rebuild the script!
edit: I forgot a very important point. Could the script respect foreign accent, such as French ones ? :slight_smile:

Hello everyone,

After spending several days on this, I have made a new attempt at the Zotero to DEVONthink import script. I welcome bug reports, forks, and pull requests here:

It is much slower than my old script, which directly interfaced with the local sqlite database of Zotero. However, one reason I stopped updating the script was that this connection was always tricky to maintain. I now use the Zotero server API which is slow and to add to that, I grab entries one at a time instead of the maximum 50. Would welcome others who have time and ability to rewrite and improve on the script. Currently takes about 3 hours for a large library import of about 2500 entries.

Read the link above for what the script does and does not do. I’ll fix bugs when I can, but I really hope the community will pitch in and improve the script if they want fewer limitations or more features on it.

1 Like