View Single Post
Old 09-12-2010, 03:00 AM   #21
brewjono
Zealot
brewjono ought to be getting tired of karma fortunes by now.brewjono ought to be getting tired of karma fortunes by now.brewjono ought to be getting tired of karma fortunes by now.brewjono ought to be getting tired of karma fortunes by now.brewjono ought to be getting tired of karma fortunes by now.brewjono ought to be getting tired of karma fortunes by now.brewjono ought to be getting tired of karma fortunes by now.brewjono ought to be getting tired of karma fortunes by now.brewjono ought to be getting tired of karma fortunes by now.brewjono ought to be getting tired of karma fortunes by now.brewjono ought to be getting tired of karma fortunes by now.
 
brewjono's Avatar
 
Posts: 106
Karma: 501816
Join Date: Jan 2010
Location: Australia
Device: K3, K4, KPW
Quote:
Originally Posted by Starson17 View Post
I find duplicate titles by opening up the metadata.db file in sqlitespy and using an sql query.

Alternatively, this will also do it:

Code:
calibre-debug -c "from calibre.library.database2 import LibraryDatabase2; db = LibraryDatabase2('/path/to/library/folder');dupes = db.conn.get('select title from books group by title having count(*) > 1;');print dupes;">dupes.txt
Copy that long line, change the path to point to your library folder and paste it into a command window (terminal window, dos box, whatever you call it) and it will produce a file in the current directory called dupes.txt with all your duplicate titles in it. It's a list of dupe titles in unicode format.
Thanks very much for this. It worked for me, but took a while to work out which part was the path.

For people a bit slow like me I've included my path to help.

calibre-debug -c "from calibre.library.database2 import LibraryDatabase2; db = LibraryDatabase2('c:/users/frank/documents/my ebooks/calibre');dupes = db.conn.get('select title from books group by title having count(*) > 1;');print dupes;">dupes.txt

Using Vista I went to the start menu, selected "Run". When that came up I typed in "cmd" and enter. That brought up a traditional DOS window.

I copied the text from above into word where I edited it with my path, then pasted it into the dos window.

It then ran and I did a search for "dupes.txt". It was in the C: root. Opened it and manually went through Calibre.

I have almost 10,000 books and found almost 100 legitimate dupes.

Brewjono.
brewjono is offline   Reply With Quote