This commit is contained in:
WorldTeacher
2024-07-30 10:08:41 +02:00
parent 7ea612d9ef
commit f1a33e7ea8
8 changed files with 40 additions and 9 deletions

View File

@@ -1,14 +1,13 @@
institution_name: HB Testbibliothek Psychologie
default_loan_duration: 7
database:
path: C:/newestdb_mew
name: libraries.db
path: C:/testdatabase_1
name: libr.db
backupLocation: V:/backup
do_backup: false
report:
generate_report: false
email: None
debug: false
log_debug: false
catalogue: True

1
icons/calendar_event.svg Normal file
View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#c0c0c0"><path d="M580-240q-42 0-71-29t-29-71q0-42 29-71t71-29q42 0 71 29t29 71q0 42-29 71t-71 29ZM200-80q-33 0-56.5-23.5T120-160v-560q0-33 23.5-56.5T200-800h40v-80h80v80h320v-80h80v80h40q33 0 56.5 23.5T840-720v560q0 33-23.5 56.5T760-80H200Zm0-80h560v-400H200v400Zm0-480h560v-80H200v80Zm0 0v-80 80Z"/></svg>

After

Width:  |  Height:  |  Size: 405 B

1
icons/duplicate.svg Normal file
View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#c0c0c0"><path d="M360-240q-33 0-56.5-23.5T280-320v-480q0-33 23.5-56.5T360-880h360q33 0 56.5 23.5T800-800v480q0 33-23.5 56.5T720-240H360Zm0-80h360v-480H360v480ZM200-80q-33 0-56.5-23.5T120-160v-560h80v560h440v80H200Zm160-240v-480 480Z"/></svg>

After

Width:  |  Height:  |  Size: 340 B

View File

@@ -11,3 +11,5 @@ icons:
backup: db_backup.svg
addBook: add_book.svg
report: report.svg
duplicate: duplicate.svg
loan_extend: calendar_event.svg

View File

@@ -1,2 +1,13 @@
import omegaconf
import sys
__version__ = "0.0.1"
__author__ = "Alexander Kirchner"
config = omegaconf.OmegaConf.load("config/settings.yaml")
# if programm launched with argument --debug, set debug to True
if "--debug" in sys.argv:
config.debug = True
if "--log" in sys.argv:
config.log_debug = True

View File

@@ -2,15 +2,28 @@ import requests
from bs4 import BeautifulSoup
from src import config
from src.schemas import Book
from src.utils import Log
URL = 'https://rds.ibs-bw.de/phfreiburg/opac/RDSIndex/Search?lookfor="{}"+&type=AllFields&limit=10&sort=py+desc%2C+title'
BASE = "https://rds.ibs-bw.de"
log = Log("Catalogue")
class Catalogue:
def __init__(self, timeout=5):
self.timeout = timeout
reachable = self.check_connection()
if reachable:
config.catalogue = True
else:
config.catalogue = False
def check_connection(self):
try:
response = requests.get("https://www.google.com", timeout=self.timeout)
if response.status_code == 200:
return True
except requests.exceptions.RequestException as e:
log.error(f"Could not connect to google.com: {e}")
def search_book(self, searchterm: str):
response = requests.get(URL.format(searchterm), timeout=self.timeout)
return response.text
@@ -29,6 +42,8 @@ class Catalogue:
return res
def get_book(self, searchterm: str):
log.info(f"Searching for term: {searchterm}")
links = self.get_book_links(searchterm)
for link in links:
result = self.search(link)

View File

@@ -40,7 +40,7 @@ class NewEntry(QtWidgets.QDialog, Ui_Dialog):
)
def populateTable(self):
for title in self.titles:
print(title)
# print(title)
entries = self.db.getMediaSimilarSignatureByID(title)
# sort by signature
entries.sort(key=lambda x: x.signature, reverse=True)
@@ -66,7 +66,7 @@ class NewEntry(QtWidgets.QDialog, Ui_Dialog):
signature=signature,
ppn=eval(ppn),
)
print(book)
# print(book)
if not self.db.checkMediaExists(book):
newBookId = self.db.insertMedia(book)
self.newIds.append(newBookId)

View File

@@ -1,2 +1,4 @@
from .stringtodate import stringToDate
from .log import Log
from .icon import Icon
from .debug import debugMessage
from .stringtodate import stringToDate