Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- file=$(ls -p -1R /path/to/my/Lyrics/directory/ | grep -v /)
- str0=$(lsof -F n -c mpv -c clementine|grep -E "^.*\.mp3$|^.*\.mp4$|^.*\.mkv$|^.*\.flv$|^.*\.webm$"| awk -F"/" '{print $NF}')
- #str=${str%-*}
- str=$(echo "$str0" | sed 's/[^a-zA-Z0-9]/ /g')
- echo ""
- echo "playing:"
- echo "$str0"
- echo ""
- IFS=', ' read -r -a array <<< "$str"
- patterns=$(
- for element in "${array[@]}"
- do
- if [[ ${#element} > 2 ]]
- then
- echo -n "$element|"
- fi
- done
- )
- patterns=${patterns::-1}
- f=$(echo "$file" | awk '{ print NF,$0 }' IGNORECASE=1 FS="$patterns" | sort -nr )
- f=$(echo "$f" |head -10 )
- nn=$(echo "$f"|awk 'NR==1 {a=$1} NR==2 {b=$1} END {if( a ~ b )print "1"}')
- if [[ $nn == 1 ]]
- then
- echo "$f"|cat -n
- read -p " : " answer
- if [[ -z "$answer" ]] ;
- then
- exit
- fi
- else
- answer=1
- fi
- ff=$(echo -e "$f"|sed -n "$answer"p |awk '{for (i=2; i<NF; i++) printf $i " "; print $NF}')
- fff=$(find /path/to/my/Lyrics/directory/ -name "$ff")
- #echo "$ff"
- rr=$(echo "$ff" ; cat "$fff")
- #printf "\033[01;36m"
- echo "$rr"|less
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement