# show all recipes
default:
  just --list

# build
build:
  make -B build

# make fred say something
say phrase out:
  say -v 'Fred' -r 100 -o {{out}} {{phrase}} 

# watch for changes
watch:
  ls content/*.md | entr make build

# length <file>
length file:
  @wc -c < {{file}} #| cut -d ' ' -f 7

# duration <file>
duration file:
  @ffprobe -show_entries stream=duration -of compact=p=0:nk=1 -v fatal {{file}}

# clean dist
clean:
  rm -rf dist/*
  touch dist/.gitkeep

# upload
up:
  rsync -azP dist/ tilde:public_html/podcast

# make this week's emails from data.rec
emails:
  #!/bin/bash
  echo "{ \"data\":" > tmp.json
  recsel -e "date >> '$(gdate)' && date << '$(gdate -d "next week")'" data.rec \
    | rec2csv | csvjson >> tmp.json
  echo "}" >> tmp.json
  mustache tmp.json templates/email.template
  rm tmp.json

# show me the letters
letters:
  @recsel -t letter -e "answered = 0" -P listener,writes letters.rec
