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:
Joscha
2018-11-24 08:27:33 +00:00
parent 5732268084
commit 2034c9d426
7 changed files with 156 additions and 33 deletions

View File

@@ -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)