brtv-generate-theme-channels.sh: pass hashtags.txt path as argument - bitreich-tv - Meme TV encoding and streaming HTML git clone git://bitreich.org/bitreich-tv git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/bitreich-tv DIR Log DIR Files DIR Refs DIR Tags DIR LICENSE --- DIR commit 7acbd53258bc1f755c39d9766706e4fd0df431bf DIR parent 42358e6a74041c43405b61d76660051707638803 HTML Author: Anders Damsgaard <anders@adamsgaard.dk> Date: Mon, 2 Nov 2020 21:34:25 +0100 brtv-generate-theme-channels.sh: pass hashtags.txt path as argument Diffstat: M bin/brtv-generate-theme-channels.sh | 19 ++++++++++++++----- M brtv-generate-playlists.sh | 2 +- 2 files changed, 15 insertions(+), 6 deletions(-) --- DIR diff --git a/bin/brtv-generate-theme-channels.sh b/bin/brtv-generate-theme-channels.sh @@ -1,9 +1,18 @@ #!/bin/sh # generate channels where tags begin with a common word -# pass hashtags.txt as stdin -# optionally specify cutoff value as $1 +# specify hashtags.txt path as $1 and optionally specify cutoff value as $2 -awk -v cutoff="${1:-25}" ' +die() +{ + printf '%s: error: %s\n' "${0##*/}" "$1" >&2 + exit 1 +} + +if [ $# -lt 1 ] || [ ! -r "$1" ]; then + die 'pass hashtags.txt path as first argument' +fi + +awk -v cutoff="${2:-25}" ' /^#[A-z0-9]+-.* / { split($1, tagwords, "-") tags[tagwords[1]]++ @@ -13,8 +22,8 @@ END { if (tags[tag] >= cutoff) print tag } -' | while read -r tag; do - grep -E "^${tag}-" "${annna}/${tagfile}" | \ +' "${1}" | while read -r tag; do + grep -E "^${tag}" "${1}" | \ sort -R | \ bin/brtv-generate-playlist.sh | \ bin/brtv-playlist-to-m3u.sh > "${tag#\#}.m3u" DIR diff --git a/brtv-generate-playlists.sh b/brtv-generate-playlists.sh @@ -12,7 +12,7 @@ cd "$brtv" ./bin/brtv-imgs-to-video.sh < "${annna}/${tagfile}" >/dev/null f="$(mktemp)" -./bin/brtv-generate-theme-channels.sh < "${annna}/${tagfile}" +./bin/brtv-generate-theme-channels.sh "${annna}/${tagfile}" ./bin/brtv-news.sh "${annna}" "${tagfile}" > news.m3u sort -R "${annna}/${tagfile}" | \