From f648cda06094a569a859f030d10adf655355225a Mon Sep 17 00:00:00 2001 From: Steve Krulewitz Date: Sat, 14 Sep 2019 22:16:45 -0700 Subject: [PATCH] packets --- .gitignore | 2 +- bin/build.sh | 59 +++++++++++++++++++++++++++--------- packets/aircoustic201910.tex | 11 +++++++ 3 files changed, 57 insertions(+), 15 deletions(-) create mode 100644 packets/aircoustic201910.tex diff --git a/.gitignore b/.gitignore index 473693d..aae236c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ .DS_Store -pdf +build/ *.pdf diff --git a/bin/build.sh b/bin/build.sh index 45822e7..650950e 100755 --- a/bin/build.sh +++ b/bin/build.sh @@ -1,19 +1,50 @@ #!/bin/bash -mkdir -p ~/Library/texmf/tex/latex -ln -s "`realpath tex`" ~/Library/texmf/tex/latex/ +TEXML_HOME=$HOME/Library/texmf/tex/latex +PDF_JOINER="/System/Library/Automator/Combine PDF Pages.action/Contents/Resources/join.py" -input_file="`realpath "$1"`" +function setup_pdflatex { + if [ ! -d $TEXML_HOME ]; then + mkdir -p $TEXML_HOME + fi -output_file=$(\ - cat "$input_file" | \ - grep "\\\begin{song}" | \ - sed -E 's/.*title={([^}]*)}, band={([^}]*)}, year={([^}]*)}.*/\1 - \2 (\3)/' | \ - tr -d '\n' \ -) + if [ ! -d $TEXML_HOME/tex ]; then + ln -s "`realpath tex`" $TEXML_HOME + fi +} -pdflatex \ - -interaction=nonstopmode \ - -output-directory pdf \ - -jobname="$output_file" \ - "$input_file" +function make_pdf { + infile="`realpath "$1"`" + indir=$(dirname "$1") + pdf_outdir="`realpath "build/pdf"`/${indir#songs/}" + #aux_outdir="`realpath "aux"`/${indir#songs/}" + + mkdir -p "$pdf_outdir" + #mkdir -p "$aux_outdir" + + pdflatex \ + -interaction=nonstopmode \ + -output-directory="$pdf_outdir" \ + "$infile" +} + +function make_packet { + pdfs="" + while read p; do + make_pdf "songs/$p.tex" + pdfs="$pdfs \"build/pdf/$p.pdf\"" + done < $1 + + mkdir -p "build/packets" + #echo "$PDF_JOINER" --output "build/$1.pdf" $pdfs + + pdflatex \ + -interaction=nonstopmode \ + -output-directory="build/packets" \ + "$1" +} + +setup_pdflatex +#make_pdf "$1" + +make_packet "packets/aircoustic201910.tex" diff --git a/packets/aircoustic201910.tex b/packets/aircoustic201910.tex new file mode 100644 index 0000000..e1d84be --- /dev/null +++ b/packets/aircoustic201910.tex @@ -0,0 +1,11 @@ +\documentclass{article} +\usepackage{grffile} +\usepackage{pdfpages} +\begin{document} +\includepdf[pages=-]{build/pdf/Pat Benatar/We Belong.pdf} +\includepdf[pages=-]{build/pdf/Daniel Johnston/Life In Vain.pdf} +\includepdf[pages=-]{build/pdf/R.E.M./Fall on Me.pdf} +\includepdf[pages=-]{build/pdf/Guns 'N Roses/Patience.pdf} +\includepdf[pages=-]{build/pdf/Tears for Fears/Everybody Wants to Rule the World.pdf} +\includepdf[pages=-]{build/pdf/George Michael/Faith.pdf} +\end{document}