Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- MP=`which mplayer`
- TOT=`which totem`
- if [ -z $TOT ] && [ -z $MP ]; then
- zenity --error --title "Videos" --text "No se encuentra ni Mplayer ni Totem en el sistema"
- exit 1
- fi
- if [ -z $TOT ] || [ -z $MP ]; then
- if [ -z $TOT ]; then
- echo "Totem no se encuentra en el sistema, se usa mplayer"
- REP=$MP
- elif [ -z $M ]; then
- echo "Mplayer no se encuentra en el sistema, se usa totem"
- REP=$TOT
- fi
- else REP=$TOT
- fi
- #!/bin/bash
- DIR="$HOME/videosget"
- ####Vemos la cantidad de archivos
- let FILES=`lsof -X | grep -i flash | grep tmp | wc -l`
- ###Definimos una funcion que nos va a dar la lista de archivos
- function LISTA {
- lsof -X | grep -i flash | grep tmp | awk '{print $2, $4}' | tr -d [a-zA-Z] | awk '{print "/proc/"$1"/fd/"$2}'
- }
- ####Definimos la funcion que nos va a permitir seleccionar los archivos para reproducir/guardar
- function SEL {
- SELECCION=`LISTA | zenity --text "Elija los videos deseados" --multiple --list --title "Videos" --column "videos" | tr "|" "\n"`
- if [ -z "$SELECCION" ]; then ##Verificamos que se haya seleccionado algun archivo, de no ser asi sale con un error
- zenity --error --title "Videos" --text "Debe elegir al menos un video"
- exit 1
- fi
- }
- function NOMBRE {
- FILE=$DIR/`zenity --entry --title "Videos" --text "Ingrese el nombre para el archivo $i"`.flv
- while [ -e "$FILE" ]; do
- zenity --question --title "Videos" --text "El archivo $FILE ya existe\nDesea Seleccionar otro nombre?"
- if [ 0 == $? ]; then
- FILE=$DIR/`zenity --entry --title "Videos" --text "Ingrese el nombre del archivo $i"`.flv
- else
- zenity --question --title "Videos" --text "Desea sobreescribir $FILE ?"
- if [ 0 == $? ]; then
- break
- else
- exit 0
- fi
- fi
- done
- }
- #Creamos el directorio videosget (en caso de no existir)
- if [ ! -d $DIR ]
- then
- mkdir $DIR
- fi
- if [ $FILES -gt 0 ]
- then
- ANS=$(zenity --list --title "Videos" --text "Elija la tarea a realizar" --radiolist --column " " --column "opcion" TRUE "Ver_videos" FALSE Guardar)
- if [ -z $ANS ]; then
- exit 0
- elif [ $ANS == Guardar ]; then
- SEL
- #Creamos un bucle for para pedir nombre de cada archivo
- for i in $SELECCION
- do
- NOMBRE
- cp $i "$FILE"
- done
- zenity --info --title "Videos" --text "Los archivos se guardaron en $DIR" --title "Videos"
- else
- SEL
- $MP $SELECCION
- fi
- else
- zenity --error --title "Videos" --text "No se encontraron videos"
- fi
Add Comment
Please, Sign In to add comment