9.04.2015 г.

Search for avi file, and play them with vlc - Bash script

#!/bin/bash
#In variable filename save result for find 
filename="result.txt"

#use find command for search for file +1G search for file gt 1G
find /home/borko/ -maxdepth 6 -type f -name *.avi -size +1G > $filename &&

#If not result save data in file
if [ $? -ne 0 ]
then
        date >> $filename
 
fi

#Function read line by line and play with vlc
while read line
do
 name=$line
 echo "Played - $line"
 vlc "$name"
 kill -9 vlc
done < $filename



#If you not use file do this in same line for play mp3 file:
find /home/borko/ -maxdepth 6 -type f -name *.mp3 -size -exec vlc {} \;
#This is a little function
mp3(){
 cd "/home/borko/Музика/"
 o=$IFS
 IFS=$(echo -n "\n\b")
 find -type f -name "*.mp3" -print0 | while read -d $'\0' name
 do
   `vlc $name`
 done
 IFS=o
}

Няма коментари :

Публикуване на коментар