The short technical thread

A thread for short technical questions that don’t really need a new thread.


I figured out that it would be easier to import a deck from Anki file when lots of files are referenced (I hope). It seems to be going in the right direction, but I just can’t get the index to work. I’m creating an apkg with the genanki Python package.

I tried adding a field with name index, setting the sort_field to that, adding the guid with the index … The index remains at -1. What do I have to set to affect the indexing?

[btw, it would be great if “delete the deck” would also try to delete some unused layouts and templates :smiley: ]

3 Likes

I believe the anki import is missing an option for setting the index field (it was introduced later than the anki import) and it only checks the anki fields during a running import instead of before the import starts.

In the case where you dont have any media files it would be much easier to import a csv/tsv/txt file (which you can export to, from anki as well iirc).

If you have a ton of media files the only viable option would be the anki import but it’s lacking the index option…

Edit: If “sorting_field” is the way to recognise the index field in anki, I might be able to adjust the import so it automatically uses that as the index field. Do you have a sample anki deck by any chance?


On a general note regarding imports:

I’d like to introduce a way to import anki files which would work in a way that you can just match the fields to existing kitsun templates and select the layouts just like the csv imports, but it’s on non-prio for now…

Aside from that I’d also like to add a way for users to just paste their text into a textarea and generate cards from that, rather than only through file uploads.

2 Likes

Hmm, I wonder how Hine managed to get both the indices and the files in the 10K deck :thinking:

I can send you a file I created per mail, it should have the default sort_field = first field set. But I’m not 100% sure that the file has a totally sensible format :slight_smile:

From genanki:

Anki has a value for each Note called the sort_field . Anki uses this value to sort the cards in the Browse interface. Anki also is happier if you avoid having two notes with the same sort_field , although this isn’t strictly necessary. By default, the sort_field is the first field, but you can change it by passing sort_field= to Note() or implementing sort_field as a property in a subclass (similar to guid ).

Edit: that doesn’t really mention that the field must be numeric …

If I recall correctly I did that manually through the database for him after creating the index functionality.

Got your email, thanks. Will take a look once I got some time for it :slight_smile:

1 Like

Thinking about it, you can’t really use the Anki import to add cards to a deck later, right?

Maybe it’s better to improve the CSV import: when you see an <img>, maybe you could

  1. download the image to kitsun
  2. adjust the links to the cache?

Maybe even better with a zip of images + CSV?

I tried external links and the delay to fetch the images was noticeable, they should come from your server, but the manual upload is a pain :slight_smile:

1 Like

Sadly the path to the image files would not match, and I wouldn’t have permission to download the images through the browser as far as I know…

Mass uploading media through a zip might be possible though, but the urls wouldn’t match unless you set them correctly beforehand.

1 Like

I was thinking images from Wikipedia or something, I want to use it for flags and city seals, … I could upload some images to Github in any case, you could expect full internet URLs :slight_smile:

Or: if you find the image you get it, otherwise keep everything as is.

1 Like

Ah I see what you’re getting at. I think that would quickly hit CORS and security problems though :sweat_smile:

Yet another idea: is there some API to call, like POST the image and see where it landed? I can still set the right URLs on my side.

1 Like

I was making my own Genki deck but it lacks the quality of the Genki deck I found in the community centre. It has audio questions, but I was wondering if I could get it to play automatically?

In the “Deck Settings”, under “Study Session” you can set the audio to auto-play on front or back.

2 Likes

Thank you!

Am I the only one having problems playing the audio with headphones? I don’t have problems with music, Youtube, notifications etc. but for some reason Kitsun doesn’t work when I have my headphones in.

1 Like

Are you using PC or mobile? Especially for mobile there all kinds of restrictions what the browser can do. But Neicudi will know best.

1 Like

Normally PC, but this morning I was doing reviews on my mobile and that’s when I encountered the problem.

1 Like

I think it might be best to have some kind of mass media uploader that you can use. Right now you can upload images one by one through the edit layout page and it return a url (along with a img tag iirc), but the idea would be to have a spot where you can upload it all at once. The only problem with this is that it doesnt update your deck automatically…

Does it work without using headphones? Perhaps its more of a general audio issue for mobile?

1 Like

For me it doesn’t really need a GUI, something like api.kutsun.io/img_upload is enough. An uploader you can call with pyrequests or something. I could upload the images and put the links into the cards while generating the deck.

1 Like

I’m afraid there is no public facing API yet :sweat_smile:

I’d have to either create a public API or a way to upload media through the frontend. In that case my preference definitely goes out to the latter at the moment :grin:

1 Like

It does work without headphones indeed.

1 Like

If it does work without headphones then I think it might be a volume problem with your browser app for headphones specifically? Do other websites play sounds correctly through the same browser app when hooked up to your headphones?

How can I make kana appear when I hover over kanji? I copied everything hinekidori did with their Genki deck, but it doesn’t work.