From 3f9e6db036cecbd7dcc02dc5f0a85527c276d71e Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Wed, 6 Apr 2022 01:21:18 +0100 Subject: initial sword --- README.md | 4 +++- slice.raku | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100755 slice.raku diff --git a/README.md b/README.md index 95b2540..0ebc5d3 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ # katana -Static photo album generator for my personal street photography site at https://irregular.ninja programmed in the Raku programming language. \ No newline at end of file +This is the static photo album generator for my personal street photography site at https://irregular.ninja programmed in the Raku programming language. + +*CAUTION*: Still wip! diff --git a/slice.raku b/slice.raku new file mode 100755 index 0000000..124c230 --- /dev/null +++ b/slice.raku @@ -0,0 +1,34 @@ +#!/usr/bin/env raku + +class Image { + has $.source; + has $.thumb; + has $.blur; +} + +sub make-mrproper() { +} + +sub make-thumb(IO::Path $image, Str :$thumb-dir) { + my $thumb = "$thumb-dir/{$image.basename}"; + return if $thumb.IO.f; + +} + +sub make-thumbs(:@images, Str :$outdir) { + my $thumb-dir = "$outdir/thumbs"; + mkdir $thumb-dir unless $thumb-dir.IO.d; + @images.hyper(batch => 10).map({ make-thumb $_, :$thumb-dir }); +} + +multi MAIN( + Bool :$mrproper, #= Clean output dir + Str :$indir = './indir', #= Input dir + Str :$outdir = './outdir', #= Output dir +) { + + my @images = dir($indir, test => { "$indir/$_".IO.f }); + make-mrproper if $mrproper; + mkdir $outdir unless $outdir.IO.d; + make-thumbs :@images, :$outdir; +} -- cgit v1.2.3