From 3ccd46b2b6b52ae36285befdfae835887c82f9b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=2E=20Fernando=20S=C3=A1nchez?= Date: Thu, 24 Jan 2013 21:18:58 +0100 Subject: [PATCH] Flasher handles TID in lsof and other players The default will be parole (xfce). As for the TID and lsof, I should look for a more elegant method... --- flasher.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/flasher.sh b/flasher.sh index d7ef682..88d44f7 100755 --- a/flasher.sh +++ b/flasher.sh @@ -4,6 +4,12 @@ # The video can be played, but it's deleted when the flash player is closed (unless you copied it). # @author: balkian +if [ -z "$1" ]; then + PLAYER=parole; +else + PLAYER=$1; +fi + destfile="$HOME/VideoCuevana$$" # PID1=$(pgrep -f flash) # info=($(lsof -p $PID1 | grep -i /tmp/flash | awk '{print $2; print $9}')) @@ -12,7 +18,7 @@ destfile="$HOME/VideoCuevana$$" # #echo "pid" $pid # #echo "file" $file # fdn=$(ls -l $dir | grep $file | awk '{print $9}') -files=$(sudo lsof 2>/dev/null | grep "Pepper Data" | awk '{gsub(/[a-Z]/,"",$4);print "/proc/"$2"/fd/"$4}') +files=$(sudo lsof 2>/dev/null | grep "Pepper Data" | awk '{gsub(/[a-z]/,"",$4);print "/proc/"$2"/fd/"$4}' | uniq -u) echo "Files:" $files for file in $files; do @@ -20,7 +26,7 @@ for file in $files; do sel=$(zenity --list --radiolist --text "Select action for: $file" --column "pick" --column "Option" TRUE "play" FALSE "copy" FALSE "link") case $sel in play) - sudo totem $file + sudo $PLAYER $file ;; link) ln -s $file $destfile && echo "Video linked successfully to $destfile." && echo "Enjoy"