louietan / anki-editor

Emacs minor mode for making Anki cards with Org
705 stars 87 forks source link

linked media files not uploaded #35

Closed antifuchs closed 5 years ago

antifuchs commented 5 years ago

I'm trying to build a vocabulary deck, and the following note does not upload the .mp3 file to anki, and doesn't link it as a sound file either.

#+PROPERTY: ANKI_DECK French::My words
* soir                                                                             :male:
  :PROPERTIES:
  :ANKI_NOTE_TYPE: What does this word mean?
  :ANKI_NOTE_ID: 1542420645039
  :END:
***  sort
    99
***  French
soir
***  Grammar
***  Pronunciation
swaʁ
***  Audio
[[file:/Users/asf/Desktop/French/recordings/soir.mp3][soir]]
***  Image
(empty)
***  Association / sentence
(empty)

Using M-x anki-editor-push-notes in that buffer results in a note with a HTML link to that file in the given field (as file:/Users/asf/Desktop/French/recordings/soir.mp3), but the note isn't set up to play the audio file at all. The Anki database does not contain the media file and *Messages* doesn't contain mentions of the media file being uploaded.

From reading the source code, it looks like the advice around org-html-link in anki-editor--ox-html-link is intended to do that, but in my org-mode installation (Org mode version 9.1.14 (release_9.1.14-1012-g643481 @ /Users/asf/.emacs.d/straight/build/org/)), it does not seem to be getting called - I used edebug-defun to see what happens in this function, but when pushing the buffer's notes, it isn't used at all.

I'm confused - Am I using media file references wrong? Or is this a problem with anki-editor instead?

antifuchs commented 5 years ago

I think I found the issue: I was editing in plain org mode, not anki-editor-mode. While my bug report isn't super valid, can you provide guidance on how to set things up such that the mode gets activated automatically when opening an org file with anki card definitions?

antifuchs commented 5 years ago

I solved this by putting

# local variables:
# eval: (anki-editor-mode +1)
# end:

at the end of my org file.

michaelsjackson commented 4 years ago

.jpeg images seem not to be supported, I guess.