jxl #15
3 changed files with 26 additions and 8 deletions
13
Makefile
13
Makefile
|
@ -66,6 +66,11 @@ $(TMPDIR)/%_big.jpg: $(DATADIR)/%.jpg
|
||||||
$(call resize,$(BIG),$(BIG),>)
|
$(call resize,$(BIG),$(BIG),>)
|
||||||
|
|
||||||
|
|
||||||
|
%.jxl: %.png ; $(call cjxl,-e 9)
|
||||||
|
%.jxl: %.jpg ; $(call cjxl,-e 9)
|
||||||
|
%.jxl: %.gif ; $(call cjxl)
|
||||||
|
|
||||||
|
|
||||||
$(MAKEPAGES): make-pages/*.hs make-pages/make-pages.cabal
|
$(MAKEPAGES): make-pages/*.hs make-pages/make-pages.cabal
|
||||||
echo "[make-pages]"
|
echo "[make-pages]"
|
||||||
mkdir -p $(dir $@)
|
mkdir -p $(dir $@)
|
||||||
|
@ -133,6 +138,14 @@ mkdir -p "$(dir $@)"
|
||||||
convert -resize "$(1)x$(2)$(3)" $(4) "$^" "$@"
|
convert -resize "$(1)x$(2)$(3)" $(4) "$^" "$@"
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
# args:
|
||||||
|
# 1. extra flags
|
||||||
|
define cjxl
|
||||||
|
echo "[cjxl] "$@
|
||||||
|
mkdir -p "$(dir $@)"
|
||||||
|
cjxl -d 1 "$^" "$@" $(1) 2>/dev/null
|
||||||
|
endef
|
||||||
|
|
||||||
# no args
|
# no args
|
||||||
define depend-gallery
|
define depend-gallery
|
||||||
echo "[deps] "$@
|
echo "[deps] "$@
|
||||||
|
|
|
@ -29,17 +29,22 @@ dependSingle' yamlDir indexFile info prefix build nsfw =
|
||||||
where
|
where
|
||||||
images = #all if nsfw then #images info else #sfwImages info
|
images = #all if nsfw then #images info else #sfwImages info
|
||||||
|
|
||||||
paths = map #path images
|
paths = map #path images
|
||||||
|
thumb = thumbFile $ thumbnail info
|
||||||
|
jxls fs = [base <.> "jxl" | f <- fs,
|
||||||
|
let (base, ext) = splitExtension f,
|
||||||
|
ext `elem` imgTypes]
|
||||||
|
imgTypes = words ".png .jpg .gif"
|
||||||
|
|
||||||
|
imgFiles0 = thumb : map pageFile paths ++ map bigFile paths
|
||||||
|
imgFiles = imgFiles0 ++ jxls imgFiles0
|
||||||
|
|
||||||
dls = mapMaybe #download images
|
dls = mapMaybe #download images
|
||||||
extras = #extras info
|
extras = #extras info
|
||||||
|
|
||||||
dir = build </> prefix </> yamlDir
|
dir = build </> prefix </> yamlDir
|
||||||
page = dir </> "index.html"
|
page = dir </> "index.html"
|
||||||
deps = unwords $ map (dir </>) $
|
deps = unwords $ map (dir </>) $ imgFiles ++ dls ++ extras
|
||||||
thumbFile (thumbnail info) :
|
|
||||||
map pageFile paths ++
|
|
||||||
map bigFile paths ++
|
|
||||||
dls ++ extras
|
|
||||||
|
|
||||||
dependGallery :: GalleryInfo
|
dependGallery :: GalleryInfo
|
||||||
-> FilePath -- ^ index file
|
-> FilePath -- ^ index file
|
||||||
|
|
|
@ -33,7 +33,7 @@ import Data.Text (Text)
|
||||||
import qualified Data.Text as Text
|
import qualified Data.Text as Text
|
||||||
import Data.YAML (FromYAML (..), (.:), (.:?), (.!=))
|
import Data.YAML (FromYAML (..), (.:), (.:?), (.!=))
|
||||||
import qualified Data.YAML as YAML
|
import qualified Data.YAML as YAML
|
||||||
import System.FilePath ((</>), takeBaseName, takeExtension, splitExtension)
|
import System.FilePath ((</>), takeBaseName, takeExtension, splitExtensions)
|
||||||
import Data.Bifunctor (second)
|
import Data.Bifunctor (second)
|
||||||
|
|
||||||
|
|
||||||
|
@ -244,7 +244,7 @@ bigFile f
|
||||||
|
|
||||||
addSuffix :: String -> FilePath -> FilePath
|
addSuffix :: String -> FilePath -> FilePath
|
||||||
addSuffix suf path =
|
addSuffix suf path =
|
||||||
let (pre, ext) = splitExtension path in
|
let (pre, ext) = splitExtensions path in
|
||||||
pre ++ suf ++ ext
|
pre ++ suf ++ ext
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue