Refactor code structure for improved readability and maintainability

This commit is contained in:
2025-12-10 13:47:34 +01:00
parent 67f967aa09
commit bcb96213ee
73 changed files with 4307 additions and 1315 deletions

View File

@@ -48,7 +48,8 @@ class Catalogue:
log.info(f"Searching for term: {searchterm}")
links = self.get_book_links(searchterm)
print(links)
# debug: links
# print(links)
for elink in links:
result = self.search(elink)
# in result search for class col-xs-12 rds-dl RDS_LOCATION
@@ -179,7 +180,8 @@ class Catalogue:
for link in links:
result = self.search(link)
soup = BeautifulSoup(result, "html.parser")
print(link)
# debug: link
# print(link)
ppn = link.split("/")[-1]
if ppn and regex.match(r"^\d{8,10}[X\d]?$", ppn):
return ppn
@@ -273,14 +275,15 @@ class Catalogue:
# Find the signature for the entry whose location mentions "Semesterapparat"
for g in groups:
print(g)
# debug: group contents
# print(g)
loc = g.get("location", "").lower()
if "semesterapparat" in loc:
signature = g.get("signature")
return signature
signature = g.get("signature")
return signature
print("No signature found")
# print("No signature found")
return signature
def in_library(self, ppn: str) -> bool: