mirror of
https://github.com/Garmelon/PFERD.git
synced 2025-09-09 14:12:26 +02:00
Add FfM (Fachschaft für Mathematik) synchronizer
This commit moves exceptions and some other things into utils.py and renames files according to python's file naming guides (kinda). It also adds a new example config using the new FfM downloader.
This commit is contained in:
@@ -3,18 +3,14 @@ import logging
|
||||
import pathlib
|
||||
import shutil
|
||||
|
||||
from . import utils
|
||||
|
||||
__all__ = [
|
||||
"FileNotFoundException",
|
||||
"Organizer",
|
||||
]
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class FileNotFoundException(Exception):
|
||||
pass
|
||||
|
||||
class Organizer:
|
||||
HASH_BUF_SIZE = 1024**2
|
||||
|
||||
def __init__(self, base_dir, sync_dir):
|
||||
"""
|
||||
base_dir - the .tmp directory will be created here
|
||||
@@ -49,7 +45,7 @@ class Organizer:
|
||||
|
||||
def add_file(self, from_path, to_path):
|
||||
if not from_path.exists():
|
||||
raise FileNotFoundException(f"Could not add file at {from_path}")
|
||||
raise utils.FileNotFoundException(f"Could not add file at {from_path}")
|
||||
|
||||
# check if sync_dir/to_path is inside sync_dir?
|
||||
to_path = pathlib.Path(self._sync_dir, to_path)
|
||||
|
Reference in New Issue
Block a user