From 89fe9825352dfbc4925557e16c04d00ca4fac11a Mon Sep 17 00:00:00 2001 From: Theo Henson Date: Fri, 7 May 2021 23:50:11 -0400 Subject: [PATCH] Substitute HTML escape codes when piping into menu (#5) PR: Substitute HTML escape codes when piping into menu --- subs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/subs b/subs index ae706f5..222de78 100755 --- a/subs +++ b/subs @@ -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/"/"/g' -e 's/&/\&/g' -e 's/<//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/\&/&/g' -e 's/"/\"/g' -e 's//\>/g' ) + title=$(printf '%s' "${sel#*"${oldchan%%] *}"\] }" | sed -e 's/\&/&/g' -e 's/"/\"/g' -e 's//\>/g' ) while read -r line ; do case $line in *"$SEP$title$SEP"*)