cbenning / fussel

A static photo gallery generator
https://github.com/cbenning/fussel
MIT License
264 stars 17 forks source link

"False" in labels does not become false in configuration #106

Open dan1elhughes opened 1 year ago

dan1elhughes commented 1 year ago

When running the following docker command, the "False" and "True" parameters appear to not be parsed correctly - I would guess because jq reads that as a truthy string.

For example, see people.enable and watermark.enable below.

docker run \
-e PGID=$(id -g) \
-e PUID=$(id -u) \
-v /home/dan/Backups/Exports:/input:ro \
-v $(pwd):/output \
--label gallery.input_path="/input" \
--label gallery.output_path="/output" \
--label gallery.overwrite=False \
--label albums.recursive=True \
--label albums.recursive_name_pattern="{parent_album} > {album}" \
--label people.enable=False \ # <---- 🚩
--label watermark.enable=False \ # <---- 🚩
--label watermark.path="web/src/images/fussel-watermark.png" \
--label watermark.size_ratio=0.3 \
--label site.http_root="/" \
--label site.title="Dan Hughes" \
-v /var/run/docker.sock:/var/run/docker.sock fussel

This create the following yaml config, where the booleans are strings:

Generating yaml config...
albums:
  recursive: "True"
  recursive_name_pattern: '{parent_album} > {album}'
gallery:
  input_path: /input
  output_path: /output
  overwrite: "False"
org:
  opencontainers:
    image:
      description: 'A static photo gallery generator '
      licenses: MIT
      source: https://github.com/cbenning/fussel
people:
  enable: "False" #  <---- 🚩
site:
  http_root: /
  title: Dan Hughes
watermark:
  enable: "False" #  <---- 🚩
  path: web/src/images/fussel-watermark.png
  size_ratio: "0.3"

Then, in the logs of the output, watermarks are generated:

Importing /input/2023-01-21 Katie's as 2023-01-21 Katie's (2023-01-21-katie-s)
 --> Processing /input/2023-01-21 Katie's/DSCF5615.jpeg...
 --> Processing /input/2023-01-21 Katie's/DSCF5603.jpeg...
 --> Processing /input/2023-01-21 Katie's/DSCF5572.jpeg...
 --> Processing /input/2023-01-21 Katie's/DSCF5641.jpeg...
 ----> Copying to
/fussel/fussel/web/public/static/_gallery/albums/2023-01-21-katie-s/original_dsc
f5603-jpeg.jpeg
 ----> Copying to
/fussel/fussel/web/public/static/_gallery/albums/2023-01-21-katie-s/original_dsc
f5572-jpeg.jpeg
 ----> Copying to
/fussel/fussel/web/public/static/_gallery/albums/2023-01-21-katie-s/original_dsc
f5615-jpeg.jpeg
 ----> Copying to
/fussel/fussel/web/public/static/_gallery/albums/2023-01-21-katie-s/original_dsc
f5641-jpeg.jpeg
 ------> Generating photo sizes: 500x400 800x640 1024x819 1600x1280
 ------> Adding watermark #  <---- 🚩
 --> Processing /input/2023-01-21 Katie's/DSCF5581.jpeg...
 ------> Generating photo sizes: 500x625 800x1000 1024x1280 1600x2000
 ------> Adding watermark #  <---- 🚩
 --> Processing /input/2023-01-21 Katie's/DSCF5613.jpeg...
 ----> Copying to

It appears that the boolean inputs are ignored and default values used instead.

Love the project! 🕊️

cbenning commented 1 year ago

Good find! I suspected the json -> yaml conversion would have something like this. Thanks for reporting.

cbenning commented 1 year ago

@dan1elhughes So I fixed a minor issue and pushed V2.0.2, but the REAL issue is that my docker run cmd in the README had the wrong values so they were not actually mapping to the correct fields. Can you try again with the latest README example?

dan1elhughes commented 1 year ago

@cbenning I've just tried again, and it still produces watermarks and the "People" page 🤔

Docker command ``` docker run \ -d --rm \ --name fussel \ -e PGID=$(id -g) \ -e PUID=$(id -u) \ -v /var/run/docker.sock:/var/run/docker.sock \ -v /home/dan/Backups/Exports:/input:ro \ -v $(pwd):/output \ --label gallery.input_path="/input" \ --label gallery.output_path="/output" \ --label gallery.overwrite=False \ --label gallery.parallel_tasks=4 \ --label gallery.albums.recursive=True \ --label gallery.albums.recursive_name_pattern="{parent_album} > {album}" \ --label gallery.people.enable=False \ --label gallery.watermark.enable=False \ --label gallery.watermark.path="web/src/images/fussel-watermark.png" \ --label gallery.watermark.size_ratio=0.3 \ --label site.http_root="/" \ --label site.title="Dan Hughes" \ ghcr.io/cbenning/fussel:latest ```
YAML output ```yaml Generating yaml config... gallery: albums: recursive: "True" recursive_name_pattern: '{parent_album} > {album}' input_path: /input output_path: /output overwrite: "False" parallel_tasks: "4" people: enable: "False" watermark: enable: "False" path: web/src/images/fussel-watermark.png size_ratio: "0.3" org: opencontainers: image: description: 'A static photo gallery generator ' licenses: MIT source: https://github.com/cbenning/fussel site: http_root: / title: Dan Hughes ```
Build log ``` Generating site from /input Importing /input/2023-01-21 Katie's as 2023-01-21 Katie's (2023-01-21-katie-s) --> Processing /input/2023-01-21 Katie's/DSCF5572.jpeg... --> Processing /input/2023-01-21 Katie's/DSCF5641.jpeg... --> Processing /input/2023-01-21 Katie's/DSCF5603.jpeg... --> Processing /input/2023-01-21 Katie's/DSCF5615.jpeg... ----> Copying to /fussel/fussel/web/public/static/_gallery/albums/2023-01-21-katie-s/original_dsc f5572-jpeg.jpeg ----> Copying to /fussel/fussel/web/public/static/_gallery/albums/2023-01-21-katie-s/original_dsc f5615-jpeg.jpeg ----> Copying to /fussel/fussel/web/public/static/_gallery/albums/2023-01-21-katie-s/original_dsc f5603-jpeg.jpeg ----> Copying to /fussel/fussel/web/public/static/_gallery/albums/2023-01-21-katie-s/original_dsc f5641-jpeg.jpeg ------> Generating photo sizes: 500x400 800x640 1024x819 1600x1280 ------> Adding watermark --> Processing /input/2023-01-21 Katie's/DSCF5581.jpeg... ------> Generating photo sizes: 500x400 800x640 1024x819 1600x1280 ------> Adding watermark --> Processing /input/2023-01-21 Katie's/DSCF5629.jpeg... ------> Generating photo sizes: 500x625 800x1000 1024x1280 1600x2000 ------> Adding watermark ```
mshoe007 commented 1 year ago

Just adding on - watermarks appear on my photos even with --label gallery.watermark.enable=False in the docker options.

isteel commented 1 month ago

Same here - both watermarks and people in labels are being ignored when using docker