takacs / donkey

donkey (d-anki) is a terminal flash card review app
MIT License
20 stars 0 forks source link

Crashes on load #39

Closed mdosch closed 1 week ago

mdosch commented 1 week ago

Dear developer,

I wanted to try this program as it looks pretty useful. I just wanted to load an existing anki set to be able to play around without having to create cards first.

Donkey failed on all sets I found online, e.g. https://github.com/PascalDierich/Rechnerarchitektur-anki-flashcards/blob/master/Computer%20Architecture.apkg

donkey load ~/Downloads/Computer\ Architecture.apkg
2024/06/22 21:06:48 hello
2024/06/22 21:06:48 hello
panic: runtime error: index out of range [1] with length 1

goroutine 1 [running]:
github.com/takacs/donkey/cmd.loadFileToDb({0x7fffad7c42cd?, 0x78f85f?}, {0x790476, 0x7}, 0xc0001180b8)
    /home/martin/build/go/pkg/mod/github.com/takacs/donkey@v0.0.0-20240622025837-e6d7f6e2d7aa/cmd/load.go:61 +0x42e
github.com/takacs/donkey/cmd.init.func5(0x9e1680, {0xc000126320, 0x1, 0x78f86f?})
    /home/martin/build/go/pkg/mod/github.com/takacs/donkey@v0.0.0-20240622025837-e6d7f6e2d7aa/cmd/load.go:40 +0xcb
github.com/spf13/cobra.(*Command).execute(0x9e1680, {0xc0001262e0, 0x1, 0x1})
    /home/martin/build/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:940 +0x882
github.com/spf13/cobra.(*Command).ExecuteC(0x9e1960)
    /home/martin/build/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:1068 +0x3a5
github.com/spf13/cobra.(*Command).Execute(...)
    /home/martin/build/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:992
github.com/takacs/donkey/cmd.Execute()
    /home/martin/build/go/pkg/mod/github.com/takacs/donkey@v0.0.0-20240622025837-e6d7f6e2d7aa/cmd/root.go:19 +0x1a
main.main()
    /home/martin/build/go/pkg/mod/github.com/takacs/donkey@v0.0.0-20240622025837-e6d7f6e2d7aa/main.go:9 +0xf

Version v0.0.0-20240622025837-e6d7f6e2d7aa

takacs commented 1 week ago

hey @mdosch , first of all thank you for opening this issue and giving me an opportunity to improve donkey!

Unfortunately donkey load doesn't support the .apkg format as of now. I've opened #41 to add support for it as soon as I can. Currently the way to import an .apkg file is to import it to Anki and export it to a .txt file. I've written some instructions on how to do this here: https://github.com/takacs/donkey/blob/main/docs/load_cards.md With these steps I managed to import the deck you referenced.

Please let me know if you managed to succeed with the import. Thanks!

mdosch commented 1 week ago

Thanks, that worked.