From 6fff0c7d6916f9a4fd274cea88ae93beaaa7d966 Mon Sep 17 00:00:00 2001 From: Ethan Paul <24588726+enpaul@users.noreply.github.com> Date: Thu, 18 Feb 2021 21:14:22 -0500 Subject: [PATCH] !wip Add initial configuration structure --- metropolitan/configuration/__init__.py | 0 metropolitan/configuration/containers.py | 72 +++++++++++++++++++++++ metropolitan/configuration/serializers.py | 0 3 files changed, 72 insertions(+) create mode 100644 metropolitan/configuration/__init__.py create mode 100644 metropolitan/configuration/containers.py create mode 100644 metropolitan/configuration/serializers.py diff --git a/metropolitan/configuration/__init__.py b/metropolitan/configuration/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/metropolitan/configuration/containers.py b/metropolitan/configuration/containers.py new file mode 100644 index 0000000..c951d53 --- /dev/null +++ b/metropolitan/configuration/containers.py @@ -0,0 +1,72 @@ +import datetime +import enum +from dataclasses import dataclass +from pathlib import Path +from typing import List +from typing import Optional +from typing import Union + + +class OrderBy(enum.Enum): + TITLE = enum.auto() + DATE = enum.auto() + DATE_INVERTED = enum.auto() + NATIVE = enum.auto() + + +@dataclass +class MetroPostMedia: + title: Optional[str] + description: Optional[str] + image: Union[str, Path] + embed: str + datetime: Union[datetime.date, datetime.datetime] + + +@dataclass +class MetroPost: + slug: str + title: Optional[str] + subtitle: Optional[str] + unlist: bool + media: List[MetroPostMedia] + + +@dataclass +class MetroMediaLicense: + name: str + link: str + badge: str + + +@dataclass +class MetroMediaImagesSizes: + desktop: int + mobile: int + preview: int + + +@dataclass +class MetroMediaImage: + sizes: MetroMediaImagesSizes + link_original: bool + force_download: bool + + +@dataclass +class MetroMedia: + license: MetroMediaLicense + image: MetroMediaImage + + +@dataclass +class MetroSettings: + + title: str + base_url: str + source: Path + output: Path + theme: str + orderby: OrderBy + media: MetroMedia + posts: List[MetroPost] diff --git a/metropolitan/configuration/serializers.py b/metropolitan/configuration/serializers.py new file mode 100644 index 0000000..e69de29