|
|
#1 |
|
Member
![]() Posts: 21
Karma: 10
Join Date: Oct 2013
Location: France
Device: SONY PRS-T2
|
Lost 'date added' after a calibre transfer
With version 1.3 of calibre that I was using for managing my PRS-T2, during a transfer I got a problem with the USB link. After restarting the device, all dates inside the PRS-T2 were set to the current date (BTW I also lost the read/unread flag!)
Is is possible to update this date (date the epub was added - sorry I don't know the exact words in the Sony interface, because mine is in french) to be in sync with the Calibre library date ? A plugin somewhere ?
|
|
|
|
|
|
#2 |
|
Member
![]() Posts: 21
Karma: 10
Join Date: Oct 2013
Location: France
Device: SONY PRS-T2
|
No one on the forum ?
|
|
|
|
| Advert | |
|
|
|
|
#3 |
|
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 101
Karma: 34554
Join Date: Aug 2012
Device: none
|
|
|
|
|
|
|
#4 |
|
Member
![]() Posts: 21
Karma: 10
Join Date: Oct 2013
Location: France
Device: SONY PRS-T2
|
Yes, the idea is to use the same date as in the calibre database. In general I enter some books in calibre, do some tweaking on the tags/covers and copy to the Sony the same day.
Now I imagine that I can use some SQL magic to update the sony database based on the calibre one, but I'm far from having the knowledge ! I had some tries with cygwin's sqlite3 and SQLite expert, but I really don't know how to do it. |
|
|
|
|
|
#5 |
|
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 101
Karma: 34554
Join Date: Aug 2012
Device: none
|
Well, the single steps for a distinct book named book.epub are:
|
|
|
|
| Advert | |
|
|
|
|
#6 |
|
Member
![]() Posts: 21
Karma: 10
Join Date: Oct 2013
Location: France
Device: SONY PRS-T2
|
Fine thanks. Based on this I created a bash script for cygwin:
I did'nt debug all error cases, in particular some grep results are not correctly filtered Code:
#!/bin/bash
# Create book.txt from sony reader database: sqlite3.exe books.db 'select author,title,added_date from books' > book.txt
# Create reference calibre.txt from calibre database: sqlite3.exe metadata.db 'select author_sort,title,timestamp from books' > calibre.txt
#
#
N=0
cat book.txt | while read LINE ; do
N=$((N+1))
echo "Line $N = $LINE"
FOUND=""
BTITLE=`echo "$LINE" | awk -F'|' '{print $2}'`
BDAT=`echo "$LINE" | awk -F'|' '{print $3}'`
# Search title in calibre file
FOUND=`grep "$BTITLE" calibre.txt`
if [ $? -eq 0 ]
then
# Create date based on calibre date
CDAT1=`echo "$FOUND" | awk -F'|' '{print $3}'`
CTITLE=`echo "$FOUND" | awk -F'|' '{print $2}'`
CDAT2=`date --date="$CDAT1" +"%s"`
CDAT="${CDAT2}000"
if [ x"${BDAT}" != x"${CDAT}" ]
then
echo "Line $N = Change \"$BTITLE\" status date to ${CDAT}"
# Update sony datebase with this date
sqlite3 books.db "update books set added_date=$CDAT where title=\"$CTITLE\";"
fi
fi
done
|
|
|
|
![]() |
| Tags |
| date added |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Not Sorting by Date Added? | Enriana | Calibre | 9 | 01-19-2013 12:21 PM |
| Date Added column? Can I set date when book added to library? | fitzhugh | Calibre | 4 | 06-03-2012 06:42 PM |
| Date Added changing | lgladen | Calibre | 5 | 04-14-2011 10:25 AM |
| Date Added vs. Date Modified | aglaia761 | Calibre | 5 | 11-28-2010 06:34 AM |
| Search on Added Date | nynaevelan | Calibre | 6 | 11-10-2010 10:15 PM |