I want to update the find duplicates plugin to use get_proxy_metadata instead of get_metadata, as per chaley's advice
here. There is no problem doing this when comparing duplicates in one library. However problems arise when trying to find cross library duplicates. The original code by kiwidude initializes the target library as follows:
Code:
from calibre.library.database2 import LibraryDatabase2
self.target_db = LibraryDatabase2(self.library_path, read_only=True, is_second_db=True)
problem with the above approach is that I cannot use new_api methods like get_proxy_metadata. I get the following error:
Code:
AttributeError: 'LibraryDatabase2' object has no attribute 'new_api'
My alternative approach would be initializing the target_db as follows:
Code:
from calibre.library import db as DB
self.target_db = DB(self.library_path, read_only=True)
Is there any reason to avoid using the second approach? I am having doubts because this seems like the obvious choice, so maybe kiwidude deliberately avoided that for a reason not obvious to me.