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