mortii/anki-morphs

Shared ankimorphs.db across 2 separate profiles?

Closed this issue · 7 comments

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.

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

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

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'.

@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:

# Rebuilding the entire ankimorphs db every time is faster and much simpler than
# updating it since we can bulk queries to the anki db.
am_db = AnkiMorphsDB()
am_db.drop_all_tables()
am_db.create_all_tables()

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:
    path: str = os.path.join(mw.pm.profileFolder(), "ankimorphs.db")
    .
    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.

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

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.