Add readme, add float representation to rationals
This commit is contained in:
parent
884223d6c5
commit
69c639f5db
22
README.md
22
README.md
@ -2,9 +2,27 @@
|
|||||||
|
|
||||||
Makefile-based static site generator for sharing photos.
|
Makefile-based static site generator for sharing photos.
|
||||||
|
|
||||||
|
## Building a Page
|
||||||
|
|
||||||
|
`nix develop` drops you into a shell with all prerequisites.
|
||||||
|
Running
|
||||||
|
|
||||||
|
```bash
|
||||||
|
IMAGE_DIR=path/to/image_dir make
|
||||||
|
```
|
||||||
|
|
||||||
|
builds a self-contained static page and stores it in `./dist` (or `DIST_DIR` if set).
|
||||||
|
You can use all the usual `make` goodies such as `-j` to enable parallel builds.
|
||||||
|
|
||||||
|
## Data Model
|
||||||
|
|
||||||
|
The data model is simply the list of all `.jpg` files in `IMAGE_DIR` and its subdirectories, enriched with EXIF metadata.
|
||||||
|
|
||||||
## TODO
|
## TODO
|
||||||
|
|
||||||
- [x] Generate .zip archive of all photos and offer it for download
|
- [x] Generate .zip archive of all photos and offer it for download
|
||||||
- [ ] Make `make clean-dist` remove only unused photos (i.e. all photos in dist setminus photos that are supposed to be in dist)
|
- [x] Write a faster `./extract-metadata.py` alternative
|
||||||
- [ ] Make a pretty index page
|
- [x] Make a pretty index page
|
||||||
- [x] Generate .webp thumbnails for index page
|
- [x] Generate .webp thumbnails for index page
|
||||||
|
- [ ] Make `make clean-dist` remove only unused photos (i.e. all photos in dist setminus photos that are supposed to be in dist)
|
||||||
|
- [ ] Make a mobile page
|
||||||
|
BIN
extra/fonts/source-sans-pro-regular.woff2
Normal file
BIN
extra/fonts/source-sans-pro-regular.woff2
Normal file
Binary file not shown.
9
extra/fonts/source-sans-pro.css
Normal file
9
extra/fonts/source-sans-pro.css
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
/* Taken from fonts.googleapis.com/css?family=Source+Sans+Pro:400 */
|
||||||
|
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Source Sans Pro';
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 400;
|
||||||
|
src: local('Source Sans Pro Regular'), local('SourceSansPro-Regular'), url(./source-sans-pro-regular.woff2) format('woff2');
|
||||||
|
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215;
|
||||||
|
}
|
18
flake.lock
generated
18
flake.lock
generated
@ -22,11 +22,11 @@
|
|||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": "nixpkgs"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1736429655,
|
"lastModified": 1739824009,
|
||||||
"narHash": "sha256-BwMekRuVlSB9C0QgwKMICiJ5EVbLGjfe4qyueyNQyGI=",
|
"narHash": "sha256-fcNrCMUWVLMG3gKC5M9CBqVOAnJtyRvGPxptQFl5mVg=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "naersk",
|
"repo": "naersk",
|
||||||
"rev": "0621e47bd95542b8e1ce2ee2d65d6a1f887a13ce",
|
"rev": "e5130d37369bfa600144c2424270c96f0ef0e11d",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@ -38,11 +38,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1739138025,
|
"lastModified": 1739863612,
|
||||||
"narHash": "sha256-M4ilIfGxzbBZuURokv24aqJTbdjPA9K+DtKUzrJaES4=",
|
"narHash": "sha256-UbtgxplOhFcyjBcNbTVO8+HUHAl/WXFDOb6LvqShiZo=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "b2243f41e860ac85c0b446eadc6930359b294e79",
|
"rev": "632f04521e847173c54fa72973ec6c39a371211c",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@ -52,11 +52,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs_2": {
|
"nixpkgs_2": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1739138025,
|
"lastModified": 1739863612,
|
||||||
"narHash": "sha256-M4ilIfGxzbBZuURokv24aqJTbdjPA9K+DtKUzrJaES4=",
|
"narHash": "sha256-UbtgxplOhFcyjBcNbTVO8+HUHAl/WXFDOb6LvqShiZo=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "b2243f41e860ac85c0b446eadc6930359b294e79",
|
"rev": "632f04521e847173c54fa72973ec6c39a371211c",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>photos</title>
|
<title>photo gallery</title>
|
||||||
<link rel="stylesheet" href="./extra/index.css">
|
<link rel="stylesheet" href="./extra/fonts/source-sans-pro.css">
|
||||||
|
<link rel="stylesheet" href="./extra/index.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<header class="container">
|
<header class="container">
|
||||||
|
13
photo.hbs
13
photo.hbs
@ -1,9 +1,10 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>{{ path.name }}</title>
|
<title>{{ path.name }}</title>
|
||||||
<link rel="stylesheet" href="./extra/photo.css">
|
<link rel="stylesheet" href="./extra/fonts/source-sans-pro.css">
|
||||||
|
<link rel="stylesheet" href="./extra/photo.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="my-epic-layout">
|
<div class="my-epic-layout">
|
||||||
@ -15,9 +16,9 @@
|
|||||||
<p><a href="./{{ navigation.previous }}">prev</a> · <a href="./{{ navigation.next }}">next</a> · <a href=".">up</a></p>
|
<p><a href="./{{ navigation.previous }}">prev</a> · <a href="./{{ navigation.next }}">next</a> · <a href=".">up</a></p>
|
||||||
<p>{{ exif.datetime }}</p>
|
<p>{{ exif.datetime }}</p>
|
||||||
<p>
|
<p>
|
||||||
exposure time <strong>???</strong><br>
|
exposure time <strong>{{ exif.ExposureTime.num }}⁄{{ exif.ExposureTime.denom }}</strong> s<br>
|
||||||
aperture <strong>???</strong><br>
|
aperture <strong>f{{ exif.FNumber.f64 }}</strong><br>
|
||||||
iso <strong>???</strong><br>
|
iso <strong>{{ exif.PhotographicSensitivity }}</strong><br>
|
||||||
resolution <strong>{{ exif.PixelXDimension }}x{{ exif.PixelYDimension }}</strong>
|
resolution <strong>{{ exif.PixelXDimension }}x{{ exif.PixelYDimension }}</strong>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
@ -8,8 +8,9 @@ fn map_to_value(tag: exif::Tag, value: exif::Value) -> Value {
|
|||||||
}
|
}
|
||||||
if let exif::Value::Rational(rs) = value {
|
if let exif::Value::Rational(rs) = value {
|
||||||
return serde_json::json!({
|
return serde_json::json!({
|
||||||
"num": Value::Number(rs[0].num.into()),
|
"num": rs[0].num,
|
||||||
"denom": Value::Number(rs[0].denom.into()),
|
"denom": rs[0].denom,
|
||||||
|
"f64": rs[0].to_f64(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
Value::String(value.display_as(tag).to_string())
|
Value::String(value.display_as(tag).to_string())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user