diff --git a/functions.sh b/functions.sh index 7c7616a..c4f9cbb 100755 --- a/functions.sh +++ b/functions.sh @@ -94,16 +94,6 @@ function beeper while true; do printf "\e[?5h\007"; sleep 0.25; printf "\e[?5l"; read -s -n -t1 && break; done; } -## Search youtube for string ($1) and play video (uses mplayer) -function pyt -{ - echo 'https://www.youtube.com/results?search_query='"$(sed 's/ /%20/g' <<< $(tr '\' '+' <<< "$@"))"; id=$(curl -s 'https://www.youtube.com/results?search_query='"$(sed 's/ /%20/g' <<< $(tr '\' '+' <<< "$@"))" | grep -om3 '"[[:alnum:]]\{11\}"' | awk NR==3 | tr -d \"); url='https://www.youtube.com/watch?v='"$id"; echo -e "URL:\t$url"; youtube-dl -q $url -o - | mplayer -vo corevideo -really-quiet /dev/fd/3 3<&0 /dev/null & - if [[ $(python --version) == "Python 3"* ]]; then - python -m http.server 8000 + if [[ "$(command -v python3)" ]]; then + python=python3 else - python -m SimpleHTTPServer + python=python fi + $python -m http.server 8000 ) } - +alias webserver='httpserver' ## Upload something using the transfer.sh service. Usage: transfer filename function transfer