mortii / anki-morphs

A MorphMan fork rebuilt from the ground up with a focus on simplicity, performance, and a codebase with minimal technical debt.
https://mortii.github.io/anki-morphs/
Mozilla Public License 2.0
47 stars 6 forks source link

Shared ankimorphs.db across 2 separate profiles? #225

Open andrewRmerchant opened 2 months ago

andrewRmerchant commented 2 months ago

Is your feature request related to a problem?

Yes. In Anki, you cannot select a specific deck to be synced, you must sync all decks in a profile. AnkiMorphs strength is pairing it with subs2srs, however, most of the sentence bank cards are actually not used (only the 1T cards are). Therefore, it would be nice to keep the Sentence Bank as a separate profile, and set this profile to NOT sync automatically (cards kept locally). Then, after mining 1T cards, those cards could be exported to the other profile. This avoids having to sync thousands of sentence bank cards that may or may not be used.

Describe the solution you would like

A way for for Profile 2's 'ankimorphs.db' file to be automatically updated/overwritten by Profile 1's 'ankimorphs.db' file. Or, a way for multiple profiles to share one 'ankimorphs.db'.

Describe alternatives you've considered

Manually copying the 'ankimorphs.db' files from Profile 1 to Profile 2.

Additional context

I understand this may not be possible at all given the way Profiles work in Anki. I also understand that this would not work for anyone who does use separate profiles for their intended use in Anki. For my workflow, I like to keep Profile 1 with all my actively studied cards, and keep Profile 2 as a local storage profile for all shared decks that I'm considering using in the future, and for my subs2srs Sentence Bank cards. This also helps my Profile 1 stay cleaner.

mortii commented 2 months ago

Interesting. What would be the advantages of of combining the dbs? To get more accurate U and A numbers?

aleksejrs commented 2 months ago

On Linux, you might be able to use links to join the files. I don't know, it depends on how SQLite works.

andrewRmerchant commented 2 months ago

In my case I'm using AnkiMorphs for Chinese so iirc from your documentation U and A don't apply.

What I do is run 'Recalc' in my Profile 2 (Sentence Bank), then I go to the browser and sort by "am-ready" tag (1T Sentence). Then I pick about 5-10 1T Sentence Cards and move them to a separate deck. I then export that deck as an .apkg, and import this deck into Profile 1 (Active Study). Then, in Profile 1, I study my 1T deck, and then afterwards run 'Recalc' on Profile 1. I do it this way because I like having multiple cards across different shows/contexts for a target morph and picking the most engaging/compelling/memorable one to include in my 1T deck.

Only issue here being if I were to go back into Profile 2 (Sentence Bank) to mine more 1T cards, even if I 'Recalc', Profile 2's 'ankmorphs.db' wouldn't take into account the cards that have just matured, since all that information is kept in Profile 1's card info and Profile 1's 'ankimorphs.db'.

I think right now I have 3 options: 1) Manually copy Profile 1's 'ankimorphs.db' into Profile 2 after each study session. 2) Export my entire 1T deck back into Profile 2 after each study session and 'Recalc' in Profile 2 so that 'ankimorphs.db' is updated. 3) Based on aleksejrs comment, make a ScheduledJob in PowerShell and set it to copy over the 'ankimorphs.db'.

mortii commented 2 months ago

@andrewRmerchant ah, i see, you want profile 2 to reflect your profile 1 knowledge so you can better filter out cards.

The bad news is that moving the dbs between profiles before recalcing is actually meaningless, because the first step in the recalc process is to delete everything in the found db: https://github.com/mortii/anki-morphs/blob/02b35723430b1aa23f1fc1bb32d219789115e125/ankimorphs/recalc.py#L186-L190

There are two potential short term solutions for this:

  1. use the known morphs exporter on profile 1 (you could use an interval of zero if you want), and then import that file to profile 2
  2. comment out line 189from the file above and hardcode a static path in this line: https://github.com/mortii/anki-morphs/blob/02b35723430b1aa23f1fc1bb32d219789115e125/ankimorphs/ankimorphs_db.py#L29.
    maybe use the path to your documents folder or something. The combination of those two should result in a shared db acoss all profiles that does not reset every recalc. Note that any local changes you do to these files will be overwritten the next time you update AnkiMorphs.

The long term solution to this would be to add some options in the settings to basically replicate the steps in option two above. I'll add it to the roadmap.

andrewRmerchant commented 2 months ago

Oh that's good to know! Thanks so much @mortii.