add: home page
This commit is contained in:
@ -7,20 +7,27 @@ from path import Path
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import config
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from page import Page
|
||||
from album import Album
|
||||
|
||||
class Picture():
|
||||
def __init__(self, picture_path: Path, page = None, raw: Path|None = None, albums: list[Album] = [], is_repertoried: bool = True):
|
||||
def __init__(self, picture_path: Path, page = None, raw: Path|None = None, albums_name: list[str] = None, is_repertoried: bool = True):
|
||||
self._large: Path = picture_path
|
||||
self._small: Path = Path(picture_path.get_absolute_path()[:-4] + "_small.jpg")
|
||||
self._export_file: Path = Path(picture_path.get_absolute_path() + ".out.pp3")
|
||||
self._raw: Path|None = raw
|
||||
self._page: Page = page
|
||||
self._albums: list[Album] = albums
|
||||
self._albums_name: list[str] = albums_name or []
|
||||
if (config.CREATE_GENERAL_ALBUM):
|
||||
self._albums_name.append("general")
|
||||
self._is_reperoried: bool = is_repertoried
|
||||
|
||||
def get_albums_name(self):
|
||||
return self._albums_name
|
||||
|
||||
def get_small(self):
|
||||
if not self._small.exist():
|
||||
self.gen_small()
|
||||
@ -33,7 +40,7 @@ class Picture():
|
||||
return self._export_file
|
||||
|
||||
def gen_small(self):
|
||||
im = Image.open(self.large.get_absolute_path()).convert("RGB")
|
||||
im = Image.open(self._large.get_absolute_path()).convert("RGB")
|
||||
im.save(self._small.get_absolute_path(), quality=95, optimize=True)
|
||||
|
||||
|
Reference in New Issue
Block a user