mirror of https://github.com/balkian/dotfiles.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.3 KiB
Bash
42 lines
1.3 KiB
Bash
13 years ago
|
#!/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
|
||
|
|
||
12 years ago
|
if [ -z "$1" ]; then
|
||
|
PLAYER=parole;
|
||
|
else
|
||
|
PLAYER=$1;
|
||
|
fi
|
||
|
|
||
13 years ago
|
destfile="$HOME/VideoCuevana$$"
|
||
12 years ago
|
# 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}')
|
||
12 years ago
|
files=$(sudo lsof 2>/dev/null | grep "Pepper Data" | awk '{gsub(/[a-z]/,"",$4);print "/proc/"$2"/fd/"$4}' | uniq -u)
|
||
12 years ago
|
|
||
|
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)
|
||
12 years ago
|
sudo $PLAYER $file
|
||
12 years ago
|
;;
|
||
|
link)
|
||
12 years ago
|
sudo ln -s $file $destfile && echo "Video linked successfully to $destfile." && echo "Enjoy"
|
||
|
sudo chown $USER:$USER $destfile
|
||
12 years ago
|
;;
|
||
|
copy)
|
||
12 years ago
|
sudo cp $file $destfile && echo "Video copied successfully to $destfile." && echo "Enjoy"
|
||
|
sudo chown $USER:$USER $destfile
|
||
12 years ago
|
;;
|
||
|
esac
|
||
|
|
||
|
done;
|