1
0

latin, stow, make pretty

This commit is contained in:
dtb 2022-11-04 17:05:52 -04:00
parent 6f12aa0972
commit 885e6c199d

View File

@ -20,6 +20,13 @@ list_channels(){
done
}
latin(){
while str isvalue "$1"
do xq '.feed.pig' <"$1"
shift
done
}
stow(){
while str isvalue "$1"
do pig_fetch "$1" | xq -x "$(
@ -64,7 +71,13 @@ list_videos) # do something with youtube-dl?
'reduce .feed.entry[] as $item (
{};
. + { ($item.link."@href"): $item.title }
)'
)' \
| sed \
-e '1d' \
-e '$d' \
-e 's/\": \"/ /g' \
-e 's/^ \"//g' \
-e 's/\"\,$//g' # this is really hacky
;;
listen)
str isvalue "$2" \
@ -78,7 +91,7 @@ listen)
refresh)
if ! str isvalue "$2"
then for file in "$(pig_pen)"/*
do pig_latin "$file" \
do latin "$file" \
| jq '.feed_url' \
| xargs stow &
done
@ -87,7 +100,7 @@ refresh)
do list_channels \
| grep "$2" \
| cut -f 2 \
| xargs pig_latin \
| xargs latin \
| jq '.feed_url' \
| xargs stow
shift
@ -95,9 +108,12 @@ refresh)
fi
;;
subscribe)
str isvalue "$2" && ! str isvalue "$3" \
str isvalue "$2" \
|| usage
stow "$(feedurl "$(id "$2")")"
while str isvalue "$2"
do stow "$(feedurl "$(id "$2")")"
shift
done
;;
watch) # needs work
str isvalue "$2" \