m1gin 102

EditWithShell: Run Command

Samples:

  • abc=$(xargs -I {} echo {}); [[ "$abc" == "10" ]] && echo "==$abc" || echo "hey"


Check the selected youtube video id if it is available.

  • xargs -I {} python3 "/home/m1/Documents/python/learn-python/mblib/individual/vscode_editwithshell.py" {}
  • abc=$(xargs -I {} curl "https://www.youtube.com/oembed?url=http://www.youtube.com/watch?v={}&format=json"); [[ "$abc" == "Not Found" ]] && echo "[NA]" || echo "$abc" | jq '.type'

convert text to speech and save it as file and get filename:

  • prm=$(xargs -I {} echo {}); f=$(date +%s%N); espeak -v en+whisperf "$prm" -w $f.wav; echo "${PWD}/$f.wav";
  • prm=$(xargs -I {} echo {}); f=$(date +%s%N); google_speech -l en "$prm" -o $f.mp3; echo "${PWD}/$f.mp3";
  • xargs -I {} espeak -v tr+whisperf {} -w $(date +%s).wav; echo $(date +%s);

For text contains single quote ' xargs doesn't work correctly even though xargs -0 -null parameters used.

After long search, I overcome the problem using parallel

  • parallel -j0 -C '\t' 'prm1=`echo {1}`' ";" 'prm2=`echo {2}`' ";" espeak -v en+f5 '"$prm1"' -w '"$prm2.wav"' ";" echo '"${PWD}/$prm2.wav"'
  • parallel -j0 -C '\t' 'prm1=`echo {1}`' ";" 'prm2=`echo {2}`' ";" google_speech -l en '"$prm1"' -o '"prm2.mp3"' ";" echo '"${PWD}/$prm2.mp3"'


Add to: