Compare commits
2 Commits
97f05cee5e
...
ca17bd2cab
Author | SHA1 | Date | |
---|---|---|---|
ca17bd2cab | |||
760bd86bf0 |
@ -27,7 +27,7 @@ def scan_pages(folders: list[Path]) -> list[Page]:
|
|||||||
raw: Path = Path(folder, folder.get_name() + ".NEF")
|
raw: Path = Path(folder, folder.get_name() + ".NEF")
|
||||||
for file in files:
|
for file in files:
|
||||||
if file.get_name().endswith(".png"):
|
if file.get_name().endswith(".png"):
|
||||||
page.add_picture(Picture(file, page=prev, raw=raw))
|
page.add_picture(Picture(file, page=page, raw=raw))
|
||||||
|
|
||||||
if len(page.get_pictures()) == 0:
|
if len(page.get_pictures()) == 0:
|
||||||
bar.next()
|
bar.next()
|
||||||
|
24
src/page.py
24
src/page.py
@ -34,21 +34,6 @@ class Page():
|
|||||||
def get_pictures(self) -> list[Picture]:
|
def get_pictures(self) -> list[Picture]:
|
||||||
return self._pictures
|
return self._pictures
|
||||||
|
|
||||||
def _render_raw(self):
|
|
||||||
if not self._raw.exist():
|
|
||||||
return None
|
|
||||||
return self._raw.get_name()
|
|
||||||
|
|
||||||
def _render_prev(self):
|
|
||||||
if self.prev is None:
|
|
||||||
return None
|
|
||||||
return f"../{self.prev.name}/page.html"
|
|
||||||
|
|
||||||
def _render_next(self):
|
|
||||||
if self.next is None:
|
|
||||||
return None
|
|
||||||
return f"../{self.next.name}/page.html"
|
|
||||||
|
|
||||||
def _to_html(self) -> str|None:
|
def _to_html(self) -> str|None:
|
||||||
html_rendered = page_template.render(page=self)
|
html_rendered = page_template.render(page=self)
|
||||||
return html_rendered
|
return html_rendered
|
||||||
@ -57,7 +42,7 @@ class Page():
|
|||||||
with open(self.html.get_absolute_path(), "w") as f:
|
with open(self.html.get_absolute_path(), "w") as f:
|
||||||
f.write(self._to_html())
|
f.write(self._to_html())
|
||||||
|
|
||||||
def _render_readme(self) -> str|None:
|
def render_readme(self) -> str|None:
|
||||||
if not self._readme.exist():
|
if not self._readme.exist():
|
||||||
return None
|
return None
|
||||||
with open(self._readme.get_absolute_path(), 'r') as f:
|
with open(self._readme.get_absolute_path(), 'r') as f:
|
||||||
@ -72,8 +57,11 @@ class Page():
|
|||||||
os.remove(self._exif.get_absolute_path())
|
os.remove(self._exif.get_absolute_path())
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
def _render_exif(self) -> Path | None:
|
def get_exif(self) -> Path | None:
|
||||||
if not self._exif.exist():
|
if not self._exif.exist():
|
||||||
if (self._gen_exif()):
|
if (self._gen_exif()):
|
||||||
return None
|
return None
|
||||||
return self._exif.get_name()
|
return self._exif
|
||||||
|
|
||||||
|
def get_raw(self):
|
||||||
|
return self._raw
|
@ -19,7 +19,7 @@ class Path():
|
|||||||
def get_dirpath(self):
|
def get_dirpath(self):
|
||||||
return self._dirpath
|
return self._dirpath
|
||||||
|
|
||||||
def get_site_path(self):
|
def get_url(self):
|
||||||
site_path: Path = Path(sys.argv[1])
|
site_path: Path = Path(sys.argv[1])
|
||||||
return self._absolute_path[len(site_path._absolute_path):]
|
return self._absolute_path[len(site_path._absolute_path):]
|
||||||
|
|
||||||
|
@ -25,6 +25,9 @@ class Picture():
|
|||||||
self._albums_name.append("general")
|
self._albums_name.append("general")
|
||||||
self._is_reperoried: bool = is_repertoried
|
self._is_reperoried: bool = is_repertoried
|
||||||
|
|
||||||
|
def get_page(self):
|
||||||
|
return self._page
|
||||||
|
|
||||||
def get_albums_name(self):
|
def get_albums_name(self):
|
||||||
return self._albums_name
|
return self._albums_name
|
||||||
|
|
||||||
|
@ -1,3 +1,44 @@
|
|||||||
|
:root {
|
||||||
|
--bg1: #002b36;
|
||||||
|
--bg2: #073642;
|
||||||
|
--content1: #586e75;
|
||||||
|
--content2: #657b83;
|
||||||
|
--content3: #839496;
|
||||||
|
--content4: #93a1a1;
|
||||||
|
--lbg1: #eee8d5;
|
||||||
|
--lbg2: #fdf6e3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.picture-container {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
justify-content: space-between;
|
||||||
|
background-color: var(--bg2);
|
||||||
|
width: auto;
|
||||||
|
padding: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
background-color: red;
|
color: white;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
flex-direction: column;
|
||||||
|
background-color: var(--bg1);
|
||||||
|
}
|
||||||
|
|
||||||
|
img {
|
||||||
|
width: 100%;
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
background-color: var(--content1);
|
||||||
|
padding: 10px;
|
||||||
|
margin: 10px;
|
||||||
|
height: 200px;
|
||||||
|
width: 200px;
|
||||||
}
|
}
|
@ -6,12 +6,12 @@
|
|||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
{{album.name}}
|
|
||||||
caaaa
|
|
||||||
<h1>{{ album._name }}</h1>
|
<h1>{{ album._name }}</h1>
|
||||||
<div class="picture_container">
|
<div class="picture-container">
|
||||||
{% for picture in album._pictures %}
|
{% for picture in album._pictures %}
|
||||||
<img src="{{ picture.get_small().get_absolute_path() }}">
|
<a href="{{ picture.get_page().html.get_url() }}">
|
||||||
|
<img src="{{ picture.get_small().get_url() }}">
|
||||||
|
</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
@ -2,46 +2,46 @@
|
|||||||
<html>
|
<html>
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<link rel="stylesheet" href="../page.css">
|
<link rel="stylesheet" href="/page.css">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div class="navigation">
|
<div class="navigation">
|
||||||
{% if page.prev %}
|
{% if page.prev %}
|
||||||
<a href="../{{ page.prev.name }}/page.html">Prev</a>
|
<a href="{{ page.next.html.get_url() }}">Prev</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if page.next %}
|
{% if page.next %}
|
||||||
<a class="next" href="../{{ page.next.name }}/page.html">Next</a>
|
<a class="next" href="{{ page.next.html.get_url() }}">Next</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% if page._readme.exist() %}
|
{% if page._readme.exist() %}
|
||||||
<div class="readme">
|
<div class="readme">
|
||||||
<div class="readme-content">
|
<div class="readme-content">
|
||||||
{{page._render_readme()}}
|
{{page.render_readme()}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% for picture in page._pictures %}
|
{% for picture in page._pictures %}
|
||||||
<div class="picture-container">
|
<div class="picture-container">
|
||||||
<div class="picture-container-element">
|
<div class="picture-container-element">
|
||||||
<img src='{{ picture.get_small().get_name() }}'>
|
<img src='{{ picture.get_small().get_url() }}'>
|
||||||
<div class="meta-picture">
|
<div class="meta-picture">
|
||||||
<a href="{{ picture._large }}">Large</a>
|
<a href="{{ picture.get_large().get_url() }}">Large</a>
|
||||||
{% if picture._export_file.exist() %}
|
{% if picture._export_file.exist() %}
|
||||||
<a class="export" href="{{ picture._export_file }}">export file</a>
|
<a class="export" href="{{ picture.get_export_file().get_url() }}">export file</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% if raw or exif %}
|
{% if page.get_raw().exist() or page.get_exif() %}
|
||||||
<div class="download">
|
<div class="download">
|
||||||
<h1>Download</h1>
|
<h1>Download</h1>
|
||||||
{% if raw %}
|
{% if page.get_raw().exist() %}
|
||||||
<a href="{{ raw }}">RAW</a>
|
<a href="{{ page.get_raw() }}">RAW</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if exif %}
|
{% if page.get_exif() %}
|
||||||
<a href="{{ exif }}">Exif</a>
|
<a href="{{ page.get_exif().get_url() }}">Exif</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
Loading…
Reference in New Issue
Block a user