examples/ytfeed: use a more intuitive environment variable

This commit is contained in:
dtb 2025-09-12 07:54:54 -06:00
parent 37b86e5cbb
commit d909721614

View File

@ -2,8 +2,8 @@
# AGPLv3
test -n "$ytfeed_feeds_dir" || ytfeed_feeds_dir=feeds/
export ytfeed_feeds_dir
test -n "$YTFEED_FEEDS_DIR" || YTFEED_FEEDS_DIR=feeds/
export YTFEED_FEEDS_DIR
printf "\
____ __ __ __
@ -18,30 +18,30 @@ 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"
| xargs ytfeed.dl "$YTFEED_FEEDS_DIR"
Browse feeds.
ytfeed.browse-feeds "$ytfeed_feeds_dir" \
ytfeed.browse-feeds "$YTFEED_FEEDS_DIR" \
| ../menu
Browse all feeds.
cat "$ytfeed_feeds_dir"/*.xml \
cat "$YTFEED_FEEDS_DIR"/*.xml \
| ytfeed.aggregate \
| ytfeed.browse-feed \
| ../menu
Refresh feeds.
for f in "$ytfeed_feeds_dir"/*.xml
for f in "$YTFEED_FEEDS_DIR"/*.xml
do printf '%s\\n' "\$f" \
| sed -e 's,^.*/,,' \
-e 's,\\.xml\$,,' \
| xargs ytfeed.dl "$ytfeed_feeds_dir"
| xargs ytfeed.dl "$YTFEED_FEEDS_DIR"
done
Show configuration
printf 'ytfeed_feeds_dir: %s\n' "$ytfeed_feeds_dir" >&2
printf 'YTFEED_FEEDS_DIR: %s\n' "$YTFEED_FEEDS_DIR" >&2
EOF