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

Plugin doesn't list the annotations Zotero app has #107

Closed
volker-fr opened this issue Oct 10, 2022 · 16 comments
Closed

Plugin doesn't list the annotations Zotero app has #107

volker-fr opened this issue Oct 10, 2022 · 16 comments

Comments

@volker-fr
Copy link
Sponsor Contributor

I have document where the Zotero Data Explorer doesn't show any PDF annotations. If I query the item against the Zotero API, I see all the annotations.

Note: The Data Explorer main id is the parent object of the PDF. The PDF itself has its own id that can be found in the pdfLink key of the Data Explorer result. I used the API here since its easier for me to demonstrate the issue since the Zotero application doesn't show the id itself. The same annotations the API returns can also be found in the local Zotero application, which this plugin contacts directly.

Data explorer:

data-explorer

API query:
api-result

Error console of Obsidian is empty on Data Explorer pull.

Other PDFs/imports in Obsidian have their annotations.

Since the Data Explorer doesn't see it, these annotations can also not be imported.

@mgmeyers
Copy link
Owner

@volker-fr I see there are two attachments for this item, are they both PDFs?

@volker-fr
Copy link
Sponsor Contributor Author

volker-fr commented Oct 11, 2022

@volker-fr I see there are two attachments for this item, are they both PDFs?

This is a good catch. One is a HTML, the other a PDF:

>>> for i in ZOT.children("T9WJUFIT"):
...     if 'contentType' in i['data']:
...             print(i['key'], i['data']['itemType'], i['data']['contentType'])
...     else:
...             print(i['key'], i['data']['itemType'])
... 
RBKIMNSN note
6WQX2DRF attachment application/pdf
QEJUAT9S attachment text/html

The way I create most Zotero entries is:

  1. Use Zotero browser connector in Chrome
  2. Browser plugin setting is "Automatically take snapshots when saving items" which creates a SingleFile attachment
  3. Have the PDF also automatically downloaded
  4. Just create my own note/short summary

Now I moved the website snapshot out of the parent item and the Data Explorer finally sees the annotations. The other item where it worked has no such snapshot and only the PDF, which explains why in most cases the import had no annotation.

Seems like for some reason the plugin looks for annotations of the html/snapshot file -- which doesn't have an annotation feature in Zotero.

Outside of this issue, it also raises the question how it behaves if an item has two PDFs attachments (which should be much more rare).

@volker-fr
Copy link
Sponsor Contributor Author

volker-fr commented Oct 12, 2022

The issue seem to be based on getAttachmentsFromCiteKey().

It does the following call to better bibtex

      ...
      url: `http://127.0.0.1:${getPort(database)}/better-bibtex/json-rpc`,      
      body: JSON.stringify({                                                    
      jsonrpc: '2.0',                                                         
      method: 'item.attachments',                                             
      params: [citeKey], 
      ...

The response here from better bibtex is

{"jsonrpc":"2.0","error":{"code":-32603,"message":"Error: getAnnotations() can only be called on file attachments"},"id":null}

The bibtex api takes the citekey, which itself is the parent object. That parent object can have multiple children (attachment, pdf, ...).

So bibtex seem to have some hickups here. And I don't see a way how to hand over the item id of e.g. the ID that zotero has internally.

@volker-fr
Copy link
Sponsor Contributor Author

volker-fr commented Oct 12, 2022

I came across retorquere/zotero-better-bibtex#2092 which references a shortfall documented in retorquere/zotero-better-bibtex#2126

There is also an indication that a newer Zotero version might give direct access to some of the calls -- yet this plugin depends on better bibtex, and doesn't support the Zotero API itself (which would require users to signup with Zotero and sync their meta data (not the PDFs itself).

@mgmeyers
Copy link
Owner

Ah, I think that error comes from a PR I made to better bibtex (retorquere/zotero-better-bibtex#2192). I think there needs to be a check here to see if the attachment is a file attachment: https://github.com/retorquere/zotero-better-bibtex/blob/master/content/json-rpc.ts#L169

@mgmeyers
Copy link
Owner

Ok, made a PR to better bibtex to fix this: retorquere/zotero-better-bibtex#2279

@mgmeyers
Copy link
Owner

@volker-fr Try updating better bibtex and see if this issue is fixed for you

@volker-fr
Copy link
Sponsor Contributor Author

@mgmeyers Updated to better bibtex version 6.7.26. The issue seem to be resolved now.

Thanks a lot for your help :)

@volker-fr
Copy link
Sponsor Contributor Author

Reopening. Wondering if the the bibtex change broke image import of annotations. retorquere/zotero-better-bibtex#2279

@volker-fr volker-fr reopened this Oct 16, 2022
@volker-fr
Copy link
Sponsor Contributor Author

Change in better bibtex seems to not impact image imports. Closing again.

@cwarp301
Copy link

cwarp301 commented Oct 2, 2023

Hello! I am pretty sure I still have this issue. Better bibtex is up to date.

image

This is a PDF but its not searchable.

@ghost
Copy link

ghost commented Oct 16, 2023

Hi, I have also encountered the same problem. BetterBibtex and Obsidian Zotero Integration are up to date. However, the parent items in question have only one attachment (a pdf).

@cmosguy
Copy link

cmosguy commented Jan 5, 2024

I have latest obsidian and zotero extensions installed and the import is yielding nothing.

@FeralFlora
Copy link

I have latest obsidian and zotero extensions installed and the import is yielding nothing.

It might be a template issue.

@Fenrihr
Copy link

Fenrihr commented Jan 29, 2024

I have latest obsidian and zotero extensions installed and the import is yielding nothing.

I'm having the same problem: the import is yielding nothing.

My instalation:

  • SO: Fedora Linux 39 (Workstation Edition)
  • Zotero: 6.0.30 (via Flatpak)
  • Better BibTex for Zotero: 6.7.148
  • Obsidian: 1.5.3 (via Flatpak)

imagen

@FeralFlora
Copy link

There could be many reasons why some of you are having issues, including incorrect template setups or import format configurations. Therefore, it would be best to create new issues where you include your template.

If the Data Explorer is showing the annotations, like in the screenshot above, then a template issue is a likely reason why the annotations are not being imported into the note.

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

No branches or pull requests

6 participants