X-Git-Url: https://git.rvb.name/openlib.git/blobdiff_plain/169adb0ddaf8cc3eedfa15b500e14570bda0cdee..5361042232c8aa9f86c46f8533ef9637dcd2904d:/db.py diff --git a/db.py b/db.py index 84a999d..a39c160 100644 --- a/db.py +++ b/db.py @@ -197,6 +197,25 @@ def ListByFormat(format,limit=100): print "No connection to DB" exit() +def ListDups(limit=100): + if database: + c = database.cursor() + c.execute('SELECT b.title,l.author,max(b.id) id FROM metadata.books b,metadata.books_authors_link l where b.id=l.book group by b.title,l.author having count(*)>%s',(limit)) + return c.fetchall() + else: + print "No connection to DB" + exit() + +def ListByTitleAndAuthor(title,author,id=0): + if database: + c = database.cursor() + c.execute('SELECT b.id FROM metadata.books b,metadata.books_authors_link l where b.id=l.book and b.title=%s and l.author=%s and b.id<>%s',(title,author,id)) + return c.fetchall() + else: + print "No connection to DB" + exit() + + def Commit(): if database: database.commit()