Substitute HTML escape codes when piping into menu (#5)

PR: Substitute HTML escape codes when piping into menu
This commit is contained in:
Theo Henson
2021-05-07 23:50:11 -04:00
committed by GitHub
parent df1d74b2fc
commit 89fe982535

9
subs
View File

@@ -187,16 +187,17 @@ cat_subs() {
# Finally, play the result with mpv.
get_sel() {
if [ -d "$SUBS_CACHE" ] ; then
sel=$(cat_subs | $SUBS_MENU_PROG)
# Pipe your subs feed into your desired menu and replace HTML escape codes (" -> ")
sel=$(cat_subs | sed -e 's/&quot;/"/g' -e 's/&amp;/\&/g' -e 's/&lt;/</g' -e 's/&gt;/>/g' | $SUBS_MENU_PROG)
else
die 'Subs cache has not been retrieved.'
fi
[ "$sel" ] || die Interrupted
chan="${sel#* }"
chan="${chan%%] *}"
title=${sel#*"$chan"\] }
oldchan="${sel#* }"
chan=$(printf '%s' "${oldchan%%] *}" | sed -e 's/\&/&amp;/g' -e 's/"/\&quot;/g' -e 's/</\&lt;/g' -e 's/>/\&gt;/g' )
title=$(printf '%s' "${sel#*"${oldchan%%] *}"\] }" | sed -e 's/\&/&amp;/g' -e 's/"/\&quot;/g' -e 's/</\&lt;/g' -e 's/>/\&gt;/g' )
while read -r line ; do
case $line in
*"$SEP$title$SEP"*)