mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-08-11 09:13:57 -04:00
Clean up.
This commit is contained in:
parent
ad65bba05f
commit
daab3e698f
@ -270,7 +270,7 @@ class PRST1(USBMS):
|
|||||||
with closing(sqlite.connect(dbpath)) as connection:
|
with closing(sqlite.connect(dbpath)) as connection:
|
||||||
self.update_device_books(connection, booklist, source_id,
|
self.update_device_books(connection, booklist, source_id,
|
||||||
plugboard, dbpath)
|
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')
|
debug_print('PRST1: finished update_device_database')
|
||||||
|
|
||||||
@ -297,7 +297,7 @@ class PRST1(USBMS):
|
|||||||
|
|
||||||
cursor.close()
|
cursor.close()
|
||||||
|
|
||||||
def read_device_books(self, connection, source_id):
|
def read_device_books(self, connection, source_id, dbpath):
|
||||||
from sqlite3 import DatabaseError
|
from sqlite3 import DatabaseError
|
||||||
|
|
||||||
sequence_min = self.get_database_min_id(source_id)
|
sequence_min = self.get_database_min_id(source_id)
|
||||||
@ -376,14 +376,12 @@ class PRST1(USBMS):
|
|||||||
|
|
||||||
def update_device_books(self, connection, booklist, source_id, plugboard,
|
def update_device_books(self, connection, booklist, source_id, plugboard,
|
||||||
dbpath):
|
dbpath):
|
||||||
from sqlite3 import DatabaseError
|
|
||||||
|
|
||||||
opts = self.settings()
|
opts = self.settings()
|
||||||
upload_covers = opts.extra_customization[self.OPT_UPLOAD_COVERS]
|
upload_covers = opts.extra_customization[self.OPT_UPLOAD_COVERS]
|
||||||
refresh_covers = opts.extra_customization[self.OPT_REFRESH_COVERS]
|
refresh_covers = opts.extra_customization[self.OPT_REFRESH_COVERS]
|
||||||
use_sony_authors = opts.extra_customization[self.OPT_USE_SONY_AUTHORS]
|
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()
|
cursor = connection.cursor()
|
||||||
|
|
||||||
for book in booklist:
|
for book in booklist:
|
||||||
@ -464,7 +462,7 @@ class PRST1(USBMS):
|
|||||||
connection.commit()
|
connection.commit()
|
||||||
cursor.close()
|
cursor.close()
|
||||||
|
|
||||||
def read_device_collections(self, connection, source_id):
|
def read_device_collections(self, connection, source_id, dbpath):
|
||||||
from sqlite3 import DatabaseError
|
from sqlite3 import DatabaseError
|
||||||
|
|
||||||
sequence_min = self.get_database_min_id(source_id)
|
sequence_min = self.get_database_min_id(source_id)
|
||||||
@ -548,11 +546,11 @@ class PRST1(USBMS):
|
|||||||
return db_collections
|
return db_collections
|
||||||
|
|
||||||
def update_device_collections(self, connection, booklist, collections,
|
def update_device_collections(self, connection, booklist, collections,
|
||||||
source_id):
|
source_id, dbpath):
|
||||||
cursor = connection.cursor()
|
cursor = connection.cursor()
|
||||||
|
|
||||||
if collections:
|
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():
|
for collection, books in collections.items():
|
||||||
if collection not in db_collections:
|
if collection not in db_collections:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user