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.
|
||||
|
||||
## 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
|
||||
|
||||
- [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)
|
||||
- [ ] Make a pretty index page
|
||||
- [x] Write a faster `./extract-metadata.py` alternative
|
||||
- [x] Make a pretty 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"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1736429655,
|
||||
"narHash": "sha256-BwMekRuVlSB9C0QgwKMICiJ5EVbLGjfe4qyueyNQyGI=",
|
||||
"lastModified": 1739824009,
|
||||
"narHash": "sha256-fcNrCMUWVLMG3gKC5M9CBqVOAnJtyRvGPxptQFl5mVg=",
|
||||
"owner": "nix-community",
|
||||
"repo": "naersk",
|
||||
"rev": "0621e47bd95542b8e1ce2ee2d65d6a1f887a13ce",
|
||||
"rev": "e5130d37369bfa600144c2424270c96f0ef0e11d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@ -38,11 +38,11 @@
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1739138025,
|
||||
"narHash": "sha256-M4ilIfGxzbBZuURokv24aqJTbdjPA9K+DtKUzrJaES4=",
|
||||
"lastModified": 1739863612,
|
||||
"narHash": "sha256-UbtgxplOhFcyjBcNbTVO8+HUHAl/WXFDOb6LvqShiZo=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "b2243f41e860ac85c0b446eadc6930359b294e79",
|
||||
"rev": "632f04521e847173c54fa72973ec6c39a371211c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@ -52,11 +52,11 @@
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1739138025,
|
||||
"narHash": "sha256-M4ilIfGxzbBZuURokv24aqJTbdjPA9K+DtKUzrJaES4=",
|
||||
"lastModified": 1739863612,
|
||||
"narHash": "sha256-UbtgxplOhFcyjBcNbTVO8+HUHAl/WXFDOb6LvqShiZo=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "b2243f41e860ac85c0b446eadc6930359b294e79",
|
||||
"rev": "632f04521e847173c54fa72973ec6c39a371211c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -1,9 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>photos</title>
|
||||
<link rel="stylesheet" href="./extra/index.css">
|
||||
<meta charset="UTF-8">
|
||||
<title>photo gallery</title>
|
||||
<link rel="stylesheet" href="./extra/fonts/source-sans-pro.css">
|
||||
<link rel="stylesheet" href="./extra/index.css">
|
||||
</head>
|
||||
<body>
|
||||
<header class="container">
|
||||
|
13
photo.hbs
13
photo.hbs
@ -1,9 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>{{ path.name }}</title>
|
||||
<link rel="stylesheet" href="./extra/photo.css">
|
||||
<meta charset="UTF-8">
|
||||
<title>{{ path.name }}</title>
|
||||
<link rel="stylesheet" href="./extra/fonts/source-sans-pro.css">
|
||||
<link rel="stylesheet" href="./extra/photo.css">
|
||||
</head>
|
||||
<body>
|
||||
<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>{{ exif.datetime }}</p>
|
||||
<p>
|
||||
exposure time <strong>???</strong><br>
|
||||
aperture <strong>???</strong><br>
|
||||
iso <strong>???</strong><br>
|
||||
exposure time <strong>{{ exif.ExposureTime.num }}⁄{{ exif.ExposureTime.denom }}</strong> s<br>
|
||||
aperture <strong>f{{ exif.FNumber.f64 }}</strong><br>
|
||||
iso <strong>{{ exif.PhotographicSensitivity }}</strong><br>
|
||||
resolution <strong>{{ exif.PixelXDimension }}x{{ exif.PixelYDimension }}</strong>
|
||||
</p>
|
||||
</div>
|
||||
|
@ -8,8 +8,9 @@ fn map_to_value(tag: exif::Tag, value: exif::Value) -> Value {
|
||||
}
|
||||
if let exif::Value::Rational(rs) = value {
|
||||
return serde_json::json!({
|
||||
"num": Value::Number(rs[0].num.into()),
|
||||
"denom": Value::Number(rs[0].denom.into()),
|
||||
"num": rs[0].num,
|
||||
"denom": rs[0].denom,
|
||||
"f64": rs[0].to_f64(),
|
||||
});
|
||||
}
|
||||
Value::String(value.display_as(tag).to_string())
|
||||
|
Loading…
x
Reference in New Issue
Block a user