Browse Source

Clear screen without pipeline interruption

Matteo Savatteri 4 years ago
parent
commit
c1e99eec7c
1 changed files with 5 additions and 2 deletions
  1. 5 2
      vaporget

+ 5 - 2
vaporget

@@ -16,7 +16,10 @@
 # along with this program.  If not, see <https://www.gnu.org/licenses/>.
 
 WEBSITE="https://vaporwave.ivan.moe/list/"
+# Save current virtual terminal for later
+TTY=$(tty)
 
+# Fetch the artist list from the website and let the user select from a menu
 wget -qO- $WEBSITE 2>/dev/null \
 	| grep "^<a href" \
 	| sed -e 's/<a href="//' \
@@ -25,8 +28,8 @@ wget -qO- $WEBSITE 2>/dev/null \
 	      -e 's/\/<\/a>.*/\noff/' \
 	| xargs -d '\n' dialog --title "VAPORGET" --checklist "Please, select an artist:" 0 0 0 3>&1 1>&2 2>&3 3>&- \
 	| sed -e 's/ /\n/g' -e '$a\' \
-	| sed -e 's,^,'"${WEBSITE}"',' \
-	| wget -i - --spider -r -l inf --no-parent --no-directories 2>&1 \
+	| { sed -e 's,^,'"${WEBSITE}"','; clear > $TTY; } \
+|wget -i - --spider -r -l inf --no-parent --no-directories 2>&1 \
 	| grep --line-buffered '^--' \
 	| stdbuf -oL cut -d' ' -f4 \
 	| grep --line-buffered '\.\(flac\|mp3\|wav\)$' \