@jackie_w: if you normally use the new DB interface then you can get a new db handle with something like the following function
Code:
def init_cache(library_path):
from calibre.db.backend import DB
from calibre.db.cache import Cache
backend = DB(library_path)
cache = Cache(backend)
cache.init()
return cache
You would use it in some way like the following, of course depending on what you are doing
Code:
cache = init_cache(sys.argv[1])
# Loop through all the books in the library
for id_ in cache.all_book_ids():
.....