Questo script effettua la conversione da file audio ".ogg" Theora a ".avi" . Questo è G-script.
Ecco lo script:#!/bin/bash
#
# AUTHOR: Maurizio di NuvoleSparse
#
# License: GNU General Public version 2 or any later version.
# This program comes with ABSOLUTELY NO WARRANTY; for details
# see the COPYING file or visit "http://www.gnu.org/licenses/gpl.html".
# This is free software, and you are welcome to redistribute it under
# certain conditions. See the GPL license for details.
#
# Dependence:
# zenity
# mencoder
# lame
#
usa_printf(){
inizio=0
fine=1024
p=1
while [ $p != ultima ]; do
printf "${temp:inizio:fine}" |
zenity --text-info --title="gtheora2avi - \
parte $p" &
inizio=$(( inizio+1024 ))
fine_ipotetica=$(( inizio+fine ))
if [ ${#temp} -lt $fine_ipotetica ]; then
p="ultima"
printf "${temp:inizio:fine}" | zenity --text-info \
--title="gtheora2avi - parte $p"
break
fi
p=$(( p+1 ))
done
}
##main
### trucco per evitare l'ostacolo di un path errato
### quando si avvia uno Gscript dalla Scrivania
PERCORSO="`echo $NAUTILUS_SCRIPT_CURRENT_URI| sed "s&^file://&&"`"
[ -n "$PERCORSO" ] && cd "$PERCORSO"
if [ $# -eq 0 ]; then
zenity --title="gtheora2avi" --error --title="Attenzione"\
--text="Seleziona almeno un file."
exit 1
fi
for arg ; do
if echo "$arg" | grep -q ".avi$"; then
filename="`basename "$arg" | sed "s/.[Oo][Gg][Gg]$//"`"
mencoder "$arg" -oac mp3lame -lameopts mode=2:cbr\
-ovc lavc -o "$filename.avi" 2>>/tmp/gtheora2avi.log
else
echo -e "Attenzione; '$arg' non e' un avi."\
>>/tmp/gtheora2avi.log
fi
done
if [ -s "/tmp/gtheora2avi.log" ]; then
echo -e "Lo script e' terminato." >>/tmp/gtheora2avi.log
temp="$(cat "/tmp/gtheora2avi.log")"
if [ ${#temp} -gt 1024 ]; then
usa_printf
else
cat "/tmp/gtheora2avi.log" | zenity\
--title="Errore - gtheora2avi"\
--text-info
fi
rm -f /tmp/gtheora2avi.log || zenity --title="gtheora2avi"\
--error --title="Attenzione"\
--text="Non e' stato possibile rimuovere il file /tmp/gtheora2avi.log! :-("
else
zenity --title="gtheora2avi" --info --text="Lo script e' terminato."
fi
exit 0
Ultimo aggiornamento 28 Ottobre 2008