jeudi 30 mai 2013

OpenWithVLC

cd ~/.local/share/nautilus/scripts
gedit ~/.local/share/nautilus/scripts/OpenWithVLC

COPIE/COLLE
#!/bin/bash

## Ny Narendra Sisodiya, for SchoolOS
## narendra.sisodiya@gmail.com
## modified by: IRFAN NASEEF P
##             irfan@nitc.ac.in

checkFileType()
{
  file $1 | grep -i "audio" || file $1 | grep -i "video" || file $1 | grep -i "ogv" || file $1 | grep -i "mpeg"
  RES=$?
  if [ $RES -eq 0 ]
  then
      return 0
  else
      zenity --error --title "VLC says: " --text "Error: $FILENAME is not an audio/video file"
      return 1
 
   
   fi
}

IFS=$'\n'
for FILENAME in $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS
do
  checkFileType $FILENAME

  if [ $? -eq 0 ]
  then
    vlc --started-from-file --one-instance-when-started-from-file --playlist-enqueue "$FILENAME"
    
 fi
done

exit 0

################

SAUVEGARDER
ou

#!/bin/sh
path=$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS
result=""
cnt=0
for i in $path
do
if [ $cnt -eq 0 ]
then
result=$i
else
result=$result'\ '$i
fi
cnt=`expr $cnt + 1`
done
#vlc --playlist-enqueue "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS"
vlc --playlist-enqueue "$result"

Aucun commentaire:

Enregistrer un commentaire

Archives du blog