-
-
Save DanielBoerlage/bed476640ea7b4fb4257 to your computer and use it in GitHub Desktop.
music stuff
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| alias getsong='youtube-dl --default-search "gvsearch1:" -x --audio-format opus --audio-quality 64K -o ~/Music/%\(title\)s.%\(ext\)s' | |
| playsong() { | |
| search_q="^`printf "(?=.*%s)" "$@"`.+" | |
| song_file=`find ~/Music | grep -iP --color=never "$search_q"` | |
| if [[ -z "$song_file" ]] | |
| then | |
| echo -e "\e[1mno local songs found" | |
| wget $(youtube-dl -f 140 -g --default-search "gvsearch1:" "song $*") -O - 2>/dev/null | \ | |
| mplayer -nolirc -msgcolor -msglevel all=0:statusline=5 /dev/fd/3 3<&0 </dev/tty | |
| else | |
| file_name=`basename "$song_file"` | |
| echo -e "playing local song \e[1m${file_name%.*}\e[m" | |
| mplayer -nolirc -msgcolor -msglevel all=0:statusline=5 "$song_file" | |
| #mplayer -nolirc -msgcolor -msgmodule "$song_file" | |
| fi | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment