diff options
| author | Paul Buetow <paul@buetow.org> | 2022-04-06 01:21:18 +0100 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2022-04-06 01:21:18 +0100 |
| commit | 3f9e6db036cecbd7dcc02dc5f0a85527c276d71e (patch) | |
| tree | dd4aa510ae7582e5a48ce249d85d45af1d12a63c | |
| parent | 42bdc543643d0b3fb01a5e374edf040dd43c2664 (diff) | |
initial sword
| -rw-r--r-- | README.md | 4 | ||||
| -rwxr-xr-x | slice.raku | 34 |
2 files changed, 37 insertions, 1 deletions
@@ -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; +} |
