lervag / apy

CLI script for interacting with local Anki collection
MIT License
243 stars 17 forks source link

Feature Request: `apy review-from-file` #105

Open pclk opened 1 week ago

lervag commented 1 week ago

I have no idea how this would work. Please provide a more detailed description of how you you want this to work, preferably with some examples.

pclk commented 1 week ago

Apologies, here is the description:

Example

Input

model: Basic

# Note
model: Cloze

## Text
The {{c1::Supervised Classification}} learning algorithms are {{c2::K-Nearest Neighbour algorithm}}, {{c3::Logistic regression}}, {{c4::Decision tree}}, {{c5::Support Vector Machine}}.

## Back Extra

# Note
model: Cloze

## Text
In {{c1::KNN}}, the {{c2::K}} parameter defines the amount of {{c3::nearest neighbours}} considered.

## Back Extra

Expected Output

Launches an apy review session with 5 cloze card reviews

Usage

when calling apy review-from-file $INPUT_FILE, it will start a review session similar to apy review.

Is this sufficient information? please let me know.

lervag commented 1 week ago

Yes, but I'm not sure I agree this is necessary. So, in my opinion, you could get the desired functionality by performing two steps:

apy add-from-file new-notes.md
apy review added:1

Thus, I'm curious what the value proposition of having a single command for this is.

Perhaps I don't understand quite what you want here?

pclk commented 1 week ago

I understand. The value proposition is to be able to review cards directly from your file before it gets added to the anki database.

This is so that everyone can review their markdown file cards before commiting an addition to the anki db.

However, if this requires significant changes to the codebase, then i will implement a script that does a addition, review of latest cards, and removal upon exit. Let me know if it is.

lervag commented 1 week ago

Ok, how about if I add a --review option to apy add-from-file? This would be very easy, especially if it works more or less like I proposed above, i.e. that it

  1. Adds the cards from the file.
  2. Starts a apy review of the added files.

Does this sound like what you want?

pclk commented 4 days ago

Hello lervag,

Sorry for the late reply.

The idea was to review the cards directly from the markdown file before any database operation. One thing about database operations like adding the cards, is that i have to close my anki application, otherwise there will be:

  1. Database Locked error
  2. If there is no Database Locked error while the application is active, then the database will get corrupted

As such, i would like to avoid such operations if possible, unless im ready to commit the flashcards into my database.

Is this still possible? Thank you for your guidance!

lervag commented 4 days ago

Sorry for the late reply.

No problem!

The idea was to review the cards directly from the markdown file before any database operation.

Ah, ok. That would actually require a lot of work, because the entire review code is based on the database APIs fron Anki. And in more recent versions of the Anki API there is no way (that I know of) to not actually commit the actions continuously.

One thing about database operations like adding the cards, is that i have to close my anki application, otherwise there will be: …

Yes, that's right. apy can't be used while Anki is running. It's actually one of the main reasons I created apy. I wanted a CLI tool that was independent of Anki and worked without having Anki Desktop running. Else I could have just used the AnkiConnect stuff.

Is this still possible? Thank you for your guidance!

Everything is possible, but to be honest, I'm not really motivated to work on this. I would not use the functionality myself and I see no easy way to implement it.

Sorry!