updates
This commit is contained in:
@@ -68,7 +68,7 @@ class WebRequest:
|
|||||||
return response.text
|
return response.text
|
||||||
|
|
||||||
def get_data(
|
def get_data(
|
||||||
self,
|
self
|
||||||
):
|
):
|
||||||
links = self.get_book_links(self.ppn)
|
links = self.get_book_links(self.ppn)
|
||||||
print(links)
|
print(links)
|
||||||
@@ -83,7 +83,6 @@ class WebRequest:
|
|||||||
item_location = location.find(
|
item_location = location.find(
|
||||||
"div", class_="col-xs-12 col-md-7 col-lg-8 rds-dl-panel"
|
"div", class_="col-xs-12 col-md-7 col-lg-8 rds-dl-panel"
|
||||||
).text.strip()
|
).text.strip()
|
||||||
print(item_location)
|
|
||||||
if f"Semesterapparat-{self.apparat}" in item_location:
|
if f"Semesterapparat-{self.apparat}" in item_location:
|
||||||
pre_tag = soup.find_all("pre")
|
pre_tag = soup.find_all("pre")
|
||||||
return_data = []
|
return_data = []
|
||||||
@@ -115,7 +114,7 @@ class BibTextTransformer:
|
|||||||
if mode not in self.valid_modes:
|
if mode not in self.valid_modes:
|
||||||
logger.log_error(f"Mode {mode} not valid")
|
logger.log_error(f"Mode {mode} not valid")
|
||||||
raise ValueError(f"Mode {mode} not valid")
|
raise ValueError(f"Mode {mode} not valid")
|
||||||
# print(self.field)
|
# # print(self.field)
|
||||||
self.data = None
|
self.data = None
|
||||||
# self.bookdata = BookData(**self.data)
|
# self.bookdata = BookData(**self.data)
|
||||||
|
|
||||||
@@ -125,6 +124,11 @@ class BibTextTransformer:
|
|||||||
COinS_IDENT = "ctx_ver"
|
COinS_IDENT = "ctx_ver"
|
||||||
BIBTEX_IDENT = "@book"
|
BIBTEX_IDENT = "@book"
|
||||||
RDS_IDENT = "RDS ---------------------------------- "
|
RDS_IDENT = "RDS ---------------------------------- "
|
||||||
|
|
||||||
|
if data is None:
|
||||||
|
self.data = None
|
||||||
|
return self
|
||||||
|
|
||||||
if self.mode == "RIS":
|
if self.mode == "RIS":
|
||||||
for line in data:
|
for line in data:
|
||||||
if RIS_IDENT in line:
|
if RIS_IDENT in line:
|
||||||
@@ -154,8 +158,10 @@ class BibTextTransformer:
|
|||||||
option (string, optional): Option for RDS as there are two filetypes. Use rds_availability or rds_data. Anything else gives a dict of both responses. Defaults to None.
|
option (string, optional): Option for RDS as there are two filetypes. Use rds_availability or rds_data. Anything else gives a dict of both responses. Defaults to None.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
BookData: _description_
|
BookData: a dataclass containing data aboout the book
|
||||||
"""
|
"""
|
||||||
|
if self.data is None:
|
||||||
|
return None
|
||||||
if self.mode == "ARRAY":
|
if self.mode == "ARRAY":
|
||||||
return ARRAYData().transform(self.data)
|
return ARRAYData().transform(self.data)
|
||||||
elif self.mode == "COinS":
|
elif self.mode == "COinS":
|
||||||
@@ -170,7 +176,7 @@ class BibTextTransformer:
|
|||||||
|
|
||||||
def cover(isbn):
|
def cover(isbn):
|
||||||
test_url = f"https://www.buchhandel.de/cover/{isbn}/{isbn}-cover-m.jpg"
|
test_url = f"https://www.buchhandel.de/cover/{isbn}/{isbn}-cover-m.jpg"
|
||||||
print(test_url)
|
# print(test_url)
|
||||||
data = requests.get(test_url, stream=True)
|
data = requests.get(test_url, stream=True)
|
||||||
return data.content
|
return data.content
|
||||||
|
|
||||||
@@ -180,22 +186,9 @@ def get_content(soup, css_class):
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
print("main")
|
# print("main")
|
||||||
link = "ZE 77000 W492"
|
link = "CU 8500 K64"
|
||||||
data = WebRequest().get_ppn(link).get_data()
|
data = WebRequest(71).get_ppn(link).get_data()
|
||||||
|
bib = BibTextTransformer("ARRAY").get_data().return_data()
|
||||||
|
print(bib)
|
||||||
|
|
||||||
print(data)
|
|
||||||
# # data.get_ppn("ME 3000 S186 (2)")
|
|
||||||
# # print(data.ppn)
|
|
||||||
# # desc=data.get_data()
|
|
||||||
# # print(type(desc))
|
|
||||||
# # print(desc)
|
|
||||||
# txt = (
|
|
||||||
# BibTextTransformer("RIS")
|
|
||||||
# .get_data(WebRequest().get_ppn("ST 250 U42 (15)").get_data())
|
|
||||||
# .return_data()
|
|
||||||
# )
|
|
||||||
# print(txt)
|
|
||||||
|
|
||||||
# print(data)
|
|
||||||
# print(BibTextTransformer(data).bookdata)
|
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ class LoginDialog(Ui_Dialog):
|
|||||||
def login(self):
|
def login(self):
|
||||||
username = self.lineEdit.text()
|
username = self.lineEdit.text()
|
||||||
password = self.lineEdit_2.text()
|
password = self.lineEdit_2.text()
|
||||||
print(type(username), password)
|
# print(type(username), password)
|
||||||
# Assuming 'Database' is a class to interact with your database
|
# Assuming 'Database' is a class to interact with your database
|
||||||
|
|
||||||
hashed_password = hashlib.sha256(password.encode()).hexdigest()
|
hashed_password = hashlib.sha256(password.encode()).hexdigest()
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ Tel.: 0761/682-778"""
|
|||||||
return config.mail.signature
|
return config.mail.signature
|
||||||
|
|
||||||
def load_mail_templates(self):
|
def load_mail_templates(self):
|
||||||
print("loading mail templates")
|
# print("loading mail templates")
|
||||||
logger.log_info("Loading mail templates")
|
logger.log_info("Loading mail templates")
|
||||||
mail_templates = os.listdir("mail_vorlagen")
|
mail_templates = os.listdir("mail_vorlagen")
|
||||||
logger.log_info(f"Mail templates: {mail_templates}")
|
logger.log_info(f"Mail templates: {mail_templates}")
|
||||||
@@ -159,12 +159,12 @@ Tel.: 0761/682-778"""
|
|||||||
# server.starttls()
|
# server.starttls()
|
||||||
# server.auth(mechanism="PLAIN")
|
# server.auth(mechanism="PLAIN")
|
||||||
if config["mail"]["use_user_name"] is True:
|
if config["mail"]["use_user_name"] is True:
|
||||||
print(config["mail"]["user_name"])
|
# print(config["mail"]["user_name"])
|
||||||
server.login(config["mail"]["user_name"], password)
|
server.login(config["mail"]["user_name"], password)
|
||||||
else:
|
else:
|
||||||
server.login(sender_email, password)
|
server.login(sender_email, password)
|
||||||
server.sendmail(sender_email, tolist, mail)
|
server.sendmail(sender_email, tolist, mail)
|
||||||
print("Mail sent")
|
# print("Mail sent")
|
||||||
# end active process
|
# end active process
|
||||||
server.quit()
|
server.quit()
|
||||||
logger.log_info("Mail sent, closing connection to server and dialog")
|
logger.log_info("Mail sent, closing connection to server and dialog")
|
||||||
|
|||||||
@@ -57,4 +57,4 @@ def lauhc_gui():
|
|||||||
dialog = MedienAdder()
|
dialog = MedienAdder()
|
||||||
dialog.show()
|
dialog.show()
|
||||||
app.exec()
|
app.exec()
|
||||||
print(dialog.mode, dialog.data, dialog.result())
|
# print(dialog.mode, dialog.data, dialog.result())
|
||||||
@@ -17,7 +17,6 @@ from PyQt6.QtGui import QRegularExpressionValidator
|
|||||||
|
|
||||||
from src import Icon
|
from src import Icon
|
||||||
from src.backend import (
|
from src.backend import (
|
||||||
AdminCommands,
|
|
||||||
Database,
|
Database,
|
||||||
generateSemesterByDate,
|
generateSemesterByDate,
|
||||||
recreateFile,
|
recreateFile,
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ from PyQt6.QtCore import QDate
|
|||||||
from src import Icon
|
from src import Icon
|
||||||
from src.backend import recreateElsaFile, generateSemesterByDate, Database
|
from src.backend import recreateElsaFile, generateSemesterByDate, Database
|
||||||
from src.logic import elsa_word_to_csv, MyLogger
|
from src.logic import elsa_word_to_csv, MyLogger
|
||||||
|
from src.ui import popus_confirm
|
||||||
from src.ui.dialogs import ElsaAddEntry
|
from src.ui.dialogs import ElsaAddEntry
|
||||||
from src.ui.widgets import FilePicker
|
from src.ui.widgets import FilePicker
|
||||||
from src.ui.widgets import DataGraph
|
from src.ui.widgets import DataGraph
|
||||||
@@ -107,6 +108,14 @@ class ElsaDialog(QtWidgets.QDialog, Ui_Dialog):
|
|||||||
self.elsa_update.setEnabled(False)
|
self.elsa_update.setEnabled(False)
|
||||||
self.cancel_elsa_creation()
|
self.cancel_elsa_creation()
|
||||||
|
|
||||||
|
def confirm_popup(self, message: str, title: str):
|
||||||
|
popup = popus_confirm(title=title)
|
||||||
|
popup.textEdit.setReadOnly(True)
|
||||||
|
popup.textEdit.setText(message)
|
||||||
|
|
||||||
|
popup.exec()
|
||||||
|
return popup.result()
|
||||||
|
|
||||||
def save_elsa(self):
|
def save_elsa(self):
|
||||||
if (
|
if (
|
||||||
self.elsa_prof.currentText() == ""
|
self.elsa_prof.currentText() == ""
|
||||||
|
|||||||
Reference in New Issue
Block a user