changes
This commit is contained in:
@@ -1,14 +1,13 @@
|
|||||||
institution_name: HB Testbibliothek Psychologie
|
institution_name: HB Testbibliothek Psychologie
|
||||||
default_loan_duration: 7
|
default_loan_duration: 7
|
||||||
database:
|
database:
|
||||||
path: C:/newestdb_mew
|
path: C:/testdatabase_1
|
||||||
name: libraries.db
|
name: libr.db
|
||||||
backupLocation: V:/backup
|
backupLocation: V:/backup
|
||||||
do_backup: false
|
do_backup: false
|
||||||
report:
|
report:
|
||||||
generate_report: false
|
generate_report: false
|
||||||
email: None
|
email: None
|
||||||
|
|
||||||
debug: false
|
debug: false
|
||||||
log_debug: false
|
log_debug: false
|
||||||
catalogue: True
|
catalogue: True
|
||||||
|
|||||||
1
icons/calendar_event.svg
Normal file
1
icons/calendar_event.svg
Normal 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
1
icons/duplicate.svg
Normal 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 |
@@ -10,4 +10,6 @@ icons:
|
|||||||
borrow: book.svg
|
borrow: book.svg
|
||||||
backup: db_backup.svg
|
backup: db_backup.svg
|
||||||
addBook: add_book.svg
|
addBook: add_book.svg
|
||||||
report: report.svg
|
report: report.svg
|
||||||
|
duplicate: duplicate.svg
|
||||||
|
loan_extend: calendar_event.svg
|
||||||
@@ -1,2 +1,13 @@
|
|||||||
import omegaconf
|
import omegaconf
|
||||||
config = omegaconf.OmegaConf.load("config/settings.yaml")
|
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
|
||||||
@@ -2,15 +2,28 @@ import requests
|
|||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
from src import config
|
from src import config
|
||||||
from src.schemas import Book
|
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'
|
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"
|
BASE = "https://rds.ibs-bw.de"
|
||||||
|
|
||||||
|
log = Log("Catalogue")
|
||||||
|
|
||||||
class Catalogue:
|
class Catalogue:
|
||||||
def __init__(self, timeout=5):
|
def __init__(self, timeout=5):
|
||||||
self.timeout = timeout
|
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):
|
def search_book(self, searchterm: str):
|
||||||
response = requests.get(URL.format(searchterm), timeout=self.timeout)
|
response = requests.get(URL.format(searchterm), timeout=self.timeout)
|
||||||
return response.text
|
return response.text
|
||||||
@@ -29,6 +42,8 @@ class Catalogue:
|
|||||||
return res
|
return res
|
||||||
|
|
||||||
def get_book(self, searchterm: str):
|
def get_book(self, searchterm: str):
|
||||||
|
log.info(f"Searching for term: {searchterm}")
|
||||||
|
|
||||||
links = self.get_book_links(searchterm)
|
links = self.get_book_links(searchterm)
|
||||||
for link in links:
|
for link in links:
|
||||||
result = self.search(link)
|
result = self.search(link)
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ class NewEntry(QtWidgets.QDialog, Ui_Dialog):
|
|||||||
)
|
)
|
||||||
def populateTable(self):
|
def populateTable(self):
|
||||||
for title in self.titles:
|
for title in self.titles:
|
||||||
print(title)
|
# print(title)
|
||||||
entries = self.db.getMediaSimilarSignatureByID(title)
|
entries = self.db.getMediaSimilarSignatureByID(title)
|
||||||
# sort by signature
|
# sort by signature
|
||||||
entries.sort(key=lambda x: x.signature, reverse=True)
|
entries.sort(key=lambda x: x.signature, reverse=True)
|
||||||
@@ -66,7 +66,7 @@ class NewEntry(QtWidgets.QDialog, Ui_Dialog):
|
|||||||
signature=signature,
|
signature=signature,
|
||||||
ppn=eval(ppn),
|
ppn=eval(ppn),
|
||||||
)
|
)
|
||||||
print(book)
|
# print(book)
|
||||||
if not self.db.checkMediaExists(book):
|
if not self.db.checkMediaExists(book):
|
||||||
newBookId = self.db.insertMedia(book)
|
newBookId = self.db.insertMedia(book)
|
||||||
self.newIds.append(newBookId)
|
self.newIds.append(newBookId)
|
||||||
|
|||||||
@@ -1,2 +1,4 @@
|
|||||||
from .stringtodate import stringToDate
|
from .log import Log
|
||||||
from .icon import Icon
|
from .icon import Icon
|
||||||
|
from .debug import debugMessage
|
||||||
|
from .stringtodate import stringToDate
|
||||||
Reference in New Issue
Block a user