mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-09 02:02:41 +02:00
Clean up.
This commit is contained in:
parent
ad65bba05f
commit
daab3e698f
1 changed files with 6 additions and 8 deletions
|
|
@ -270,7 +270,7 @@ def update_device_database(self, booklist, collections_attributes, oncard):
|
|||
with closing(sqlite.connect(dbpath)) as connection:
|
||||
self.update_device_books(connection, booklist, source_id,
|
||||
plugboard, dbpath)
|
||||
self.update_device_collections(connection, booklist, collections, source_id)
|
||||
self.update_device_collections(connection, booklist, collections, source_id, dbpath)
|
||||
|
||||
debug_print('PRST1: finished update_device_database')
|
||||
|
||||
|
|
@ -297,7 +297,7 @@ def set_database_sequence_id(self, connection, table, sequence_id):
|
|||
|
||||
cursor.close()
|
||||
|
||||
def read_device_books(self, connection, source_id):
|
||||
def read_device_books(self, connection, source_id, dbpath):
|
||||
from sqlite3 import DatabaseError
|
||||
|
||||
sequence_min = self.get_database_min_id(source_id)
|
||||
|
|
@ -376,14 +376,12 @@ def read_device_books(self, connection, source_id):
|
|||
|
||||
def update_device_books(self, connection, booklist, source_id, plugboard,
|
||||
dbpath):
|
||||
from sqlite3 import DatabaseError
|
||||
|
||||
opts = self.settings()
|
||||
upload_covers = opts.extra_customization[self.OPT_UPLOAD_COVERS]
|
||||
refresh_covers = opts.extra_customization[self.OPT_REFRESH_COVERS]
|
||||
use_sony_authors = opts.extra_customization[self.OPT_USE_SONY_AUTHORS]
|
||||
|
||||
db_books = self.read_device_books(connection, source_id)
|
||||
db_books = self.read_device_books(connection, source_id, dbpath)
|
||||
cursor = connection.cursor()
|
||||
|
||||
for book in booklist:
|
||||
|
|
@ -464,7 +462,7 @@ def update_device_books(self, connection, booklist, source_id, plugboard,
|
|||
connection.commit()
|
||||
cursor.close()
|
||||
|
||||
def read_device_collections(self, connection, source_id):
|
||||
def read_device_collections(self, connection, source_id, dbpath):
|
||||
from sqlite3 import DatabaseError
|
||||
|
||||
sequence_min = self.get_database_min_id(source_id)
|
||||
|
|
@ -548,11 +546,11 @@ def read_device_collections(self, connection, source_id):
|
|||
return db_collections
|
||||
|
||||
def update_device_collections(self, connection, booklist, collections,
|
||||
source_id):
|
||||
source_id, dbpath):
|
||||
cursor = connection.cursor()
|
||||
|
||||
if collections:
|
||||
db_collections = self.read_device_collections(connection, source_id)
|
||||
db_collections = self.read_device_collections(connection, source_id, dbpath)
|
||||
|
||||
for collection, books in collections.items():
|
||||
if collection not in db_collections:
|
||||
|
|
|
|||
Loading…
Reference in a new issue