|
Dimensione: 19739
Commento:
|
Dimensione: 17699
Commento: ripristinata versione precedente per problemi di formattazione
|
| Le cancellazioni sono segnalate in questo modo. | Le aggiunte sono segnalate in questo modo. |
| Linea 3: | Linea 3: |
| [[BR]]||<tablebgcolor="#f1f1ed" tablewidth="40%" tablestyle="margin: 0pt 0pt 1em 1em; float: right; font-size: 0.9em;"style="padding: 0.5em;">'''Indice'''[[BR]][[TableOfContents]] || |
[[BR]] ||<tablestyle="float:right; font-size: 0.9em; width:40%; background:#F1F1ED; margin: 0 0 1em 1em;" style="padding:0.5em;">'''Indice'''[[BR]][[TableOfContents]]|| |
| Linea 7: | Linea 7: |
| Linea 11: | Linea 12: |
| Questi ''script'' vanno posizionati nella directory {{{~/.gnome2/nautilus-scripts}}} (identificata anche da {{{/home/<utente>/.gnome2/nautilus-scripts}}} dove «'''utente'''» è l'utente desiderato), e resi eseguibili digitando in un terminale il seguente comando: {{{ |
Questi ''script'' vanno posizionati nella directory {{{~/.gnome2/nautilus-scripts}}} (identificata anche da {{{/home/<utente>/.gnome2/nautilus-scripts}}} dove «'''utente'''» è l'utente desiderato), e resi eseguibili digitando in un terminale il seguente comando: {{{ |
| Linea 21: | Linea 20: |
| == Raccolta di Script per Nautilus == Esiste una raccolta di script per Nautilus (sono più di 100), presente nel sitohttp://g-scripts.sourceforge.net. Per estendere Nautilus con tutti gli script della compilation, eseguire i seguenti comandi: {{{ cd ~/.gnome2/nautilus-scripts wget http://g-scripts.sourceforge.net/nautilus-scripts.tar.gz tar zxvf nautilus-scripts.tar.gz}}} Se il comando wget non riesce a recuperare il .tar.gz con la raccolta degli script potete fare il download direttamente dal sito del progetto. == Manda via mail il file selezionato == Questo è veramente utile per cercare un file e inviarlo per email dalla posizione in cui ci si trova: {{{ |
== Manda via mail il file selezionato == Questo è veramente utile per cercare un file e inviarlo per email dalla posizione in cui ci si trova: {{{ |
| Linea 60: | Linea 50: |
| } else { $MAILTO_URL = $MAILTO_URL . "attach=" . $file . "&"; shift; $count += 1; } } if ($count > 0) { my @command = ("gnome-open", $MAILTO_URL); system(@command); } }}} La sintassi `mailto:` non funziona con '''mozilla-thunderbird'''. La seguente versione sembra invece funzionare con Thunderbird: NOTA: Funziona con Mozilla-Thunderbird ma non con Thunderbird2 (non presente nei repositories) {{{ #!/usr/bin/perl -w # By John Russell # and hacked to work with thunderbird by Darrell # This script sends the selected file(s) with mozilla-thunderbird. use strict; my $attach_string="\"attachment='"; my @files = split("\n", $ENV{NAUTILUS_SCRIPT_SELECTED_FILE_PATHS}); my $count = 0; foreach my $file (@files) { if ( ! -f $file && ! -l $file ) { my @dialog = ("gdialog","--title","Error","--msgbox", "\nError: Can not send $file. \n\n Only regular files can be mailed. ","200", "300"); system (@dialog); |
|
| Linea 66: | Linea 116: |
| $MAILTO_URL = $MAILTO_URL . "attach=" . $file . "&"; | $attach_string = $attach_string . "file://" . $file . ","; |
| Linea 80: | Linea 130: |
| my @command = ("gnome-open", $MAILTO_URL); system(@command); |
$attach_string = $attach_string . "'\""; # replace spaces with '%20' as demanded by mozilla/thunderbird $attach_string =~ s/\s/%20/g; # invoke shell script to call thunderbird differently depending on whether it's running already or not my $command = ("~/scripts/thunderbird-email-attachments " . $attach_string); system($command); |
| Linea 88: | Linea 146: |
| La sintassi {{{mailto:}}} non funziona con '''mozilla-thunderbird'''. La seguente versione sembra invece funzionare con Thunderbird: NOTA: Funziona con Mozilla-Thunderbird ma non con Thunderbird2 (non presente nei repositories) {{{ #!/usr/bin/perl -w # By John Russell # and hacked to work with thunderbird by Darrell # This script sends the selected file(s) with mozilla-thunderbird. use strict; my $attach_string="\"attachment='"; my @files = split("\n", $ENV{NAUTILUS_SCRIPT_SELECTED_FILE_PATHS}); my $count = 0; foreach my $file (@files) { if ( ! -f $file && ! -l $file ) { my @dialog = ("gdialog","--title","Error","--msgbox", "\nError: Can not send $file. \n\n Only regular files can be mailed. ","200", "300"); system (@dialog); } |
Nell'ultime righe dello script precedente viene richiesto il seguente script di shell, (indicato con `~/scripts/thunderbird-email-attachments`. Attenzione a non posizionarlo nella directory `nautilus-scripts`, altrimenti sarebbe visibile nel menù contestuale):{{{ #!/bin/sh # if thunderbird is already running open a compose window in the running instance if `ps xc | grep -q mozilla-thunder`; then exec mozilla-thunderbird -a Mozilla-Thunderbird -remote "xfeDoCommand(ComposeMessage,$1)" # else start a new instance with the compose window only else exec mozilla-thunderbird -compose $1 fi }}} == Montare un'immagine ISO == Montare un'immagine ISO, da Nautilus: {{{ #!/bin/bash # #By modprobing loop it makes sure that the module is loaded and ready for #use. If it is already loaded then nothing will happen. modprobe loop for I in `echo $*` do foo=`gksudo -u root -k -m "enter your password for root terminal access" /bin/echo "got r00t?"` sudo mount -o loop -t iso9660 $I /media/iso done done exit0 }}} == Smontare un'immagine ISO == Smontare immagine ISO, da nautilus: {{{ #!/bin/bash # for I in `echo $*` do foo=`gksudo -u root -k -m "inserire la tua password di root" /bin/echo "got r00t?"` sudo umount $I done done exit0 }}} == Impostare la sola lettura sui file == Cambiare i permessi dei file in sola lettura:{{{ #!/bin/bash chmod ugo=r $* }}} == Editare file con gedit usando i privilegi di root == {{{ #!/bin/bash # for I in `echo $*` do foo=`gksudo -u root -k -m "inserei la tua password di root" /bin/echo "got r00t?"` sudo gedit $I done done exit0 }}} == Aprire Nautilus con i privilegi di root == {{{ #!/bin/bash # root-nautilus-here # opens a root-enabled instance of a nautilus window in selected location # requires sudo privileges and gksudo, which may involve security risks. #Install in your ~/Nautilus/scripts directory. # # Placed in the public domain by Shane T. Mueller 2001 # Fixes provided by Doug Nordwall # # 2004.04.18 -- keith@penguingurus.com - Added gksudo usage to provide popup # password window if sudo has expired. Line only echos got # root to std output. But gksudo updates your sudo access # privs, so running nautilus with sudo will succeed # without asking for a password. foo=`gksudo -u root -k -m "enter your password for nautilus root access" /bin/echo "got r00t?"` sudo nautilus --no-desktop $NAUTILUS_SCRIPT_CURRENT_URI }}} == Avviare file con i privilegi di root == {{{ #!/bin/bash # for I in `echo $*` do /usr/bin/gksudo $I done done exit0 }}} == Aprire la finestra di ricerca == {{{ #!/bin/sh # From Johnathan Bailes # This script opens a gnome-search-tool in the directory you select. # # Distributed under the terms of GNU GPL version 2 or later # # Install in your ~/Nautilus/scripts directory. # You need to be running Nautilus 1.0.3+ to use scripts. cd $NAUTILUS_SCRIPT_CURRENT_URI exec gnome-search-tool }}} == Aprire il terminale == {{{ #!/bin/bash # # This script opens a gnome-terminal in the directory you select. # # Distributed under the terms of GNU GPL version 2 or later # # Install in ~/.gnome2/nautilus-scripts or ~/Nautilus/scripts # You need to be running Nautilus 1.0.3+ to use scripts. # When a directory is selected, go there. Otherwise go to current # directory. If more than one directory is selected, show error. if [ -n "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" ]; then set $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS if [ $# -eq 1 ]; then destination="$1" # Go to file's directory if it's a file if [ ! -d "$destination" ]; then destination="`dirname "$destination"`" fi |
| Linea 123: | Linea 383: |
| { $attach_string = $attach_string . "file://" . $file . ","; shift; $count += 1; } } if ($count > 0) { $attach_string = $attach_string . "'\""; # replace spaces with '%20' as demanded by mozilla/thunderbird $attach_string =~ s/\s/%20/g; # invoke shell script to call thunderbird differently depending on whether it's running already or not my $command = ("~/scripts/thunderbird-email-attachments " . $attach_string); system($command); } }}} Nell'ultime righe dello script precedente viene richiesto il seguente script di shell, (indicato con {{{~/scripts/thunderbird-email-attachments}}}. Attenzione a non posizionarlo nella directory {{{nautilus-scripts}}}, altrimenti sarebbe visibile nel menù contestuale): {{{ |
zenity --error --title="Error - Open terminal here" \ --text="You can only select one directory." exit 1 fi else destination="`echo "$NAUTILUS_SCRIPT_CURRENT_URI" | sed 's/^file:\/\///'`" fi # It's only possible to go to local directories if [ -n "`echo "$destination" | grep '^[a-zA-Z0-9]\+:'`" ]; then zenity --error --title="Error - Open terminal here" \ --text="Only local directories can be used." exit 1 fi cd "$destination" exec x-terminal-emulator }}} == Nascondere o mostrare i file nascosti == {{{ |
| Linea 160: | Linea 421: |
| # if thunderbird is already running open a compose window in the running instance if `ps xc | grep -q mozilla-thunder`; then exec mozilla-thunderbird -a Mozilla-Thunderbird -remote "xfeDoCommand(ComposeMessage,$1)" # else start a new instance with the compose window only else exec mozilla-thunderbird -compose $1 fi }}} == Montare un'immagine ISO == Montare un'immagine ISO, da Nautilus: {{{ #!/bin/bash # #By modprobing loop it makes sure that the module is loaded and ready for #use. If it is already loaded then nothing will happen. modprobe loop for I in `echo $*` do foo=`gksudo -u root -k -m "enter your password for root terminal access" /bin/echo "got r00t?"` sudo mount -o loop -t iso9660 $I /media/iso done done exit0 }}} == Smontare un'immagine ISO == Smontare immagine ISO, da nautilus: {{{ #!/bin/bash # for I in `echo $*` do foo=`gksudo -u root -k -m "inserire la tua password di root" /bin/echo "got r00t?"` sudo umount $I done done exit0 }}} == Impostare la sola lettura sui file == Cambiare i permessi dei file in sola lettura: {{{ #!/bin/bash chmod ugo=r $* }}} == Editare file con gedit usando i privilegi di root == {{{ #!/bin/bash # for I in `echo $*` do foo=`gksudo -u root -k -m "inserei la tua password di root" /bin/echo "got r00t?"` sudo gedit $I done done exit0 }}} == Aprire Nautilus con i privilegi di root == {{{ #!/bin/bash # root-nautilus-here # opens a root-enabled instance of a nautilus window in selected location # requires sudo privileges and gksudo, which may involve security risks. #Install in your ~/Nautilus/scripts directory. # # Placed in the public domain by Shane T. Mueller 2001 # Fixes provided by Doug Nordwall # # 2004.04.18 -- keith@penguingurus.com - Added gksudo usage to provide popup # password window if sudo has expired. Line only echos got # root to std output. But gksudo updates your sudo access # privs, so running nautilus with sudo will succeed # without asking for a password. foo=`gksudo -u root -k -m "enter your password for nautilus root access" /bin/echo "got r00t?"` sudo nautilus --no-desktop $NAUTILUS_SCRIPT_CURRENT_URI }}} == Avviare file con i privilegi di root == {{{ #!/bin/bash # for I in `echo $*` do /usr/bin/gksudo $I done done exit0 }}} == Aprire la finestra di ricerca == {{{ #!/bin/sh # From Johnathan Bailes # This script opens a gnome-search-tool in the directory you select. # # Distributed under the terms of GNU GPL version 2 or later # # Install in your ~/Nautilus/scripts directory. # You need to be running Nautilus 1.0.3+ to use scripts. cd $NAUTILUS_SCRIPT_CURRENT_URI exec gnome-search-tool }}} == Aprire il terminale == {{{ #!/bin/bash # # This script opens a gnome-terminal in the directory you select. # # Distributed under the terms of GNU GPL version 2 or later # # Install in ~/.gnome2/nautilus-scripts or ~/Nautilus/scripts # You need to be running Nautilus 1.0.3+ to use scripts. # When a directory is selected, go there. Otherwise go to current # directory. If more than one directory is selected, show error. if [ -n "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" ]; then set $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS if [ $# -eq 1 ]; then destination="$1" # Go to file's directory if it's a file if [ ! -d "$destination" ]; then destination="`dirname "$destination"`" fi else zenity --error --title="Error - Open terminal here" \ --text="You can only select one directory." exit 1 fi |
# When hidden files (.emacs, etc) are hidden, shows "Show Hidden Files" option. # When hidden files are shown, shows "Hide Hidden Files" option. # Uses gconf to toggle between the two Nautilus options. # Should be placed in ~/.gnome2/nautilus-scripts/ with executable permission. OLDSTATE=$(gconftool-2 --get "/desktop/gnome/file_views/show_hidden_files") if [ "$OLDSTATE" == "false" ] ; then NEWSTATE="True" mv ~/.gnome2/nautilus-scripts/Show\ Dot\ Files ~/.gnome2/nautilus-scripts/Hide\ Dot\ Files |
| Linea 392: | Linea 439: |
| destination="`echo "$NAUTILUS_SCRIPT_CURRENT_URI" | sed 's/^file:\/\///'`" | NEWSTATE="False" mv ~/.gnome2/nautilus-scripts/Hide\ Dot\ Files ~/.gnome2/nautilus-scripts/Show\ Dot\ Files |
| Linea 396: | Linea 445: |
| # It's only possible to go to local directories if [ -n "`echo "$destination" | grep '^[a-zA-Z0-9]\+:'`" ]; then zenity --error --title="Error - Open terminal here" \ --text="Only local directories can be used." exit 1 fi cd "$destination" exec x-terminal-emulator }}} == Nascondere o mostrare i file nascosti == {{{ #!/bin/sh # When hidden files (.emacs, etc) are hidden, shows "Show Hidden Files" option. # When hidden files are shown, shows "Hide Hidden Files" option. # Uses gconf to toggle between the two Nautilus options. # Should be placed in ~/.gnome2/nautilus-scripts/ with executable permission. OLDSTATE=$(gconftool-2 --get "/desktop/gnome/file_views/show_hidden_files") if [ "$OLDSTATE" == "false" ] ; then NEWSTATE="True" mv ~/.gnome2/nautilus-scripts/Show\ Dot\ Files ~/.gnome2/nautilus-scripts/Hide\ Dot\ Files else NEWSTATE="False" mv ~/.gnome2/nautilus-scripts/Hide\ Dot\ Files ~/.gnome2/nautilus-scripts/Show\ Dot\ Files fi |
|
| Linea 449: | Linea 452: |
| {{{ | {{{ |
| Linea 470: | Linea 475: |
| {{{ | {{{ |
| Linea 479: | Linea 486: |
| Linea 486: | Linea 494: |
| # zenity # lame # mac # mppdec # mplayer # flac # faad # oggdec oggenc --> package: vorbis-tools |
# zenity # lame # mac # mppdec # mplayer # flac # faad # oggdec oggenc --> package: vorbis-tools |
| Linea 496: | Linea 504: |
| case $FORMATO in aac) SUPPORTO=yes FORMATOFILE=[Aa][Aa][Cc] ;; ape) SUPPORTO=yes FORMATOFILE=[Aa][Pp][Ee] ;; flac) SUPPORTO=yes FORMATOFILE=[Ff][Ll][Aa][Cc] ;; mp2) SUPPORTO=yes FORMATOFILE=[Mm][Pp]2 ;; mp3) SUPPORTO=yes FORMATOFILE=[Mm][Pp]3 ;; mpc) SUPPORTO=yes FORMATOFILE=[Mm][Pp][Cc] ;; ogg) SUPPORTO=yes FORMATOFILE=[Oo][Gg][Gg] ;; wav) SUPPORTO=yes FORMATOFILE=[Ww][Aa][Vv] ;; wave) FORMATO=wav SUPPORTO=yes FORMATOFILE=[Ww][Aa][Vv][Ee] ;; wma) SUPPORTO=yes FORMATOFILE=[Ww][Mm][Aa] ;; *) SUPPORTO=no ;; esac |
case $FORMATO in aac) SUPPORTO=yes FORMATOFILE=[Aa][Aa][Cc] ;; ape) SUPPORTO=yes FORMATOFILE=[Aa][Pp][Ee] ;; flac) SUPPORTO=yes FORMATOFILE=[Ff][Ll][Aa][Cc] ;; mp2) SUPPORTO=yes FORMATOFILE=[Mm][Pp]2 ;; mp3) SUPPORTO=yes FORMATOFILE=[Mm][Pp]3 ;; mpc) SUPPORTO=yes FORMATOFILE=[Mm][Pp][Cc] ;; ogg) SUPPORTO=yes FORMATOFILE=[Oo][Gg][Gg] ;; wav) SUPPORTO=yes FORMATOFILE=[Ww][Aa][Vv] ;; wave) FORMATO=wav SUPPORTO=yes FORMATOFILE=[Ww][Aa][Vv][Ee] ;; wma) SUPPORTO=yes FORMATOFILE=[Ww][Mm][Aa] ;; *) SUPPORTO=no ;; esac |
| Linea 547: | Linea 555: |
| faac -q $QUALITA -o "in formato .$FORMATO_CONVERSIONE/$FILE_CONVERTITO" "$WAVFILE" || echo "Errore del comando:faac -q $QUALITA -o 'in formato .$FORMATO_CONVERSIONE/$FILE_CONVERTITO' '$WAVFILE' ." >> /tmp/audioconvert.log | faac -q $QUALITA -o "in formato .$FORMATO_CONVERSIONE/$FILE_CONVERTITO" "$WAVFILE" || echo "Errore del comando:faac -q $QUALITA -o 'in formato .$FORMATO_CONVERSIONE/$FILE_CONVERTITO' '$WAVFILE' ." >> /tmp/audioconvert.log |
| Linea 551: | Linea 559: |
| mac "$WAVFILE" "in formato .$FORMATO_CONVERSIONE/$FILE_CONVERTITO" -c$QUALITA || echo "Errore del comando: mac '$WAVFILE' 'in formato .$FORMATO_CONVERSIONE/$FILE_CONVERTITO' -c$QUALITA ." >> /tmp/audioconvert.log | mac "$WAVFILE" "in formato .$FORMATO_CONVERSIONE/$FILE_CONVERTITO" -c$QUALITA || echo "Errore del comando: mac '$WAVFILE' 'in formato .$FORMATO_CONVERSIONE/$FILE_CONVERTITO' -c$QUALITA ." >> /tmp/audioconvert.log |
| Linea 555: | Linea 563: |
| flac -f --compression-level-$QUALITA "$WAVFILE" -o "in formato .$FORMATO_CONVERSIONE/$FILE_CONVERTITO" || echo "Errore del comando: flac --compression-level-$QUALITA '$WAVFILE' -o 'in formato .$FORMATO_CONVERSIONE/$FILE_CONVERTITO' ." >> /tmp/audioconvert.log | flac -f --compression-level-$QUALITA "$WAVFILE" -o "in formato .$FORMATO_CONVERSIONE/$FILE_CONVERTITO" || echo "Errore del comando: flac --compression-level-$QUALITA '$WAVFILE' -o 'in formato .$FORMATO_CONVERSIONE/$FILE_CONVERTITO' ." >> /tmp/audioconvert.log |
| Linea 559: | Linea 567: |
| lame -m auto --preset $QUALITA "$WAVFILE" "in formato .$FORMATO_CONVERSIONE/$FILE_CONVERTITO" || echo "Errore del comando: lame -m auto --preset $QUALITA '$WAVFILE' 'in formato .$FORMATO_CONVERSIONE/$FILE_CONVERTITO' ." >> /tmp/audioconvert.log | lame -m auto --preset $QUALITA "$WAVFILE" "in formato .$FORMATO_CONVERSIONE/$FILE_CONVERTITO" || echo "Errore del comando: lame -m auto --preset $QUALITA '$WAVFILE' 'in formato .$FORMATO_CONVERSIONE/$FILE_CONVERTITO' ." >> /tmp/audioconvert.log |
| Linea 563: | Linea 571: |
| mppenc --$QUALITA "$WAVFILE" "in formato .$FORMATO_CONVERSIONE/$FILE_CONVERTITO" || echo "Errore del comando: mppenc --$QUALITA '$WAVFILE' 'in formato .$FORMATO_CONVERSIONE/$FILE_CONVERTITO' ." >> /tmp/audioconvert.log | mppenc --$QUALITA "$WAVFILE" "in formato .$FORMATO_CONVERSIONE/$FILE_CONVERTITO" || echo "Errore del comando: mppenc --$QUALITA '$WAVFILE' 'in formato .$FORMATO_CONVERSIONE/$FILE_CONVERTITO' ." >> /tmp/audioconvert.log |
| Linea 567: | Linea 575: |
| oggenc "$WAVFILE" -q $QUALITA -o "in formato .$FORMATO_CONVERSIONE/$FILE_CONVERTITO" || echo "Errore del comando: oggenc '$WAVFILE' ${OGGTAGS[@]} -q $QUALITA -o 'in formato .$FORMATO_CONVERSIONE/$OGGFILE' ." >> /tmp/audioconvert.log | oggenc "$WAVFILE" -q $QUALITA -o "in formato .$FORMATO_CONVERSIONE/$FILE_CONVERTITO" || echo "Errore del comando: oggenc '$WAVFILE' ${OGGTAGS[@]} -q $QUALITA -o 'in formato .$FORMATO_CONVERSIONE/$OGGFILE' ." >> /tmp/audioconvert.log |
| Linea 571: | Linea 579: |
| cp "$FILE_CONVERTITO" "in formato .$FORMATO_CONVERSIONE/" 2>> /tmp/audioconvert.log | cp "$FILE_CONVERTITO" "in formato .$FORMATO_CONVERSIONE/" 2>> /tmp/audioconvert.log |
| Linea 577: | Linea 585: |
| mplayer "$FILE" -ao pcm:file="$WAVFILE" 2>> /tmp/audioconvert.log | mplayer "$FILE" -ao pcm:file="$WAVFILE" 2>> /tmp/audioconvert.log |
| Linea 581: | Linea 589: |
| mppdec "$FILE" "$WAVFILE" 2>> /tmp/audioconvert.log | mppdec "$FILE" "$WAVFILE" 2>> /tmp/audioconvert.log |
| Linea 585: | Linea 593: |
| mac "$FILE" "$WAVFILE" -d || echo "Errore del comando: mac '$FILE' '$WAVFILE' -d." >> /tmp/audioconvert.log | mac "$FILE" "$WAVFILE" -d || echo "Errore del comando: mac '$FILE' '$WAVFILE' -d." >> /tmp/audioconvert.log |
| Linea 589: | Linea 597: |
| flac -f -d "$FILE" -o "$WAVFILE" || echo "Errore del comando: flac -d '$FILE' -o '$WAVFILE'." >> /tmp/audioconvert.log | flac -f -d "$FILE" -o "$WAVFILE" || echo "Errore del comando: flac -d '$FILE' -o '$WAVFILE'." >> /tmp/audioconvert.log |
| Linea 593: | Linea 601: |
| oggdec "$FILE" -o "$WAVFILE" || echo "Errore del comando: oggdec '$FILE' -o '$WAVFILE'." >> /tmp/audioconvert.log |
oggdec "$FILE" -o "$WAVFILE" || echo "Errore del comando: oggdec '$FILE' -o '$WAVFILE'." >> /tmp/audioconvert.log |
| Linea 598: | Linea 606: |
| faad -o "$WAVFILE" "$FILE" || echo "Errore del comando: faad -o '$WAVFILE' '$FILE'." >> /tmp/audioconvert.log |
faad -o "$WAVFILE" "$FILE" || echo "Errore del comando: faad -o '$WAVFILE' '$FILE'." >> /tmp/audioconvert.log |
| Linea 603: | Linea 611: |
| lame --decode "$FILE" "$WAVFILE" || echo "Errore del comando: lame --decode '$FILE' '$WAVFILE'." >> /tmp/audioconvert.log | lame --decode "$FILE" "$WAVFILE" || echo "Errore del comando: lame --decode '$FILE' '$WAVFILE'." >> /tmp/audioconvert.log |
| Linea 607: | Linea 615: |
| lame -m auto --mp2input --preset $QUALITA "$FILE" "in formato .$FORMATO_CONVERSIONE/$FILE_CONVERTITO" || echo "Errore del comando: lame -m auto --mp2input [ "$FORMATO" != wav ]--preset $QUALITA '$FILE' 'in formato .$FORMATO_CONVERSIONE/$FILE_CONVERTITO' ." >> /tmp/audioconver.log | lame -m auto --mp2input --preset $QUALITA "$FILE" "in formato .$FORMATO_CONVERSIONE/$FILE_CONVERTITO" || echo "Errore del comando: lame -m auto --mp2input [ "$FORMATO" != wav ]--preset $QUALITA '$FILE' 'in formato .$FORMATO_CONVERSIONE/$FILE_CONVERTITO' ." >> /tmp/audioconver.log |
| Linea 611: | Linea 619: |
| zenity --title=Audioconvert --error --text="Script interrotto." kill $$ |
zenity --title=Audioconvert --error --text="Script interrotto." kill $$ |
| Linea 620: | Linea 628: |
| zenity --title=Audioconvert --error --text="Seleziona almeno un file." | zenity --title=Audioconvert --error --text="Seleziona almeno un file." |
| Linea 629: | Linea 637: |
| aac) QUALITA=`zenity --list --text="Scegli la qualita'." --radiolist --column=Selez. --column=Livello false 100 false 200 true 300 false 400 false 500 || interruzione`;; ape) QUALITA=`zenity --list --text="Scegli la qualita'." --radiolist --column=Selez. --column=Livello false 1000 false 2000 true 3000 false 4000 false 5000 || interruzione`;; flac) QUALITA=`zenity --list --text="Scegli la qualita'." --radiolist --column=Selez. --column=Livello false 0 false 1 false 2 false 3 false 4 false 5 false 6 false 7 true 8 || interruzione`;; mp3) QUALITA=`zenity --list --text="Scegli la qualita'." --radiolist --column=Selez. --column=Livello true medium false standard false extreme false insane || interruzione`;; mpc) QUALITA=`zenity --list --text="Scegli la qualita'." --radiolist --column=Selez. --column=Livello false thumb false radio true standard false xtreme || interruzione`;; ogg) QUALITA=`zenity --list --text="Scegli la qualita'." --radiolist --column=Selez. --column=Livello false " -1" false 0 false 1 false 2 false 3 false 4 false 5 false 6 true 7 false 8 false 9 false 10 || interruzione`;; wav) echo "NESSUNA QUALITA'!";; *) zenity --title=Audioconvert --error --text="Attenzione, non hai selezionato nessun formato di conversione." exit 1 ;; |
aac) QUALITA=`zenity --list --text="Scegli la qualita'." --radiolist --column=Selez. --column=Livello false 100 false 200 true 300 false 400 false 500 || interruzione`;; ape) QUALITA=`zenity --list --text="Scegli la qualita'." --radiolist --column=Selez. --column=Livello false 1000 false 2000 true 3000 false 4000 false 5000 || interruzione`;; flac) QUALITA=`zenity --list --text="Scegli la qualita'." --radiolist --column=Selez. --column=Livello false 0 false 1 false 2 false 3 false 4 false 5 false 6 false 7 true 8 || interruzione`;; mp3) QUALITA=`zenity --list --text="Scegli la qualita'." --radiolist --column=Selez. --column=Livello true medium false standard false extreme false insane || interruzione`;; mpc) QUALITA=`zenity --list --text="Scegli la qualita'." --radiolist --column=Selez. --column=Livello false thumb false radio true standard false xtreme || interruzione`;; ogg) QUALITA=`zenity --list --text="Scegli la qualita'." --radiolist --column=Selez. --column=Livello false " -1" false 0 false 1 false 2 false 3 false 4 false 5 false 6 true 7 false 8 false 9 false 10 || interruzione`;; wav) echo "NESSUNA QUALITA'!";; *) zenity --title=Audioconvert --error --text="Attenzione, non hai selezionato nessun formato di conversione." exit 1 ;; |
| Linea 644: | Linea 652: |
| if [ ! -d "in formato .$FORMATO_CONVERSIONE" ]; then mkdir "in formato .$FORMATO_CONVERSIONE" fi FILE="$1" FORMATO=`echo "$FILE" | awk -F "." '{ print $NF }' | tr "[:upper:]" "[:lower:]"` formati_supportati if [ $SUPPORTO == yes -a ! -d "$FILE" ]; then WAVFILE=$(echo "$FILE" | sed -e s/""$FORMATOFILE""$/wav/) if [ "$FORMATO" != $FORMATO_CONVERSIONE ]; then FILE_CONVERTITO=$(echo "$FILE" | sed -e s/""$FORMATOFILE""$/"$FORMATO_CONVERSIONE"/) if [ "$FORMATO" == mp2 -a ! -e "in formato .$FORMATO_CONVERSIONE/$FILE_CONVERTITO" ]; then mp22mp3 elif ! [ -e "in formato .$FORMATO_CONVERSIONE/$FILE_CONVERTITO" ]; then [ "$FORMATO" != wav ] && "$FORMATO"2wav $SECONDA_CONVERSIONE else echo ""Il file in formato .$FORMATO_CONVERSIONE/$FILE_CONVERTITO" e' gia' esistente." >> /tmp/audioconvert.log fi rm -f "$WAVFILE" 2>> /tmp/audioconvert.log fi else echo "ERRORE!\nIl formato di '$FILE' non è supportato dallo script. :-(" >> /tmp/audioconvert.log fi shift |
if [ ! -d "in formato .$FORMATO_CONVERSIONE" ]; then mkdir "in formato .$FORMATO_CONVERSIONE" fi FILE="$1" FORMATO=`echo "$FILE" | awk -F "." '{ print $NF }' | tr "[:upper:]" "[:lower:]"` formati_supportati if [ $SUPPORTO == yes -a ! -d "$FILE" ]; then WAVFILE=$(echo "$FILE" | sed -e s/""$FORMATOFILE""$/wav/) if [ "$FORMATO" != $FORMATO_CONVERSIONE ]; then FILE_CONVERTITO=$(echo "$FILE" | sed -e s/""$FORMATOFILE""$/"$FORMATO_CONVERSIONE"/) if [ "$FORMATO" == mp2 -a ! -e "in formato .$FORMATO_CONVERSIONE/$FILE_CONVERTITO" ]; then mp22mp3 elif ! [ -e "in formato .$FORMATO_CONVERSIONE/$FILE_CONVERTITO" ]; then [ "$FORMATO" != wav ] && "$FORMATO"2wav $SECONDA_CONVERSIONE else echo ""Il file in formato .$FORMATO_CONVERSIONE/$FILE_CONVERTITO" e' gia' esistente." >> /tmp/audioconvert.log fi rm -f "$WAVFILE" 2>> /tmp/audioconvert.log fi else echo "ERRORE!\nIl formato di '$FILE' non è supportato dallo script. :-(" >> /tmp/audioconvert.log fi shift |
| Linea 681: | Linea 689: |
| echo "Lo script e' terminato!" >> /tmp/audioconvert.log cat /tmp/audioconvert.log | zenity --title="Errore - Audioconvert" --text-info rm -f /tmp/audioconvert.log |
echo "Lo script e' terminato!" >> /tmp/audioconvert.log cat /tmp/audioconvert.log | zenity --title="Errore - Audioconvert" --text-info rm -f /tmp/audioconvert.log |
| Linea 685: | Linea 693: |
| zenity --title=Audioconvert --info --text="Lo script e' terminato!" | zenity --title=Audioconvert --info --text="Lo script e' terminato!" |
| Linea 693: | Linea 701: |
| * [wiki:Ubuntu:NautilusScriptsHowto Documento originale] | * [wiki:Ubuntu/NautilusScriptsHowto Documento originale] |
| Linea 696: | Linea 705: |
| CategoryProgrammazione | CategoryProgrammazione |
IndiceBRTableOfContents |
Nautilus scripting
attachment:Icone/Piccole/nautilus.png
Nautilus permette l'esecuzione di script personalizzati, richiamabili direttamente dalla finestra di navigazione.
Questi script vanno posizionati nella directory ~/.gnome2/nautilus-scripts (identificata anche da /home/<utente>/.gnome2/nautilus-scripts dove «utente» è l'utente desiderato), e resi eseguibili digitando in un terminale il seguente comando:
chmod +x <nome-dello-script>
Una volta fatto questo, ogni script aggiunto sarà disponibile in Nautilus sotto la voce File -> Script, e sarà richiamabile attraverso il clic con il tasto destro.
Molti di questi script coinvolgono i privilegi d'amministrazione, che possono danneggiare seriamente il sistema in uso.
Manda via mail il file selezionato
Questo è veramente utile per cercare un file e inviarlo per email dalla posizione in cui ci si trova:
#!/usr/bin/perl -w
# By John Russell
# This script sends the selected file(s) with your email client.
use strict;
my $MAILTO_URL="mailto:?";
my @files = split("\n", $ENV{NAUTILUS_SCRIPT_SELECTED_FILE_PATHS});
my $count = 0;
foreach my $file (@files)
{
if ( ! -f $file && ! -l $file )
{
my @dialog = ("gdialog","--title","Error","--msgbox", "\nError: Can not send $file. \n\n Only regular files can be mailed. ","200", "300");
system (@dialog);
}
else
{
$MAILTO_URL = $MAILTO_URL . "attach=" . $file . "&";
shift;
$count += 1;
}
}
if ($count > 0)
{
my @command = ("gnome-open", $MAILTO_URL);
system(@command);
}La sintassi mailto: non funziona con mozilla-thunderbird. La seguente versione sembra invece funzionare con Thunderbird: NOTA: Funziona con Mozilla-Thunderbird ma non con Thunderbird2 (non presente nei repositories)
#!/usr/bin/perl -w
# By John Russell
# and hacked to work with thunderbird by Darrell
# This script sends the selected file(s) with mozilla-thunderbird.
use strict;
my $attach_string="\"attachment='";
my @files = split("\n", $ENV{NAUTILUS_SCRIPT_SELECTED_FILE_PATHS});
my $count = 0;
foreach my $file (@files)
{
if ( ! -f $file && ! -l $file )
{
my @dialog = ("gdialog","--title","Error","--msgbox", "\nError: Can not send $file. \n\n Only regular files can be mailed. ","200", "300");
system (@dialog);
}
else
{
$attach_string = $attach_string . "file://" . $file . ",";
shift;
$count += 1;
}
}
if ($count > 0)
{
$attach_string = $attach_string . "'\"";
# replace spaces with '%20' as demanded by mozilla/thunderbird
$attach_string =~ s/\s/%20/g;
# invoke shell script to call thunderbird differently depending on whether it's running already or not
my $command = ("~/scripts/thunderbird-email-attachments " . $attach_string);
system($command);
}Nell'ultime righe dello script precedente viene richiesto il seguente script di shell, (indicato con ~/scripts/thunderbird-email-attachments. Attenzione a non posizionarlo nella directory nautilus-scripts, altrimenti sarebbe visibile nel menù contestuale):
#!/bin/sh
# if thunderbird is already running open a compose window in the running instance
if `ps xc | grep -q mozilla-thunder`; then
exec mozilla-thunderbird -a Mozilla-Thunderbird -remote "xfeDoCommand(ComposeMessage,$1)"
# else start a new instance with the compose window only
else
exec mozilla-thunderbird -compose $1
fi
Montare un'immagine ISO
Montare un'immagine ISO, da Nautilus:
#!/bin/bash
#
#By modprobing loop it makes sure that the module is loaded and ready for
#use. If it is already loaded then nothing will happen.
modprobe loop
for I in `echo $*`
do
foo=`gksudo -u root -k -m "enter your password for root terminal access" /bin/echo "got r00t?"`
sudo mount -o loop -t iso9660 $I /media/iso
done
done
exit0
Smontare un'immagine ISO
Smontare immagine ISO, da nautilus:
#!/bin/bash
#
for I in `echo $*`
do
foo=`gksudo -u root -k -m "inserire la tua password di root" /bin/echo "got r00t?"`
sudo umount $I
done
done
exit0
Impostare la sola lettura sui file
Cambiare i permessi dei file in sola lettura:
#!/bin/bash
chmod ugo=r $*
Editare file con gedit usando i privilegi di root
#!/bin/bash
#
for I in `echo $*`
do
foo=`gksudo -u root -k -m "inserei la tua password di root" /bin/echo "got r00t?"`
sudo gedit $I
done
done
exit0
Aprire Nautilus con i privilegi di root
#!/bin/bash
# root-nautilus-here
# opens a root-enabled instance of a nautilus window in selected location
# requires sudo privileges and gksudo, which may involve security risks.
#Install in your ~/Nautilus/scripts directory.
#
# Placed in the public domain by Shane T. Mueller 2001
# Fixes provided by Doug Nordwall
#
# 2004.04.18 -- keith@penguingurus.com - Added gksudo usage to provide popup
# password window if sudo has expired. Line only echos got
# root to std output. But gksudo updates your sudo access
# privs, so running nautilus with sudo will succeed
# without asking for a password.
foo=`gksudo -u root -k -m "enter your password for nautilus root access" /bin/echo "got r00t?"`
sudo nautilus --no-desktop $NAUTILUS_SCRIPT_CURRENT_URI
Avviare file con i privilegi di root
#!/bin/bash
#
for I in `echo $*`
do
/usr/bin/gksudo $I
done
done
exit0
Aprire la finestra di ricerca
#!/bin/sh
# From Johnathan Bailes
# This script opens a gnome-search-tool in the directory you select.
#
# Distributed under the terms of GNU GPL version 2 or later
#
# Install in your ~/Nautilus/scripts directory.
# You need to be running Nautilus 1.0.3+ to use scripts.
cd $NAUTILUS_SCRIPT_CURRENT_URI
exec gnome-search-tool
Aprire il terminale
#!/bin/bash
#
# This script opens a gnome-terminal in the directory you select.
#
# Distributed under the terms of GNU GPL version 2 or later
#
# Install in ~/.gnome2/nautilus-scripts or ~/Nautilus/scripts
# You need to be running Nautilus 1.0.3+ to use scripts.
# When a directory is selected, go there. Otherwise go to current
# directory. If more than one directory is selected, show error.
if [ -n "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" ]; then
set $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS
if [ $# -eq 1 ]; then
destination="$1"
# Go to file's directory if it's a file
if [ ! -d "$destination" ]; then
destination="`dirname "$destination"`"
fi
else
zenity --error --title="Error - Open terminal here" \
--text="You can only select one directory."
exit 1
fi
else
destination="`echo "$NAUTILUS_SCRIPT_CURRENT_URI" | sed 's/^file:\/\///'`"
fi
# It's only possible to go to local directories
if [ -n "`echo "$destination" | grep '^[a-zA-Z0-9]\+:'`" ]; then
zenity --error --title="Error - Open terminal here" \
--text="Only local directories can be used."
exit 1
fi
cd "$destination"
exec x-terminal-emulator
Nascondere o mostrare i file nascosti
#!/bin/sh
# When hidden files (.emacs, etc) are hidden, shows "Show Hidden Files" option.
# When hidden files are shown, shows "Hide Hidden Files" option.
# Uses gconf to toggle between the two Nautilus options.
# Should be placed in ~/.gnome2/nautilus-scripts/ with executable permission.
OLDSTATE=$(gconftool-2 --get "/desktop/gnome/file_views/show_hidden_files")
if [ "$OLDSTATE" == "false" ] ; then
NEWSTATE="True"
mv ~/.gnome2/nautilus-scripts/Show\ Dot\ Files ~/.gnome2/nautilus-scripts/Hide\ Dot\ Files
else
NEWSTATE="False"
mv ~/.gnome2/nautilus-scripts/Hide\ Dot\ Files ~/.gnome2/nautilus-scripts/Show\ Dot\ Files
fi
gconftool-2 --set "/desktop/gnome/file_views/show_hidden_files" --type boolean $NEWSTATEÈ possibile fare lo stesso con la combinazione di tasti CTRL+H su Nautilus.
Ridimensionamento delle immagini
#!/bin/sh
#acquisisce i nomi dei file
files=`echo "$1" | sed 's/ /\\ /g'`
# nome dei file ridotti, in questo caso aggiunge -copia.jpg in fondo
copia=ImmaginiRidotte/${files}-copia.jpg
# crea la sottocartella dove salvare i file ridotti
mkdir ImmaginiRidotte
# chiamata a convert (pacchetto imagemagick)
# 800 è la larghezza dei file finali (vanno modificati tutti e due)
# 75 è la percentuale di compressione. editatele come preferite.
# per mettere nessuna compressione o nessun ridimensionamento semplicemente eliminate il parametro.
convert $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS -resize 800x -resize 'x800>' -quality 75 $copia
Inviare file tramite bluetooth
#!/bin/sh
# Tramite obex invia un file ad un dispositivo bluetooth.
# Ovviamente dovete avere un'adattatore bluetooth collegato al computer.
gnome-obex-send $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS
Convertire file audio
#
# Autore: Maurizio (aka farthest)
# Licenza: GPL 2 or later
#
# Dipendenze:
# zenity
# lame
# mac
# mppdec
# mplayer
# flac
# faad
# oggdec oggenc --> package: vorbis-tools
formati_supportati() {
case $FORMATO in
aac)
SUPPORTO=yes
FORMATOFILE=[Aa][Aa][Cc]
;;
ape)
SUPPORTO=yes
FORMATOFILE=[Aa][Pp][Ee]
;;
flac)
SUPPORTO=yes
FORMATOFILE=[Ff][Ll][Aa][Cc]
;;
mp2)
SUPPORTO=yes
FORMATOFILE=[Mm][Pp]2
;;
mp3)
SUPPORTO=yes
FORMATOFILE=[Mm][Pp]3
;;
mpc)
SUPPORTO=yes
FORMATOFILE=[Mm][Pp][Cc]
;;
ogg)
SUPPORTO=yes
FORMATOFILE=[Oo][Gg][Gg]
;;
wav)
SUPPORTO=yes
FORMATOFILE=[Ww][Aa][Vv]
;;
wave)
FORMATO=wav
SUPPORTO=yes
FORMATOFILE=[Ww][Aa][Vv][Ee]
;;
wma)
SUPPORTO=yes
FORMATOFILE=[Ww][Mm][Aa]
;;
*)
SUPPORTO=no
;;
esac
}
##
2aac() {
faac -q $QUALITA -o "in formato .$FORMATO_CONVERSIONE/$FILE_CONVERTITO" "$WAVFILE" || echo "Errore del comando:faac -q $QUALITA -o 'in formato .$FORMATO_CONVERSIONE/$FILE_CONVERTITO' '$WAVFILE' ." >> /tmp/audioconvert.log
}
2ape() {
mac "$WAVFILE" "in formato .$FORMATO_CONVERSIONE/$FILE_CONVERTITO" -c$QUALITA || echo "Errore del comando: mac '$WAVFILE' 'in formato .$FORMATO_CONVERSIONE/$FILE_CONVERTITO' -c$QUALITA ." >> /tmp/audioconvert.log
}
2flac() {
flac -f --compression-level-$QUALITA "$WAVFILE" -o "in formato .$FORMATO_CONVERSIONE/$FILE_CONVERTITO" || echo "Errore del comando: flac --compression-level-$QUALITA '$WAVFILE' -o 'in formato .$FORMATO_CONVERSIONE/$FILE_CONVERTITO' ." >> /tmp/audioconvert.log
}
2mp3() {
lame -m auto --preset $QUALITA "$WAVFILE" "in formato .$FORMATO_CONVERSIONE/$FILE_CONVERTITO" || echo "Errore del comando: lame -m auto --preset $QUALITA '$WAVFILE' 'in formato .$FORMATO_CONVERSIONE/$FILE_CONVERTITO' ." >> /tmp/audioconvert.log
}
2mpc() {
mppenc --$QUALITA "$WAVFILE" "in formato .$FORMATO_CONVERSIONE/$FILE_CONVERTITO" || echo "Errore del comando: mppenc --$QUALITA '$WAVFILE' 'in formato .$FORMATO_CONVERSIONE/$FILE_CONVERTITO' ." >> /tmp/audioconvert.log
}
2ogg() {
oggenc "$WAVFILE" -q $QUALITA -o "in formato .$FORMATO_CONVERSIONE/$FILE_CONVERTITO" || echo "Errore del comando: oggenc '$WAVFILE' ${OGGTAGS[@]} -q $QUALITA -o 'in formato .$FORMATO_CONVERSIONE/$OGGFILE' ." >> /tmp/audioconvert.log
}
2wav(){
cp "$FILE_CONVERTITO" "in formato .$FORMATO_CONVERSIONE/" 2>> /tmp/audioconvert.log
}
##
wma2wav() {
mplayer "$FILE" -ao pcm:file="$WAVFILE" 2>> /tmp/audioconvert.log
}
mpc2wav() {
mppdec "$FILE" "$WAVFILE" 2>> /tmp/audioconvert.log
}
ape2wav() {
mac "$FILE" "$WAVFILE" -d || echo "Errore del comando: mac '$FILE' '$WAVFILE' -d." >> /tmp/audioconvert.log
}
flac2wav() {
flac -f -d "$FILE" -o "$WAVFILE" || echo "Errore del comando: flac -d '$FILE' -o '$WAVFILE'." >> /tmp/audioconvert.log
}
ogg2wav() {
oggdec "$FILE" -o "$WAVFILE" || echo "Errore del comando: oggdec '$FILE' -o '$WAVFILE'." >> /tmp/audioconvert.log
}
aac2wav() {
faad -o "$WAVFILE" "$FILE" || echo "Errore del comando: faad -o '$WAVFILE' '$FILE'." >> /tmp/audioconvert.log
}
mp32wav() {
lame --decode "$FILE" "$WAVFILE" || echo "Errore del comando: lame --decode '$FILE' '$WAVFILE'." >> /tmp/audioconvert.log
}
mp22mp3(){
lame -m auto --mp2input --preset $QUALITA "$FILE" "in formato .$FORMATO_CONVERSIONE/$FILE_CONVERTITO" || echo "Errore del comando: lame -m auto --mp2input [ "$FORMATO" != wav ]--preset $QUALITA '$FILE' 'in formato .$FORMATO_CONVERSIONE/$FILE_CONVERTITO' ." >> /tmp/audioconver.log
}
interruzione(){
zenity --title=Audioconvert --error --text="Script interrotto."
kill $$
}
## principale
PERCORSO="`echo $NAUTILUS_SCRIPT_CURRENT_URI| sed "s&^file://&&"`"
[ -n "$PERCORSO" ] && cd "$PERCORSO"
if [ $# -eq 0 ]; then
zenity --title=Audioconvert --error --text="Seleziona almeno un file."
exit 1
fi
FORMATO_CONVERSIONE=`zenity --title=Audioconvert --list --text="Scelti il formato di conversione:" --radiolist --column=Selez. --column=Formato false aac false ape false flac false mp3 false mpc false ogg false wav || interruzione`
SECONDA_CONVERSIONE=2$FORMATO_CONVERSIONE
case "$FORMATO_CONVERSIONE" in
aac) QUALITA=`zenity --list --text="Scegli la qualita'." --radiolist --column=Selez. --column=Livello false 100 false 200 true 300 false 400 false 500 || interruzione`;;
ape) QUALITA=`zenity --list --text="Scegli la qualita'." --radiolist --column=Selez. --column=Livello false 1000 false 2000 true 3000 false 4000 false 5000 || interruzione`;;
flac) QUALITA=`zenity --list --text="Scegli la qualita'." --radiolist --column=Selez. --column=Livello false 0 false 1 false 2 false 3 false 4 false 5 false 6 false 7 true 8 || interruzione`;;
mp3) QUALITA=`zenity --list --text="Scegli la qualita'." --radiolist --column=Selez. --column=Livello true medium false standard false extreme false insane || interruzione`;;
mpc) QUALITA=`zenity --list --text="Scegli la qualita'." --radiolist --column=Selez. --column=Livello false thumb false radio true standard false xtreme || interruzione`;;
ogg) QUALITA=`zenity --list --text="Scegli la qualita'." --radiolist --column=Selez. --column=Livello false " -1" false 0 false 1 false 2 false 3 false 4 false 5 false 6 true 7 false 8 false 9 false 10 || interruzione`;;
wav) echo "NESSUNA QUALITA'!";;
*)
zenity --title=Audioconvert --error --text="Attenzione, non hai selezionato nessun formato di conversione."
exit 1
;;
esac
while [ $# -gt 0 ]; do
if [ ! -d "in formato .$FORMATO_CONVERSIONE" ]; then
mkdir "in formato .$FORMATO_CONVERSIONE"
fi
FILE="$1"
FORMATO=`echo "$FILE" | awk -F "." '{ print $NF }' | tr "[:upper:]" "[:lower:]"`
formati_supportati
if [ $SUPPORTO == yes -a ! -d "$FILE" ]; then
WAVFILE=$(echo "$FILE" | sed -e s/""$FORMATOFILE""$/wav/)
if [ "$FORMATO" != $FORMATO_CONVERSIONE ]; then
FILE_CONVERTITO=$(echo "$FILE" | sed -e s/""$FORMATOFILE""$/"$FORMATO_CONVERSIONE"/)
if [ "$FORMATO" == mp2 -a ! -e "in formato .$FORMATO_CONVERSIONE/$FILE_CONVERTITO" ]; then
mp22mp3
elif ! [ -e "in formato .$FORMATO_CONVERSIONE/$FILE_CONVERTITO" ]; then
[ "$FORMATO" != wav ] && "$FORMATO"2wav
$SECONDA_CONVERSIONE
else
echo ""Il file in formato .$FORMATO_CONVERSIONE/$FILE_CONVERTITO" e' gia' esistente." >> /tmp/audioconvert.log
fi
rm -f "$WAVFILE" 2>> /tmp/audioconvert.log
fi
else
echo "ERRORE!\nIl formato di '$FILE' non è supportato dallo script. :-(" >> /tmp/audioconvert.log
fi
shift
done
if [ -s /tmp/audioconvert.log ]; then
echo "Lo script e' terminato!" >> /tmp/audioconvert.log
cat /tmp/audioconvert.log | zenity --title="Errore - Audioconvert" --text-info
rm -f /tmp/audioconvert.log
else
zenity --title=Audioconvert --info --text="Lo script e' terminato!"
fi
exit 0
Ulteriori risorse
- [wiki:Ubuntu/NautilusScriptsHowto Documento originale]
