Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

for fn in xkcd*.png xkcd*.

jpg; do; echo $fn; read xw xh <<<$(identify -format '% w %h' $fn); nn="$(echo $fn | sed 's/xkcd-\([0-9]\+\)-.*/\1/')"; wget -q -O xkcd${nn}.json http://xkcd.com/$nn/info.0.json; tt="$(sed 's/.*"title": "\([^"]*\)", .*/\1/' xkcd-${nn}.json)"; at="$(sed 's/.*alt": "\(.*\)", .*/\1/' xkcd-${nn}.js on)"; convert -background white -fill black -font /usr/share/fonts/truetype/free font/FreeSansBold.ttf -pointsize 26 -size ${xw}x -gravity Center caption:"$tt" t t.png; convert -background '#FFF9BD' -border 1x1 -bordercolor black -fill black -font /usr/share/fonts/truetype/freefont/FreeSans.ttf -pointsize 16 -size $(($xw - 2))x -gravity Center caption:"$at" at.png; th=$(identify -format '%h' tt.png) ; ah=$(identify -format '%h' at.png); convert -size ${xw}x$(($xh+$th+$ah+5)) "xc :white" tt.png -geometry +0+0 -composite $fn -geometry +0+$th -composite at.png -geometry +0+$(($th+$xh+5)) -composite ${fn%\.*}_cmp.png; echo -e "$fn $nn $xw $ xh $th $ah \n$tt \n$at\n"; done url="put_url_here";audio=$(youtube-dl -s -e $url);wget -q -O - `youtube-dl -g $u rl`| ffmpeg -i - -f mp3 -vn -acodec libmp3lame - > "$audio.mp3"

You might also like