diff --git a/README.md b/README.md index 7dbff74..0a4c7b3 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,5 @@ python3 src/main.py %site location% ### Futur update - add gimp profile file -- album - unrepertoried page - add audio file on page \ No newline at end of file diff --git a/src/path.py b/src/path.py index f834e52..a805973 100644 --- a/src/path.py +++ b/src/path.py @@ -31,6 +31,9 @@ class Path(): return None return self._name + def touch(self) -> None: + open(self.get_absolute_path(), "w+").close() + def create(self) -> None: os.makedirs(self.get_absolute_path()) diff --git a/src/picture.py b/src/picture.py index 15fc776..33d53ce 100644 --- a/src/picture.py +++ b/src/picture.py @@ -14,13 +14,22 @@ if TYPE_CHECKING: from album import Album class Picture(): - def __init__(self, picture_path: Path, page = None, raw: Path|None = None, albums_name: list[str] = None, is_repertoried: bool = True): + def __init__(self, picture_path: Path, page = None, raw: Path|None = None, is_repertoried: bool = True): self._large: Path = picture_path self._small: Path = Path(picture_path.get_absolute_path()[:-4] + "_small.jpg") self._profile_file: Path = Path(picture_path.get_absolute_path() + ".out.pp3") + self._albums_file: Path = Path(picture_path.get_absolute_path()[:-4] + "_albums.txt") self._raw: Path|None = raw self._page: Page = page - self._albums_name: list[str] = albums_name or [] + self._albums_name: list[str] = [] + if self._albums_file.exist(): + with open(self._albums_file.get_absolute_path(), "r+") as f: + albums_name: list[str] = f.read() + if (len(albums_name)): + self._albums_name += albums_name.split("\n") + print(self._albums_name) + else: + self._albums_file.touch() if (config.CREATE_GENERAL_ALBUM): self._albums_name.append("general") self._is_reperoried: bool = is_repertoried diff --git a/src/templates/album.jinja b/src/templates/album.jinja index a8b47a1..038d4d5 100644 --- a/src/templates/album.jinja +++ b/src/templates/album.jinja @@ -2,7 +2,7 @@ - +