feat: enhance BookGrabber to support any and exact book modes

This commit is contained in:
2024-11-26 10:18:54 +01:00
parent e3c81f1bbd
commit b3a5fc1948

View File

@@ -23,14 +23,18 @@ class BookGrabber(QThread):
self.prof_id = None
self.mode = None
self.book_id = None
self.use_any = False
self.use_exact = False
self.appnr = appnr
self.tstate = (self.app_id, self.prof_id, self.mode, self.data)
def add_values(self, app_id, prof_id, mode, data):
def add_values(self, app_id, prof_id, mode, data, any_book=False, exact=False):
self.app_id = app_id
self.prof_id = prof_id
self.mode = mode
self.data = data
self.use_any = any_book
self.use_exact = exact
self.logger.log_info(f"Working on {len(self.data)} entries")
self.tstate = (self.app_id, self.prof_id, self.mode, self.data)
self.logger.log_debug("State: " + str(self.tstate))
@@ -48,13 +52,18 @@ class BookGrabber(QThread):
signature = str(entry)
self.logger.log_info("Processing entry: " + signature)
webdata = WebRequest().set_apparat(self.appnr).get_ppn(entry).use_any_book().get_data()
webdata = WebRequest().set_apparat(self.appnr).get_ppn(entry)
if self.use_any:
webdata = webdata.use_any_book
webdata = webdata.get_data()
if webdata == "error":
continue
bd = BibTextTransformer(self.mode).get_data(webdata).return_data()
bd = BibTextTransformer(self.mode)
if self.use_exact:
bd = bd.use_signature(entry)
bd = bd.get_data(webdata).return_data()
if bd is None:
# bd = BookData
continue