Last active
January 29, 2016 10:21
-
-
Save gtataranni/3cb3d0b7c1b185555838 to your computer and use it in GitHub Desktop.
find the first closer match in your music folder and play it. The first word should be in the song filename, the others can be either in the filename or in the path, as for artist name
This file contains 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
#!/bin/bash | |
MUSIC_DIR="/media/Volume/Musica personale/" | |
find "$MUSIC_DIR" -iname "*$1*.mp3" -o -iname "*$1*.wma" -type f | while read line; do | |
good=1; | |
for arg in $@ ; do | |
if [ $good -eq 1 ]; then | |
echo $line | grep -i -q "$arg" | |
if [ $? -eq 1 ] ; then | |
good=0; | |
fi | |
fi | |
done | |
if [ $good -eq 1 ]; then | |
#echo $line | |
mplayer -volume 75 "$line" </dev/tty | |
#exit this subshell | |
exit 1 | |
fi | |
done | |
#if song is not in MUSIC_DIR: play it form youtube | |
if [ $? -eq 0 ] ; then | |
#echo "YOUTUBEEEEE!" | |
mpsyt ."$@",1,q | |
fi | |
echo "Bye!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment