Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Readers > Amazon Kindle > Kindle Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 05-19-2012, 11:48 PM   #1
koziej
Junior Member
koziej began at the beginning.
 
Posts: 7
Karma: 10
Join Date: May 2012
Device: Kindle Touch
Porting Anki to Kindle Touch - please comment

Hello.

I want to port Anki (http://ankisrs.net/) to Kindle Touch.

I have good experience with linux / java / python, but Kindle is new to me, so I would like if you, fellow developers, forsee any major problems which could render this effort impossible.

Anki's engine for storing and manipulating flashcards is written in python, backed by a sqlite database. I'm thinking about following steps:

1. Cross compile pysqlite2 [sqlite api - native python module]
2. run Jython on kindle's jvm
3. Create a Kindlet embedding Jython, with a simple GUI for reviewing flashcards.

Comments, tips, etc appreciated,

Regards,

m.
koziej is offline   Reply With Quote
Old 05-20-2012, 12:35 PM   #2
knc1
Going Viral
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
Quote:
Originally Posted by koziej View Post
Hello.

I want to port Anki (http://ankisrs.net/) to Kindle Touch.

I have good experience with linux / java / python, but Kindle is new to me, so I would like if you, fellow developers, forsee any major problems which could render this effort impossible.

Anki's engine for storing and manipulating flashcards is written in python, backed by a sqlite database. I'm thinking about following steps:

1. Cross compile pysqlite2 [sqlite api - native python module]
2. run Jython on kindle's jvm
3. Create a Kindlet embedding Jython, with a simple GUI for reviewing flashcards.

Comments, tips, etc appreciated,

Regards,

m.
http://ankisrs.net/index.html#linux
And after downloading, follow the directions in the enclosed README file just like that page section directs.

It isn't a compiled (to native binary) program, just a python program.
So you should not have the problems associated with cross-compiling.

If you find problems with meeting the required dependances on your selected Kindle model, just update this thread with your problems/progress.

The base dependances are listed as:
Quote:
Prerequisites for Linux/FreeBSD/etc:

- a recent Python (2.4 should be fine)
- python-qt/pyqt 4.4+
- sqlalchemy 0.4.3+
- simplejson 1.7.3+
- pysqlite2 1.3+ or python2.5
Some of which you may have to cross-compile for the Kindle or locate armel binaries that you can use on the Kindle.

This recent thread might help getting the qt libraries working on your Kindle:
https://www.mobileread.com/forums/sho...d.php?t=178716

This application is GPL-v3 licensed.

Last edited by knc1; 05-20-2012 at 12:43 PM.
knc1 is offline   Reply With Quote
Advert
Old 05-20-2012, 03:14 PM   #3
lukeroge
Enthusiast
lukeroge began at the beginning.
 
Posts: 35
Karma: 10
Join Date: Feb 2012
Device: Kindle Touch
You could probably just cross-compile the standard release of Python for ARM - also have a look at the "optware" project for a simple package manager that provides a lot of programs for the kindle that you may find useful.
lukeroge is offline   Reply With Quote
Old 05-20-2012, 03:17 PM   #4
hawhill
Wizard
hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.
 
hawhill's Avatar
 
Posts: 1,379
Karma: 2155307
Join Date: Nov 2010
Location: Goettingen, Germany
Device: Kindle Paperwhite, Kobo Mini
A side note: Jython probably won't be an option if native extensions are needed... But there is a readily compiled python floating around in this forum: https://www.mobileread.com/forums/sho...d.php?t=153930
It uses debian packages, so going the extract-from-debian-route might work for the python extensions, too. However, pyqt will probably be a hassle to get running on the Kindle. For the touch, a modified X11 version of qt might work. Another option is Qt embedded on the framebuffer; also see the thread knc1 referenced.
hawhill is offline   Reply With Quote
Old 05-30-2012, 02:38 AM   #5
koziej
Junior Member
koziej began at the beginning.
 
Posts: 7
Karma: 10
Join Date: May 2012
Device: Kindle Touch
Hello,

Thank you for all the comments - I've done some research regarding Jython, because i thought it might be better to use Kindle's java framework, instead of pushing another platform (python) to an embedded device. But eventually it turns out jython doesn't support java ME, so this is a no go.

I found there is a java port of anki for android, http://code.google.com/p/ankidroid/wiki/Index, and It seems the engine can be extracted and used in a Kindlet or so.

I just have one question: does Kindle have any java SQLite library? It has sqlite binaries onboard, but I'm not sure which java sqlite library can work with it on arm/java me. Any hints?

Regards,

m.
koziej is offline   Reply With Quote
Advert
Old 05-30-2012, 07:33 AM   #6
frostschutz
Linux User
frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.
 
frostschutz's Avatar
 
Posts: 2,279
Karma: 6123806
Join Date: Sep 2010
Location: Heidelberg, Germany
Device: none
You should be aware that currently there is a new major version of Anki in the works (Anki 2, currently in beta) which will introduce many changes (under the hood) such as a new file format for starters. Not sure when it'll be released but you should probably check it out before you make an effort for Anki 1.x now only for it to become obsolete a month later...

Anki also has a web front end so if your eReader has Wifi and a browser you could probably use it already.

A native port for the Kindle would be interesting to say the least, although I must admit that I already have a Smartphone for that although the Android version isn't perfect - Anki is a complex piece of software so porting it is not easy.

Too bad that PDF / ePUB / MOBI have zero scripting ability otherwise you could just add a "Export as PDF/ePUB/MOBI" to desktop Anki so you have your reviews for the day on the go. On my reader, I'd probably have to export them as PNG files instead and just keep hitting the delete button for the ones I know...
frostschutz is offline   Reply With Quote
Old 06-01-2012, 08:28 AM   #7
chalda
Junior Member
chalda began at the beginning.
 
chalda's Avatar
 
Posts: 1
Karma: 10
Join Date: Jun 2012
Device: Kindle
It would be great whether you'll be successful in your effort of porting Anki to Kindle. It sounds great whether I could learn vocabulary offline and then let the Anki synchronize itself when I would reach wifi network.

In case that it won't be successful there could be an patial solution here. Application About Memo (http://aboutmemo.com/download.html) where you can import cards from Anki (http://www.youtube.com/watch?v=8w6f5iKnVTY).
chalda is offline   Reply With Quote
Old 10-24-2012, 11:56 AM   #8
m4n
Junior Member
m4n began at the beginning.
 
Posts: 1
Karma: 10
Join Date: Oct 2012
Device: Kindle 4
Is there any progress on porting anki to kindle touch/paperwhite?
m4n is offline   Reply With Quote
Old 10-24-2012, 01:03 PM   #9
twobob
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Týr
twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.
 
twobob's Avatar
 
Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
not much. Buildroot provides the python, sqlite module, zlib module, a qt5 build, json options but it would need some slapping together.

I will have a quick play at slapping it on the device as see where it dies. pyqt I imagine as I haven't had a look at that yet.

TBC

EDIT: Feel free to try this process yourself. obviously

Last edited by twobob; 10-24-2012 at 01:28 PM.
twobob is offline   Reply With Quote
Old 12-06-2013, 12:10 PM   #10
peterhey
Member
peterhey can grip it by the huskpeterhey can grip it by the huskpeterhey can grip it by the huskpeterhey can grip it by the huskpeterhey can grip it by the huskpeterhey can grip it by the huskpeterhey can grip it by the huskpeterhey can grip it by the huskpeterhey can grip it by the huskpeterhey can grip it by the huskpeterhey can grip it by the husk
 
Posts: 21
Karma: 141126
Join Date: Dec 2013
Device: touch
some counterpart of anki

I was trying porting Anki to Kindle because ankiweb is very slow and needs internet connection. But it's too complex. So I wrote simple script in sh/perl. Everything is on local system drive. We can import words from anki, from "My Clippings.txt" and from own file with words.

1. If we want import words from Anki.

Then export file.
Anki 2.0 -> File -> Export -> Plain text & uncheck "add labels".
Name file as "new-words". Copy it to "anki" dir from "anki.tar" and run "add-new". The "anki-dat" is our database. It imports only words without assigned time to each word.

Now, you can start learning. Just "./learn".

If you don't have "perl", copy "perl" from "anki.tar" to place with system path or make new system path to it.

2. Import from our file.

File consist with two columns. First is foreign word/sentence and second is native word. Between them is the tab character. Same name - "new-words". Same procedure as above.

3. Import from "My Clippings.txt" is done automatically at each start of "add-new".

3a. Adding words to "My Clippings".

While we are reading texts in foreign language we can add words to "My Clipping.txt" just by tapping and choose "Add note" or "Highlight".

When adding a new words important is structure of it.

If someone wants use this option write please or see to source or sample-my-clippings.txt.

Cheers.

Edit: newest ver: https://www.mobileread.com/forums/sho...8&postcount=18
Attached Files
File Type: tar anki.tar (1.16 MB, 258 views)

Last edited by peterhey; 01-10-2014 at 09:21 AM.
peterhey is offline   Reply With Quote
Old 01-08-2014, 07:04 AM   #11
peterhey
Member
peterhey can grip it by the huskpeterhey can grip it by the huskpeterhey can grip it by the huskpeterhey can grip it by the huskpeterhey can grip it by the huskpeterhey can grip it by the huskpeterhey can grip it by the huskpeterhey can grip it by the huskpeterhey can grip it by the huskpeterhey can grip it by the huskpeterhey can grip it by the husk
 
Posts: 21
Karma: 141126
Join Date: Dec 2013
Device: touch
I added audio for words but it requires extra scripts. It converts words to mp3 files. Works fine. Disadvantage appear when I want add audio for new words. Part of adding must be done manually. It takes about 10 min each time regardless of how many words is.

So, could you help me jump at TTS? Do something like "say" in linux. I have tried convert "word" to "mobi" file and made tts to voice it.
In com.lab126.tts I don't know what write to "playFile" property which is "has" type. When "playFile" is set, need only write "1" to "unpause" and will tts run voice?

Thx
peterhey is offline   Reply With Quote
Old 01-08-2014, 08:09 AM   #12
eureka
but forgot what it's like
eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.
 
Posts: 741
Karma: 2345678
Join Date: Dec 2011
Location: north (by northwest)
Device: Kindle Touch
@peterhey, Has means "Hasharray property". Use lipc-hash-prop for interacting with such property. This program has usage info.

However, I think that text is fed to TTS through /tmp/ttsUSFifo FIFO. But I don't know anything about of process required for passing valid text. I executed echo 'Hello' > /tmp/ttsUSFifo twice. KT didn't say anything after first command, but it said Hello twice after second command.

EDIT: It looks like text written to FIFO is queued and TTS wiill say something when it gets 7 or more characters (excluding spaces). There is also another topic mentioned this FIFO.

TTS also supports control sequences. Control sequences (or, at least, \Mrk sequence) starts with ASCII ESC code. Stock reader passes text chunks in control sequences '\Mrk=<number>\<word>', where <number> is looks like word position in whole text and <word> is a word (with any following punctuation sign). Example of stock reader behavior:
Code:
echo -n $'\033''\Mrk=1\Hello '$'\033''\Mrk=7\TTS '$'\033''\Mrk=11\world. '$'\033''\Mrk=17\Hi.' > /tmp/ttsUSFifo
Note that I don't know semantic of \Mrk sequence and I might be wrong in starting counting from 1 or in determining of any following \Mrk numbers.

Last edited by eureka; 01-08-2014 at 09:53 AM.
eureka is offline   Reply With Quote
Old 01-08-2014, 09:34 AM   #13
peterhey
Member
peterhey can grip it by the huskpeterhey can grip it by the huskpeterhey can grip it by the huskpeterhey can grip it by the huskpeterhey can grip it by the huskpeterhey can grip it by the huskpeterhey can grip it by the huskpeterhey can grip it by the huskpeterhey can grip it by the huskpeterhey can grip it by the huskpeterhey can grip it by the husk
 
Posts: 21
Karma: 141126
Join Date: Dec 2013
Device: touch
This is perfectly simple. Thank you. "Twice issue" shows occurs only when text has 8 or less voicing letters is too short.

Last edited by peterhey; 01-08-2014 at 09:57 AM.
peterhey is offline   Reply With Quote
Old 01-08-2014, 10:46 AM   #14
peterhey
Member
peterhey can grip it by the huskpeterhey can grip it by the huskpeterhey can grip it by the huskpeterhey can grip it by the huskpeterhey can grip it by the huskpeterhey can grip it by the huskpeterhey can grip it by the huskpeterhey can grip it by the huskpeterhey can grip it by the huskpeterhey can grip it by the huskpeterhey can grip it by the husk
 
Posts: 21
Karma: 141126
Join Date: Dec 2013
Device: touch
In this pdf:
http://www.sof2go.com/forumdata/Real...eSequences.pdf
Code:
<ESC>Wx : Setting a wait period between all succeed
ing message units
This control sequence generates additional pauses i
n between different Text-To-Speech essage
units.
Range (x) : 0..9
0 no additional pause
1 200 milliseconds
9 1800 milliseconds
Default: 2
This works for single chars
Code:
echo $'\033W4 hello' > /tmp/ttsUSFifo
Thanks for the hint.
peterhey is offline   Reply With Quote
Old 01-08-2014, 11:48 AM   #15
eureka
but forgot what it's like
eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.
 
Posts: 741
Karma: 2345678
Join Date: Dec 2011
Location: north (by northwest)
Device: Kindle Touch
Quote:
Originally Posted by peterhey View Post
This works for single chars
Code:
echo $'\033W4 hello' > /tmp/ttsUSFifo
Thanks for the hint.
Thanks for finding! It really works even for single characters. However description of escape sequence is cryptic and values lesser than 4 don't produce required result. How did you find out right sequence and value? Only by experiment?
eureka is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Android porting on my kindle touch? acajac Kindle Developer's Corner 1 04-12-2012 08:42 AM
Anki ThomasK Sony Reader Dev Corner 7 01-12-2012 11:32 PM
Anki on K3? Reeeder Kindle Developer's Corner 1 08-12-2011 06:06 AM
Comment acheter un Kindle ? death4578 Amazon Kindle 5 02-28-2011 11:55 AM
Anki or Ankimini on Kindle 3 kindle3wifi Kindle Developer's Corner 2 02-26-2011 05:25 AM


All times are GMT -4. The time now is 01:03 AM.


MobileRead.com is a privately owned, operated and funded community.