menu/examples/ytfeed

46 lines
833 B
Bash
Executable File

#!/bin/sh
# 2020-2025 dtb. public domain
export YTFEED_FEEDS_DIR # well, just in case
printf "\
____ __ __ __
/_/ / /_ /_/ /_/ _/ /\\ ytfeed 2.0.0-pre
__/ / / /_ /_ /_/ /__\\ dtb 2020-2025
"
../menu <<EOF
Subscribe to new feed.
printf 'Please enter the channel ID to which to be subscribed: '
</dev/tty \
head -n 1 \
| xargs ytfeed.dl "$YTFEED_FEEDS_DIR"
Browse feeds.
ytfeed.browse-feeds "$YTFEED_FEEDS_DIR" \
| ../menu
Browse all feeds.
cat "$YTFEED_FEEDS_DIR"/*.xml \
| ytfeed.aggregate \
| ytfeed.browse-feed \
| ../menu
Refresh feeds.
for f in "$YTFEED_FEEDS_DIR"/*.xml
do printf '%s\\n' "\$f" \
| sed -e 's,^.*/,,' \
-e 's,\\.xml\$,,' \
| xargs ytfeed.dl "$YTFEED_FEEDS_DIR"
done
Show configuration
printf 'YTFEED_FEEDS_DIR: %s\n' "$YTFEED_FEEDS_DIR" >&2
EOF