View Single Post
Old 08-27-2014, 03:27 PM   #27
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,735
Karma: 24031401
Join Date: Dec 2010
Device: Kindle PW2
I've created a quick & dirty KUAL extension with 4 menu options that execute sqlite3 queries:

Hide all (moves all words from Learning to Mastered)

Code:
sqlite3 /mnt/us/system/vocabulary/vocab.db "UPDATE WORDS SET category=100 WHERE category=0;"
Unhide all (moves all words from Mastered to Learning)

Code:
sqlite3 /mnt/us/system/vocabulary/vocab.db "UPDATE WORDS SET category=0 WHERE category=100;"
Delete all (deletes all words)

Code:
sqlite3 /mnt/us/system/vocabulary/vocab.db "DELETE FROM WORDS;"
sqlite3 /mnt/us/system/vocabulary/vocab.db "DELETE FROM LOOKUPS;"
sqlite3 /mnt/us/system/vocabulary/vocab.db "DELETE FROM DICT_INFO;"
sqlite3 /mnt/us/system/vocabulary/vocab.db "DELETE FROM BOOK_INFO;"
Export all (exports all entries from the WORDS and LOOKUPS tables)

Code:
sqlite3 /mnt/us/system/vocabulary/vocab.db "SELECT * FROM WORDS where category=0;" > /mnt/us/unknown_words.txt
sqlite3 /mnt/us/system/vocabulary/vocab.db "SELECT * FROM WORDS where category=100;" > /mnt/us/known_words.txt
sqlite3 /mnt/us/system/vocabulary/vocab.db "SELECT * FROM LOOKUPS;" > /mnt/us/lookups.txt
To obtain a more SRS friendly layout, replace the code in export.sh with the following two lines:

Code:
echo "lang|word|stem|usage|authors|title|category" > /mnt/us/vocab.txt
sqlite3 /mnt/us/system/vocabulary/vocab.db "SELECT WORDS.lang, word, stem, usage, authors, title, category  FROM LOOKUPS JOIN WORDS on LOOKUPS.word_key=WORDS.id JOIN BOOK_INFO on LOOKUPS.book_key=BOOK_INFO.id;" >> /mnt/us/vocab.txt
This will generate the following output:

Code:
lang|word|stem|usage|authors|title|category
en|quaffed|quaff|The quarter-bottles of cheap wine had been quaffed [...]|Frederick Forsyth|The Veteran|0
(Unfortunately, Paperwhites don't store the actual dictionary definitions in vocab.db.)

The extension works fine on my PW2, however, since none of the sqlite3 queries are reversible and I'm not a programmer, users are strongly recommended to create a backup copy of vocab.db (in /system/vocabulary/) before testing this KUAL extension.
Attached Files
File Type: zip vocab.zip (1.6 KB, 365 views)

Last edited by Doitsu; 09-01-2014 at 02:13 PM. Reason: Added alternative export.sh code
Doitsu is offline   Reply With Quote