2012-01-07 14:18:44 +00:00
|
|
|
#!/bin/bash
|
|
|
|
# Script to copy/link Cuevana files to your home directory or play them with your default video player.
|
|
|
|
# Tested only with one cuevana instance at a time.
|
|
|
|
# The video can be played, but it's deleted when the flash player is closed (unless you copied it).
|
|
|
|
# @author: balkian
|
|
|
|
|
2013-01-24 20:18:58 +00:00
|
|
|
if [ -z "$1" ]; then
|
|
|
|
PLAYER=parole;
|
|
|
|
else
|
|
|
|
PLAYER=$1;
|
|
|
|
fi
|
|
|
|
|
2012-01-07 14:18:44 +00:00
|
|
|
destfile="$HOME/VideoCuevana$$"
|
2012-12-02 02:58:47 +00:00
|
|
|
# PID1=$(pgrep -f flash)
|
|
|
|
# info=($(lsof -p $PID1 | grep -i /tmp/flash | awk '{print $2; print $9}'))
|
|
|
|
# dir="/proc/${info[0]}/fd"
|
|
|
|
# file=${info[1]}
|
|
|
|
# #echo "pid" $pid
|
|
|
|
# #echo "file" $file
|
|
|
|
# fdn=$(ls -l $dir | grep $file | awk '{print $9}')
|
2013-01-24 20:18:58 +00:00
|
|
|
files=$(sudo lsof 2>/dev/null | grep "Pepper Data" | awk '{gsub(/[a-z]/,"",$4);print "/proc/"$2"/fd/"$4}' | uniq -u)
|
2012-12-02 02:58:47 +00:00
|
|
|
|
|
|
|
echo "Files:" $files
|
|
|
|
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)
|
2013-01-24 20:18:58 +00:00
|
|
|
sudo $PLAYER $file
|
2012-12-02 02:58:47 +00:00
|
|
|
;;
|
|
|
|
link)
|
|
|
|
ln -s $file $destfile && echo "Video linked successfully to $destfile." && echo "Enjoy"
|
|
|
|
;;
|
|
|
|
copy)
|
|
|
|
cp $file $destfile && echo "Video copied successfully to $destfile." && echo "Enjoy"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
done;
|