8 Commits

Author SHA1 Message Date
Gitea CI
c8b3590355 Bump version: 0.0.4 → 0.0.5 2025-11-19 13:50:08 +00:00
cf8ec8b07e Merge pull request 'feat: get additional data from catalogue:' (#9) from dev into main
Reviewed-on: #9
2025-11-19 13:49:16 +00:00
d74b94b769 feat: get additional data from catalogue:
Some checks failed
/ typecheck (pull_request) Failing after 37s
- signature
 - isbn (bit broken rn)
 - pages (only for print books)
2025-11-19 14:48:42 +01:00
Gitea CI
2d08c2959a Bump version: 0.0.3 → 0.0.4
Some checks failed
continuous-integration/drone/push Build is failing
2025-11-13 20:20:31 +00:00
5da3050da6 Update pyproject.toml
Some checks failed
continuous-integration/drone/push Build is failing
2025-11-13 09:58:44 +00:00
Gitea CI
e681c8ba92 Bump version: 0.0.2 → 0.0.3
Some checks failed
continuous-integration/drone/push Build is failing
2025-11-13 09:56:26 +00:00
3a6da75c8f Merge pull request 'Update .gitea/workflows/build_and_publish.yml' (#7) from dev into main
Some checks failed
continuous-integration/drone/push Build is failing
Reviewed-on: #7
2025-11-13 09:55:47 +00:00
5c8ffb45c0 Update .gitea/workflows/build_and_publish.yml
Some checks failed
/ typecheck (pull_request) Failing after 1m59s
2025-11-13 09:55:33 +00:00
3 changed files with 45 additions and 3 deletions

View File

@@ -54,7 +54,7 @@ jobs:
uses: https://github.com/mikepenz/release-changelog-builder-action@v5 uses: https://github.com/mikepenz/release-changelog-builder-action@v5
with: with:
platform: "gitea" platform: "gitea"
baseURL: "http://gitea:3000" baseURL: "http://192.168.178.110:3000"
configuration: ".gitea/changelog_config.json" configuration: ".gitea/changelog_config.json"
env: env:

View File

@@ -1,6 +1,6 @@
[project] [project]
name = "bibapi" name = "bibapi"
version = "0.1.0" version = "0.0.5"
description = "Add your description here" description = "Add your description here"
readme = "README.md" readme = "README.md"
authors = [ authors = [
@@ -20,7 +20,7 @@ requires = ["uv_build >= 0.9.5, <0.10.0"]
build-backend = "uv_build" build-backend = "uv_build"
[tool.bumpversion] [tool.bumpversion]
current_version = "0.0.2" current_version = "0.0.5"
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)" parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
serialize = ["{major}.{minor}.{patch}"] serialize = ["{major}.{minor}.{patch}"]
search = "{current_version}" search = "{current_version}"

View File

@@ -4,6 +4,8 @@ import regex
import requests import requests
from bs4 import BeautifulSoup from bs4 import BeautifulSoup
from .schemas.bookdata import BookData as Book
URL = "https://rds.ibs-bw.de/phfreiburg/opac/RDSIndex/Search?type0%5B%5D=allfields&lookfor0%5B%5D={}&join=AND&bool0%5B%5D=AND&type0%5B%5D=au&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=ti&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=ct&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=isn&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=ta&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=co&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=py&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=pp&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=pu&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=si&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=zr&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=cc&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND" URL = "https://rds.ibs-bw.de/phfreiburg/opac/RDSIndex/Search?type0%5B%5D=allfields&lookfor0%5B%5D={}&join=AND&bool0%5B%5D=AND&type0%5B%5D=au&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=ti&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=ct&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=isn&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=ta&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=co&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=py&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=pp&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=pu&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=si&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=zr&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND&type0%5B%5D=cc&lookfor0%5B%5D=&join=AND&bool0%5B%5D=AND"
BASE = "https://rds.ibs-bw.de" BASE = "https://rds.ibs-bw.de"
@@ -156,6 +158,46 @@ class Catalogue:
edition=edition, edition=edition,
) )
def get_book_with_data(self, searchterm: str) -> Book | None:
book = self.get_book(searchterm)
if book:
# request data from book.link and parse for additional data
result = self.search(book.link)
soup = BeautifulSoup(result, "html.parser")
# from div col-xs-12 rds-dl RDS_SIGNATURE get signature (second div in this div)
signature = None
signature_el = soup.find("div", class_="RDS_SIGNATURE")
print(signature_el)
if signature_el:
signature = signature_el.find("div", class_="rds-dl-panel").get_text(
strip=True
)
print(signature)
book.signature = signature
# from div col-xs-12 col-md-5 col-lg-4 rds-dl-head RDS_ISBN get isbn (second div in this div)
isbn = None
isbn_el = soup.find("div", class_="RDS_ISBN")
if isbn_el:
isbn = isbn_el.find_next_sibling(
"div", class_="col-xs-12 col-md-7 col-lg-8 rds-dl-panel"
).get_text(strip=True)
book.isbn = isbn
# from div col-xs-12 col-md-5 col-lg-4 rds-dl-head RDS_SCOPE get pages (second div in this div)
pages = None
pages_el = soup.find("div", class_="RDS_SCOPE")
if pages_el:
pages = pages_el.find_next_sibling(
"div", class_="col-xs-12 col-md-7 col-lg-8 rds-dl-panel"
).get_text(strip=True)
# regex match to get pages by grabbing the first number in the string
match = regex.search(r"(\d+)", pages)
if match:
pages = match.group(1)
book.pages = pages
return book
return None
def get(self, ppn: str) -> Book | None: def get(self, ppn: str) -> Book | None:
# based on PPN, get title, people, edition, year, language, pages, isbn, # based on PPN, get title, people, edition, year, language, pages, isbn,
link = f"https://rds.ibs-bw.de/phfreiburg/opac/RDSIndexrecord/{ppn}" link = f"https://rds.ibs-bw.de/phfreiburg/opac/RDSIndexrecord/{ppn}"