omnivore-app / logseq-omnivore

Logseq plugin to fetch articles and highlights from Omnivore
MIT License
278 stars 15 forks source link

Import directly into journal? #124

Closed regexident closed 11 months ago

regexident commented 11 months ago

I'd like to import entries from Omnivore directly into the Journal pages corresponding to {{{dateSaved}}} (as my use of Omnivore is mainly as a trampoline for Logseq).

I tried setting pageName to {{{dateSaved}}}, but the plugin now doesn't seem to import anything anymore, instead.

And I'm getting conflicts (containing entries from Omnivore) for pages/.md.

jacksonh commented 11 months ago

Hi @regexident can you try {{{date}}} ?

regexident commented 11 months ago

Yes, that's what I initially tried (since it was suggested by the settings label). Stumbling upon this I figured the label might just be outdated and tried dateSaved.

I changed the syncAt to an earlier date (~2020) to force a re-import, but I'm not seeing any imports at all. Neither in the journal, nor in pages corresponding to the date, nor anywhere else.

jacksonh commented 11 months ago

@regexident thanks. Do you mind opening developer tools in Logseq, clicking on the console tab, and seeing if there is any info? It looks like you are right it should be {{{dateSaved}}} I think.

regexident commented 11 months ago

The only errors the console revealed where a whole bunch of these:

image

(Which also seem to have correlated with flickering of the UI.)

The rest consists of logs like this one: image

Here are the complete logs (after clearing it before triggering an import): console.txt

jacksonh commented 11 months ago

Thanks, one more thing, can you open the command pallette (CMD+SHIFT+p) and run Resync all Omnivore Articles ?

regexident commented 11 months ago

Cleared the console, and executed Resync all Omnivore Articles, resulting in the following logs: console.txt

No errors are logged this time.

Searching for the most recent Omnivore entry (or any other, for that matter) in Logseq still finds nothing.

regexident commented 11 months ago

I'm running the following versions:

Logseq v0.9.13 (66) Omnivore v1.13.3

sywhb commented 11 months ago

Hey @regexident , would you mind sharing your plugin settings?

regexident commented 11 months ago

@sywhb sure!

{
  "generalSettings": "",
  "apiKey": "<SNIP>",
  "filter": "import all my articles",
  "customQuery": "",
  "frequency": "10",
  "graph": "Personal",
  "syncAt": "2023-08-03T11:06:36",
  "highlightOrder": "the location of highlights in the article",
  "isSinglePage": false,
  "pageName": "{{{dateSaved}}}",
  "articleTemplate": "[{{{title}}}]({{{originalUrl}}})",
  "highlightTemplate": "> {{{text}}} [⤴️]({{{highlightUrl}}}) {{#labels}}#[[{{{name}}}]] {{/labels}}",
  "advancedSettings": "",
  "endpoint": "https://api-prod.omnivore.app/api/graphql",
  "disabled": false,
  "version": "v1.13.3",
  "syncJobId": 10,
  "loading": false
}
sywhb commented 11 months ago

@regexident this looks all correct to me except that the pageName should be {{{date}}}.

I know it is a bit confusing but I used a different variable name here.

regexident commented 11 months ago

Hm, not sure why but with {{{date}}} (instead of {{{date}}}) it now finally did something. I had tried both in the past.

But now it created hundreds of individual pages named after the dates. I'd like the entries to instead get (appended or prepended) to journal entries corresponding to the given dates, not separate pages. 😕

(I'd effectively like "save entry to omnivore" to be a shortcut for "manually add entry to today's Logseq journal". Especially for saving stuff to Logseq from a mobile device.)

Would a feature like this be in scope for this plugin?

sywhb commented 11 months ago

@regexident It's kind of weird because the synced articles are entries in the journal in my Logseq after I sync with Omnivore.

Screenshot 2023-08-04 at 10 42 23 AM

Would you mind checking if isSinglePage is not checked?

Screenshot 2023-08-04 at 12 28 05 PM
sywhb commented 11 months ago

@regexident Never mind, I noticed you have isSinglePage: false in the settings.

May I know the date format in your journal and the synced page name?

regexident commented 11 months ago

May I know the date format in your journal and the synced page name?

My logseq/config.edn doesn't specify a :journal/file-name-format nor a :journal/page-title-format. And neither does ~/.logseq/config/config.edn.

Most of my journal file names have 2023-01-23.md, while all the ones created by the plugin (and some with earlier creation dates, hence I assume not created by it) have 2023_01_23.md, if that's what you mean? What should they be called? Should I write a script to unify them somehow? (Reading through other issues (e.g. #4019) related to date format it seems like _ is the proper/default one?)

Either way it looks like I got confused by Logseq's UI (and the somewhat unclear language in the plugin's settings) and it does create journals after all?. The "pages" synced by Omnivore do seem to create files in /journals/… (as opposed to /pages/…). The plugin settings don't make any mention of it creating journal entries anywhere, so I was assuming it to create pages (named after dates) instead.

regexident commented 11 months ago

Update: I just went ahead and unified journal names to 2023_01_23.md and re-indexed the graph.

It looks like the plugin works as intended now. To verify I added an entry to Omnivore, re-fetched via the plugin in Logseq and the entries and it appended the following to today's journal:

- ## 🔖 Articles
    - <SNIP>

So I guess the issue can be closed (I'll leave that to you). Thank you both so much for your help @jacksonh & @sywhb!