Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Development

Notices

Reply
 
Thread Tools Search this Thread
Old 04-19-2025, 02:15 PM   #1
dunhill
Guru
dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.
 
dunhill's Avatar
 
Posts: 923
Karma: 810834
Join Date: Sep 2017
Location: Buenos Aires, Argentina
Device: moon+ reader, kindle paperwhite
Script to avoid downloading existing duplicates in calibre

Hi, I have a script to download books that checks if they exist in Calibre, but when I add them to Calibre, Calibre shows duplicates. What could I refine for that search? What I have stipulated is this:
Code:
# �� Search for exact matches in the calibre database
def find_identical_books(title):
try:
conn = sqlite3.connect(f"file:{CALIBRE_DB_PATH}?mode=ro", uri=True)
cursor = conn.cursor()

title = unicodedata.normalize("NFC", title).strip()
cursor.execute("SELECT id FROM books WHERE lower(title) = lower(?)", (title,))

result = cursor.fetchall()
conn.close()
return [r[0] for r in result] if result else []
except Exception as e:
log_message(f"⚠️ Error searching for duplicates in calibre: {e}")
return []
Any help is welcome to test this out.
dunhill is offline   Reply With Quote
Old 04-19-2025, 11:24 PM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,609
Karma: 28549044
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
You use the calibre db api for this:
https://manual.calibre-ebook.com/db_api.html

not raw sqllite.
kovidgoyal is offline   Reply With Quote
Advert
Old 04-20-2025, 01:08 PM   #3
dunhill
Guru
dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.
 
dunhill's Avatar
 
Posts: 923
Karma: 810834
Join Date: Sep 2017
Location: Buenos Aires, Argentina
Device: moon+ reader, kindle paperwhite
Thank you, that's what I was missing.
dunhill is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Downloading metadata: Comments adding to the existing text ownedbycats Calibre 2 10-20-2021 12:49 PM
calibre, version 4.2.0 ERROR: No existing library found: There is no existing library Alastair1646 Library Management 1 10-28-2019 10:26 AM
Duplicates handling with Find Duplicates plugin erfjr Calibre 0 03-05-2013 03:52 PM
Script: store calibre ebooks as symlinks to existing lib; advanced CLI import dancal Calibre 0 12-10-2012 08:09 PM
Calibre Duplicates Starson17 Calibre 10 10-20-2010 01:06 PM


All times are GMT -4. The time now is 04:59 AM.


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