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 # AGPLv3
test -n "$ytfeed_feeds_dir" || ytfeed_feeds_dir=feeds/ test -n "$YTFEED_FEEDS_DIR" || YTFEED_FEEDS_DIR=feeds/
export ytfeed_feeds_dir export YTFEED_FEEDS_DIR
printf "\ printf "\
____ __ __ __ ____ __ __ __
@ -18,30 +18,30 @@ Subscribe to new feed.
printf 'Please enter the channel ID to which to be subscribed: ' printf 'Please enter the channel ID to which to be subscribed: '
</dev/tty \ </dev/tty \
head -n 1 \ head -n 1 \
| xargs ytfeed.dl "$ytfeed_feeds_dir" | xargs ytfeed.dl "$YTFEED_FEEDS_DIR"
Browse feeds. Browse feeds.
ytfeed.browse-feeds "$ytfeed_feeds_dir" \ ytfeed.browse-feeds "$YTFEED_FEEDS_DIR" \
| ../menu | ../menu
Browse all feeds. Browse all feeds.
cat "$ytfeed_feeds_dir"/*.xml \ cat "$YTFEED_FEEDS_DIR"/*.xml \
| ytfeed.aggregate \ | ytfeed.aggregate \
| ytfeed.browse-feed \ | ytfeed.browse-feed \
| ../menu | ../menu
Refresh feeds. Refresh feeds.
for f in "$ytfeed_feeds_dir"/*.xml for f in "$YTFEED_FEEDS_DIR"/*.xml
do printf '%s\\n' "\$f" \ do printf '%s\\n' "\$f" \
| sed -e 's,^.*/,,' \ | sed -e 's,^.*/,,' \
-e 's,\\.xml\$,,' \ -e 's,\\.xml\$,,' \
| xargs ytfeed.dl "$ytfeed_feeds_dir" | xargs ytfeed.dl "$YTFEED_FEEDS_DIR"
done done
Show configuration Show configuration
printf 'ytfeed_feeds_dir: %s\n' "$ytfeed_feeds_dir" >&2 printf 'YTFEED_FEEDS_DIR: %s\n' "$YTFEED_FEEDS_DIR" >&2
EOF EOF