Ajatt-Tools / mpvacious

🍜 Adds mpv keybindings to create Anki cards from movies and TV shows.
https://tatsumoto-ren.github.io/blog/mining-from-movies-and-tv-shows.html
GNU General Public License v3.0
592 stars 51 forks source link

Trying to add note yields "Error: cannot create note because it is empty." #39

Closed skangas closed 3 years ago

skangas commented 3 years ago

Environment:

Describe the bug No note gets added, I see the error "Error: cannot create note because it is empty."

To Reproduce

I changed the settings in the subs2srs.lua file itself. I did check and double-check that the matching fields are used. Please see below the diff.

Steps to reproduce the behavior:

  1. Press a, then i, then n
  2. I see an error on screen: "Error: cannot create note because it is empty." In mpv terminal I see:
[modules] Error: cannot create note because it is empty. 

A: 00:05:14 / 00:23:38 (22%) {0.0min 34.12x 0.0MB} Cache: 20s/1MB
[modules] File stored: 'XXXXXX_05m13s720ms-05m14s960ms.ogg'. 
[modules] File stored: 'XXXXXX_05m13s719ms.webp'. 

(XXXXXXX is the name of the file I was playing sans its extension.)

  1. No note gets added

Expected behavior Note gets added

Screenshots Not applicable

diff --git a/subs2srs.lua b/subs2srs.lua
index 3ec9ce0..fd14a00 100644
--- a/subs2srs.lua
+++ b/subs2srs.lua
@@ -38,7 +38,7 @@ For complete usage guide, see <https://github.com/Ajatt-Tools/mpvacious/blob/mas
 local config = {
     -- Common
     autoclip = false,              -- enable copying subs to the clipboard when mpv starts
-    nuke_spaces = true,            -- remove all spaces from exported anki cards
+    nuke_spaces = false,           -- remove all spaces from exported anki cards
     clipboard_trim_enabled = true, -- remove unnecessary characters from strings before copying to the clipboard
     snapshot_format = "webp",      -- webp or jpg
     snapshot_quality = 15,         -- from 0=lowest to 100=highest
@@ -52,12 +52,12 @@ local config = {

     -- Anki
     create_deck = false,                -- automatically create a deck for new cards
-    deck_name = "Learning",             -- name of the deck for new cards
-    model_name = "Japanese sentences",  -- Tools -> Manage note types
-    sentence_field = "SentKanji",
-    audio_field = "SentAudio",
-    image_field = "Image",
-    miscinfo_field = "Notes",           -- misc notes and source information field
+    deck_name = "subs2srs",             -- name of the deck for new cards
+    model_name = "3. All-Purpose Card",  -- Tools -> Manage note types
+    sentence_field = "The full sentence (no words blanked out)",
+    audio_field = "Audio",
+    image_field = "Front (Picture)",
+    miscinfo_field = "Extra Info (Pronunciation, personal connections, conjugations, etc)",           -- misc notes and source information field
     miscinfo_format = "%n (%t)",        -- format string to use for the miscinfo_field, accepts note_tag-style format strings
     tag_nuke_brackets = true,           -- delete all text inside brackets before subsituting filename into tag
     append_media = true,                -- True to append video media after existing data, false to insert media before
skangas commented 3 years ago

I was using the wrong field for the front of the card. Anki requires the first field not to be empty using my model. Perhaps the error message could be improved to include a hint to this effect?

tatsumoto-ren commented 3 years ago

The readme says here:

Sentence field should be first in the note type settings. Otherwise, Anki won't allow mpvacious to add new notes.

skangas commented 3 years ago

OK, thanks. My confusion.