diff --git a/app/__pycache__/main.cpython-313.pyc b/app/__pycache__/main.cpython-313.pyc index 0e60fa8..d3135f0 100644 Binary files a/app/__pycache__/main.cpython-313.pyc and b/app/__pycache__/main.cpython-313.pyc differ diff --git a/app/main.py b/app/main.py index 647576d..978118d 100644 --- a/app/main.py +++ b/app/main.py @@ -389,7 +389,7 @@ def make_savepath( def get_lvpath(lva: str) -> Tuple[int, str]: - """returns the path in UNIZEUG from a LVA based on its LVID (or name) that may be within a string. It uses the path within the database. If there is no Entry with a fitting LVID in the database it creates a new LVA.""" + """returns the path in UNIZEUG from a LVA based on its LVID (or name) that may be within a string. It uses the path within the database. If there is no Entry with a fitting LVID in the database it creates a new LVA. Returns: (id,path)""" cur = db.cursor() lvid = re.search(r"[a-zA-Z0-9]{3}\.[a-zA-Z0-9]{3}", lva) if lvid is not None: @@ -412,7 +412,7 @@ def get_lvpath(lva: str) -> Tuple[int, str]: def get_profpath(prof: str, lid: int) -> Tuple[int, str]: - """Generates the foldername for a prof based on his name. It searches the database for matches.""" + """Generates the foldername for a prof based on his name. It searches the database for matches. Returns: (id,name)""" cur = db.cursor() prof = prof.replace("_", " ") cur.execute("SELECT id,name FROM Profs WHERE name=?", (prof,)) @@ -439,7 +439,7 @@ def get_profpath(prof: str, lid: int) -> Tuple[int, str]: def get_subcatpath(subcat: str, cat: int, pid: int, lid: int) -> Tuple[int, str]: - """Generates the subcat path from a subcat name.""" + """Generates the subcat path from a subcat name. Returns: (id,name)""" cur = db.cursor() cur.execute( "SELECT id,name FROM SubCats WHERE LId=? AND PId=? AND cat=? AND name=?", @@ -452,7 +452,7 @@ def get_subcatpath(subcat: str, cat: int, pid: int, lid: int) -> Tuple[int, str] def makenew(input: str, table: str, **kwargs) -> Tuple[int, str]: - """Generates new Entrys in the database for LVAs, Profs, SUBCATS""" + """Generates new Entrys in the database for LVAs, Profs, SUBCATS. Returns: (id,name/path)""" cur = db.cursor() if table == "LVAs": lvaid = re.search(r"[a-zA-Z0-9]{3}\.[a-zA-Z0-9]{3}", input) @@ -485,12 +485,14 @@ def makenew(input: str, table: str, **kwargs) -> Tuple[int, str]: def linkLP(lid: int, pid: int): + """declares that a Prof (id in database) offers a LVA (id in database)""" cur = db.cursor() cur.execute("INSERT INTO LPLink(LId,PId) VALUES(?,?)", (lid, pid)) db.commit() def convert_to_pdf(file: bytes) -> bytes | None: + """Converts an image(thats all thats implemented right now) into a pdf.""" # ft = filetype.guess(file) # cid = hash(file) # if ( diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..e788402 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,64 @@ +annotated-types==0.7.0 +anyio==4.8.0 +bcrypt==4.2.1 +certifi==2024.12.14 +cffi==1.17.1 +charset-normalizer==3.4.1 +click==8.1.8 +comtypes==1.4.10 +cryptography==44.0.0 +dnspython==2.7.0 +docopt==0.6.2 +email_validator==2.2.0 +fastapi==0.115.7 +fastapi-cli==0.0.7 +filetype==1.2.0 +h11==0.14.0 +httpcore==1.0.7 +httptools==0.6.4 +httpx==0.28.1 +idna==3.10 +itsdangerous==2.2.0 +Jinja2==3.1.5 +mariadb==1.1.11 +markdown-it-py==3.0.0 +MarkupSafe==3.0.2 +mdurl==0.1.2 +mysql-connector-python==9.2.0 +mysqlclient==2.2.7 +orjson==3.10.15 +packaging==24.2 +paramiko==3.5.1 +pdf2image==1.17.0 +pillow==11.1.0 +pipreqs==0.4.13 +pycparser==2.22 +pydantic==2.10.6 +pydantic-extra-types==2.10.2 +pydantic-settings==2.7.1 +pydantic_core==2.27.2 +Pygments==2.19.1 +PyMuPDF==1.25.2 +PyNaCl==1.5.0 +pypdf==5.2.0 +pytesseract==0.3.13 +python-dotenv==1.0.1 +python-multipart==0.0.20 +PyYAML==6.0.2 +requests==2.32.3 +rich==13.9.4 +rich-toolkit==0.13.2 +shellingham==1.5.4 +sniffio==1.3.1 +starlette==0.45.3 +tesseract==0.1.3 +tqdm==4.67.1 +typer==0.15.1 +typing_extensions==4.12.2 +ujson==5.10.0 +urllib3==2.3.0 +uvicorn==0.34.0 +uvloop==0.21.0 +watchfiles==1.0.4 +websockets==14.2 +yarg==0.1.10 diff --git a/run.md b/run.md new file mode 100644 index 0000000..61b3de8 --- /dev/null +++ b/run.md @@ -0,0 +1,9 @@ +sudo systemctl start mariadb.service +python -m uvicorn app.main:app --reload +Requirements: + +- For pymupdf tesseract needs to be installed for the language deu on the system. +- All the tables in daatabase_init.sql must be in a database called Unizeug with password: DBPassword +- requirements.txt or just all the python modules until pytohn stops complaining. I recommend to use a venv for this project. + Just information I dont want to forget: +- TISS API maby not nessecarry: https://tiss.tuwien.ac.at/api/course/101685-2024W diff --git a/run.txt b/run.txt deleted file mode 100644 index 705b620..0000000 --- a/run.txt +++ /dev/null @@ -1,4 +0,0 @@ -sudo systemctl start mariadb.service -python -m uvicorn app.main:app --reload -Requirements: For pymupdf tesseract needs to be installed for the language deu un the system. -TISS API maby not nessecarry: https://tiss.tuwien.ac.at/api/course/101685-2024W