View Single Post
Old 12-21-2011, 08:48 AM   #1
damaki
Member
damaki has learned how to buy an e-book online
 
Posts: 11
Karma: 78
Join Date: Jun 2011
Location: Villejuif, France
Device: Kindle 3
Extract quotes from reader

Hi people!
I just made this smallish piece of code to extract the quotes from a PRS-T1. It has to be run on cygwin or in a whatever OS terminal.

Just change the path to your sqlite3 binary and run this from your "READER" mount point. It creates a "quotes.txt" with all your quotes.
It could probably be improved with details about the quotes' pages but I only intended to get the full text quotes.

Enjoy!

Code:
#!/bin/bash
OUTPUT_FILE='quotes.txt'
SQLITE='./sqlite3.exe'
AWK='awk'

#add the UTF-8 BOM to the generated file
echo -ne '\xEF\xBB\xBF' > $OUTPUT_FILE
$SQLITE Sony_Reader/database/books.db 'select b.author, b.title, a.marked_text FROM annotation a INNER JOIN books b on a.content_id=b._id' | \
$AWK -F '|' '{ print "--------------------\nAuthor: "$1"\nTitle: "$2"\n--------------------\n"$3"\n--------------------" }'| \
unix2dos >> $OUTPUT_FILE
[edit:]removed useless iconv command

Last edited by damaki; 12-21-2011 at 11:14 AM.
damaki is offline   Reply With Quote