all repos — zenUtils @ 4f05f8a6e41dc32af80144d9c078d8a5dc898b5c

misc utilities for computing zen

add podlist, zdconvert; update README
Iris Lightshard nilix@nilfm.cc
PGP Signature
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEkFh6dA+k/6CXFXU4O3+8IhROY5gFAmNgoVEACgkQO3+8IhRO
Y5gXDg//VtTwoomYrQ2feAE4fLWrrT17bZw+Pmr1H1Sx/zXv8qIcuJvy4CYzrMDy
ABRU0mSH1rETG8jkWfKJNBJgJ2hBIz8wiaC0ixr/5UXcqj0G6PtbyigwoAaOH33r
kmRokGKQMs8k8QPhC3e6/F+PQxL9s9V2/cnX4HQRbDMEnk/pB2Pt3pBtI+IsgsF4
WtKGhnm9zv41GR4BBoErVLwykCpt5sEwzM7BJRCjSv/BHdZfTA1YmGmnPQaE95E0
AaTEDTcLZGNfm6zdAcYu3NgAQr5dEOWg5Bq0lLisaRTpi9dxi+HrXH9+//7qnAT5
BBweGw7/Amkoqg8McEhgDJEQOAGxZT9kDac7DkUrIg3IGWAvMt9hSCE1zM6Ht76R
tdQxwMRTZWEgUSAWDEUkKAY2RVaFVZB/DtiHcYNRWspjNBhDKQ/jsbJNPXGHf9SV
JKZDagy73Icoa8btTDpO8RyQ2uVoOIetN2kqnPeyTz3A9Kza1qctCc45GKluVnk/
la5UsXU548lIoBLzH6xafNTAAjbU2uN66byTykinEguMFaFgwdK3I7ZpAHVrWr5n
Nzm4gwoZhheaAipNLb37MomkZesgIDmbFT1YPd1gqAxuwf+U1v+r6AVsZVmeGWxo
Fpo/SH9Sul1aIRFsulYEb9AaT2RHk4b4ClRvFbT9MHtbVV6K+TM=
=wWqB
-----END PGP SIGNATURE-----
commit

4f05f8a6e41dc32af80144d9c078d8a5dc898b5c

parent

21666c992a1e793d0db919c2609c94243e32ceec

3 files changed, 74 insertions(+), 0 deletions(-)

jump to
M README.mdREADME.md

@@ -34,6 +34,10 @@ ### ztabelle

Generate a timesheet for a given month by manipulating the output from `zeit` +### zdconvert + +Breakdown weekly data from `zeit` into by-day/by-project buckets for easy transferral to daptiv + ### riosh Shell script to loosley emulate `rio` behavior in a EWMH-compliant WM

@@ -53,6 +57,10 @@

### dynacal displays either regular or arvelie clock in a tint2 executor, with an action to switch them as well + +### podlist + +Parse podcast `rss` feeds into `m3u` playlists to drag-n-drop into `audacious` or any other audio player; uses `xmllint` from [libxml2](https://github.com/GNOME/libxml2) ## License
A podlist.sh

@@ -0,0 +1,16 @@

+#!/bin/sh + +# Derek Stevens <nilix@nilfm.cc> +# MIT license + +# export PODLIST_DATA_DIR=/wherever/you/want in your shell startup +# and keep a .feeds file in it where each line looks like: +# podcast_name https://domain.com/path/to/rss/feed + +while read l; do + set -- ${l} + tmpfile=$(mktemp) + wget -O ${tmpfile} $2 + xmllint --xpath '/rss/channel/item/enclosure/@url' ${tmpfile} | sed -e 's/url=//g' -e 's/"//g' > ${PODLIST_DATA_DIR:-~}/${1}.m3u + rm ${tmpfile} +done < ${PODLIST_DATA_DIR:-~}/.feeds
A zdconvert.sh

@@ -0,0 +1,50 @@

+#!/bin/sh + +# format zeit data for easy transferrence to daptiv +# Derek Stevens <nilix@nilfm.cc> +# MIT License + +if [ "$1" = "--help" ]; then + echo "usage:" + echo " $0 WEEKS_AGO_START=1 WEEKS_AGO_END=1" + echo " Print report of tracked time for the given weeks to stdout" + exit 1 +fi + +weeks_start=${1:-1} +weeks_end=${2:-1} + +while [ ${weeks_start} -ge ${weeks_end} ]; do + start=$(date -Is --date="0:00 Sat ${weeks_start} weeks ago") + end=$(date -Is --date="23:59 Fri $((weeks_start - 1)) weeks ago") + + echo "week starting ${start}" + zeit list --since ${start} --until ${end} --total --no-colors --decimal | tail -n2 + + i=${weeks_start} + oldifs=${IFS} + for d in Sat Sun Mon Tue Wed Thu Fri; do + echo "${d}" + [ "${d}" = $(date +"%a") ] && [ ${weeks_start} -eq 1 ] && i=$((i-1)) + dayStart=$(date -Is --date="00:00 ${d} ${i} weeks ago") + dayEnd=$(date -Is --date="23:59 ${d} ${i} weeks ago") + IFS=" +" + for p in $(zeit list --since ${dayStart} --until ${dayEnd} --only-projects-and-tasks --no-colors | grep ◆ | awk '{for (i=2; i<NF; i++) printf $i " "; print $NF;}'); do + echo "\t${p}:" + + + ntasks=1 + while read task; do + echo "\t\t${task} $(zeit list --since ${dayStart} --until ${dayEnd} --project ${p} --decimal | awk '{print $(NF-1) "\n";}' | head -n${ntasks} | tail -n1)" + ntasks=$((ntasks+1)) + done << EOF +$(zeit list --since ${dayStart} --until ${dayEnd} --project ${p} --decimal | awk '{for (i=2; i<NF; i++) printf $i " "; print $NF;}' | awk -F' on' '{print $1 "\n"}') +EOF + echo "\t\t$(zeit list --since ${dayStart} --until ${dayEnd} --project ${p} --total --decimal | tail -n2 | cut -f2- -d ' ')" + done + + IFS=${oldifs} + done + weeks_start=$((weeks_start-1)) +done