<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress.com" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>

<channel>
	<title>zenity &amp;laquo; WordPress.com Tag Feed</title>
	<link>http://en.wordpress.com/tag/zenity/</link>
	<description>Feed of posts on WordPress.com tagged "zenity"</description>
	<pubDate>Sun, 29 Nov 2009 11:00:46 +0000</pubDate>

	<generator>http://en.wordpress.com/tags/</generator>
	<language>en</language>

<item>
<title><![CDATA[Proste okna dialogowe do skryptów czyli Zenity.]]></title>
<link>http://middleofdreams.wordpress.com/2009/10/11/proste-okna-dialogowe-do-skryptow-czyli-zenity/</link>
<pubDate>Sun, 11 Oct 2009 21:24:07 +0000</pubDate>
<dc:creator>middleofdreams</dc:creator>
<guid>http://middleofdreams.wordpress.com/2009/10/11/proste-okna-dialogowe-do-skryptow-czyli-zenity/</guid>
<description><![CDATA[Czasami zachodzi potrzeba wyświetlenia informacji z naszego skryptu w formie graficznej. Czy to gdy ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Czasami zachodzi potrzeba wyświetlenia informacji z naszego skryptu w formie graficznej. Czy to gdy piszemy skrypt dla kogoś, kto niezbyt jest zaznajomiony z konsolą albo po prostu ma to ładnie wyglądać. Z pomocą przychodzi Zenity. Jest to zestaw różnych okien dialogowych, które w połączeniu z paroma parametrami zastępują konieczność pisania całej aplikacji z użyciem biblioteki np gtk.</p>
<p>Sposób użycia:</p>
<p>Najprostsze czyli okienka informacyjne:</p>
<blockquote><p>zenity &#8211;error/info &#8211;text=&#8221;To jest okienko błędu/informacyjne&#8221;</p></blockquote>
<p>Jeśli natomiast chcemy by w okienku dało się coś wpisywać, należy skorzystać z opcji entry:</p>
<blockquote><p>zenity &#8211;entry &#8211;text=&#8221;Wpisz swoje imie&#8221;</p></blockquote>
<p>Jednak w taki sposób nie uzyskamy żadnej wartości zwrotnej (wpisanej przez użytkownika). Aby ją uzyskać można albo przypisać polecenie zenity do zmiennej (pamietajac o używaniu znaków ` ` ) albo w taki oto sposób:</p>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:161px;width:1px;height:1px;">zenity &#8211;info &#8211;text=&#8221;Witaj &#8220;`zenity &#8211;entry &#8211;text=&#8221;Podaj imię&#8221;`</div>
<blockquote><p>zenity &#8211;info &#8211;text=&#8221;Witaj &#8220;`zenity &#8211;entry &#8211;text=&#8221;Podaj imię&#8221;`</p></blockquote>
<div>Polecam przeczytać helpa aby odkryć więcej opcji tego małego, ale jakże przydatnego programu. Na koniec zamieszczam mój mały skrypt diagnozujący działanie sieci.</div>
<blockquote>
<div><a href="http://wklej.org/id/172247/">http://wklej.org/id/172247/</a></div>
</blockquote>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Buscador para Thunar usando Zenity]]></title>
<link>http://xfceando.wordpress.com/2009/08/28/buscador-para-thunar-usando-zenity/</link>
<pubDate>Fri, 28 Aug 2009 20:23:44 +0000</pubDate>
<dc:creator>elavdeveloper</dc:creator>
<guid>http://xfceando.wordpress.com/2009/08/28/buscador-para-thunar-usando-zenity/</guid>
<description><![CDATA[Este sencillo tutorial lo he encontrado en el blog de Xubuntu y lo traduzco para ustedes. La idea es]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Este sencillo tutorial lo he encontrado en el blog de <a href="http://xubuntu.wordpress.com/2006/07/12/how-to-search-for-files-with-thunar/" target="_blank">Xubuntu</a> y lo traduzco para ustedes. La idea es que cuando estemos en un directorio dentro de Thunar, en el menú desplegable al hacer clic derecho, aparezca la opción de buscar archivos o carpetas como se muestra en la imagen posterior:<br />
<img style="max-width:800px;" src="http://xfceando.files.wordpress.com/2009/08/menu.png" alt="" /><br />
Para lograr esto lo primero que tenemos que hacer es instalar zenity:</p>
<blockquote><p><strong>$ sudo aptitude install zenity</strong></p></blockquote>
<p>Luego abrimos la consola y ponemos:</p>
<blockquote><p><strong>$ mkdir ~/.bash-scripts/</strong></p></blockquote>
<p>para crear un directorio que contendrá el script que ejecutará la acción en si. Ahora creamos un fichero llamado <strong>search-for-files</strong> adentro de la siguiente forma:</p>
<blockquote><p><strong>mousepad ~/.bash-scripts/search-for-files</strong></p></blockquote>
<p>y le pegamos esto adentro:</p>
<blockquote><p><strong>#!/bin/bash</strong><br />
<strong>#search-for-files</strong></p>
<p><strong># change this figure to suit yourself &#8211; I find zenity dies from about 1000 results but YMMV</strong><br />
<strong>maxresults=500</strong></p>
<p><strong># again, change the path to the icon to suit yourself. But who doesn&#8217;t like tango?</strong><br />
<strong>window_icon=&#8221;/usr/share/icons/Tango/scalable/actions/search.svg&#8221;</strong></p>
<p><strong># this script will work for any environment that has bash and zenity, so the filemanager is entirely down to you! you can add extra arguments to the string as long as the last argument is the path of the folder you open</strong><br />
<strong>filemanager=&#8221;thunar&#8221;</strong></p>
<p><strong>window_title=&#8221;Search for Files&#8221;</strong></p>
<p><strong>srcPath=&#8221;$*&#8221;</strong></p>
<p><strong>if ! [ -d "$srcPath" ] ; then</strong><br />
<strong>cd ~/</strong><br />
<strong>srcPath=`zenity &#8211;file-selection &#8211;directory &#8211;title=&#8221;$window_title &#8211; Look in folder&#8221; &#8211;window-icon=&#8221;$window_icon&#8221;`</strong><br />
<strong>fi</strong></p>
<p><strong>if [ -d "$srcPath" ] ; then</strong></p>
<p><strong>fragment=`zenity &#8211;entry &#8211;title=&#8221;$window_title &#8211; Name contains:&#8221; &#8211;window-icon=&#8221;$window_icon&#8221; &#8211;text=&#8221;Search strings less than 2 characters are ignored&#8221;`</strong><br />
<strong>if ! [ ${#fragment} -lt 2 ] ; then</strong></p>
<p><strong>(</strong></p>
<p><strong>echo 10</strong><br />
<strong>O=$IFS IFS=$&#8217;\n&#8217; files=( `find &#8220;$srcPath&#8221; -iname &#8220;*$fragment*&#8221; -printf \&#8221;%Y\&#8221;\ \&#8221;%f\&#8221;\ \&#8221;%k\ KB\&#8221;\ \&#8221;%t\&#8221;\ \&#8221;%h\&#8221;\\\n &#124; head -n $maxresults` ) IFS=$O</strong><br />
<strong>echo 100</strong></p>
<p><strong>selected=`eval zenity &#8211;list &#8211;title=\&#8221;${#files[@]} Files Found &#8211; $window_title\&#8221; &#8211;window-icon=&#8221;$window_icon&#8221; &#8211;width=&#8221;600&#8243; &#8211;height=&#8221;400&#8243; &#8211;text=\&#8221;Search results:\&#8221; &#8211;print-column=5 &#8211;column \&#8221;Type\&#8221; &#8211;column \&#8221;Name\&#8221; &#8211;column \&#8221;Size\&#8221; &#8211;column \&#8221;Date modified\&#8221; &#8211;column \&#8221;Path\&#8221; ${files[@]}`</strong><br />
<strong>if [ -e "$selected" ] ; then &#8220;$filemanager&#8221; &#8220;$selected&#8221; ; fi</strong></p>
<p><strong>) &#124; zenity &#8211;progress &#8211;auto-close &#8211;pulsate &#8211;title=&#8221;Searching&#8230;&#8221; &#8211;window-icon=&#8221;$window_icon&#8221; &#8211;text=&#8221;Searching for \&#8221;$fragment\&#8221;"</strong></p>
<p><strong>fi</strong></p>
<p><strong>fi</strong></p>
<p><strong>exit</strong></p></blockquote>
<p>y le damos permisos de ejecución:</p>
<blockquote><p><strong>chmod a+x ~/.bash-scripts/search-for-files</strong></p></blockquote>
<p>Ahora haces un backup del fichero <strong>uca.xml</strong>:</p>
<blockquote><p><strong>$ sudo cp /etc/xdg/Thunar/uca.xml /etc/xdg/Thunar/uca.xml.old</strong></p></blockquote>
<p>al que le pondremos al final esto:</p>
<blockquote><p><strong>&#60;action&#62;</strong><br />
<strong>&#60;icon&#62;/usr/share/icons/Tango/scalable/actions/search.svg&#60;/icon&#62;</strong><br />
<strong>&#60;name&#62;Search for Files&#60;/name&#62;</strong><br />
<strong>&#60;command&#62;bash ~/.bash-scripts/search-for-files %f&#60;/command&#62;</strong><br />
<strong>&#60;description&#62;Search this folder for files&#60;/description&#62;</strong><br />
<strong>&#60;patterns&#62;*&#60;/patterns&#62;</strong><br />
<strong>&#60;directories/&#62;</strong><br />
<strong>&#60;/action&#62;</strong></p></blockquote>
<p>Ahora lo que nos queda es abrir Thunar » Editar » Configurar acciones personalizadas y creamos una nueva. Y llenamos los siguientes campos:<br />
En la pestaña Básico:</p>
<blockquote><p><strong>Nombre</strong>: Buscador<br />
<strong>Descripción</strong>: Buscador de archivos/carpetas<br />
<strong>Comando</strong>: bash ~/.bash-scripts/search-for-files %f<br />
<strong>Icono</strong>: Seleccionamos el que más nos guste.</p></blockquote>
<p>Ahora en la pestaña Condiciones de apariencia lo siguientes campos:</p>
<blockquote><p><strong>Patrón de archivo</strong>: *<br />
<strong>Aparece si la selección contiene</strong>: Directorio.</p></blockquote>
<p>Y listo!!!</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Импорт фотографий из цифровых камер с использованием gphoto2 посредством PTP и /bin/bash]]></title>
<link>http://sudormrf.wordpress.com/2009/07/31/%d0%b8%d0%bc%d0%bf%d0%be%d1%80%d1%82-%d1%84%d0%be%d1%82%d0%be%d0%b3%d1%80%d0%b0%d1%84%d0%b8%d0%b9-%d0%b8%d0%b7-%d1%86%d0%b8%d1%84%d1%80%d0%be%d0%b2%d1%8b%d1%85-%d0%ba%d0%b0%d0%bc%d0%b5%d1%80/</link>
<pubDate>Fri, 31 Jul 2009 17:38:24 +0000</pubDate>
<dc:creator>init_6</dc:creator>
<guid>http://sudormrf.wordpress.com/2009/07/31/%d0%b8%d0%bc%d0%bf%d0%be%d1%80%d1%82-%d1%84%d0%be%d1%82%d0%be%d0%b3%d1%80%d0%b0%d1%84%d0%b8%d0%b9-%d0%b8%d0%b7-%d1%86%d0%b8%d1%84%d1%80%d0%be%d0%b2%d1%8b%d1%85-%d0%ba%d0%b0%d0%bc%d0%b5%d1%80/</guid>
<description><![CDATA[Набрел я как то на французском форуме убунту на очень интересную ветку Script bash &#8211; Importer ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Набрел я как то на французском форуме <a href="http://ubuntu.com/">убунту</a> на очень интересную ветку <a href="http://forum.ubuntu-fr.org/viewtopic.php?id=146629&#38;p=1">Script bash &#8211; Importer automatiquement les photos d&#8217;un appareil</a> </p>
<p>Собственно сама идея меня захватила тем более что <a href="http://www.gphoto.org/">media-libs/libgphoto2</a> и <a href="http://www.gphoto.org/">media-gfx/gphoto2</a> в сумме все равно меньше чем к примеру <a href="http://f-spot.org">media-gfx/f-spot</a> которому еще и нужен <a href="http://www.go-mono.com">dev-lang/mono</a></p>
<p><!--more--></p>
<p>Итак для начала я просто локализовал то что было сделано до меня <a href="http://forum.ubuntu-fr.org/viewtopic.php?id=146629&#38;p=1">французами</a></p>
<pre class="brush: bash;">#!/bin/bash
#Licence GPL
#Version 2 : Refonte du programme, ajout de la creation de catalogue
#
#
#Version 1 : Importe des photos via PTP ou un repertoire quelconque (dont appareil monté en USB mass-storage),
#            renomme les photos selon les exifs, avec choix de methode de renommage,
#            pivote les photos selon les exifs (avec jpegtran)
#            trie les photos selon la date des exifs avec choix de l'arborescence de tri,
#            modifie le LensType des .CR2 (Utile pour un canon 350D pour retoucher la photo avec DPP (wine) (correction de l'objectif accessible))
#
#Necessite : exiftool, zenity, gphoto2, jpegtran
#
# aide de zenity : yelp file:///usr/share/gnome/help/zenity/fr/zenity.xml
#

###########
#IMPORTANT#
###########
#choses à modifier selon l'appareil : - les champs exifs dependent de l'appareil photo. il est preferable de les verifier, particulierement le champ de modele de l'appareil (selon ce que vous voulez que ca affiche. Pour moi, ca affiche &#34;350D&#34; alors que le champ complet est &#34;Canon EOS 350D DIGITAL&#34;).
#                                     - la fonction de changement de lenstype n'est pas utile a tous le monde...

#############
##Fonctions##
#############

####Pivoter selon exifs
function pivot {
orient=&#34;$(exiftool -orientation $i &#124; cut -d &#34; &#34; -f24)&#34;
if [ &#34;$orient&#34; = &#34;90&#34; ]; then
 jpegtran -rotate 90 -copy all $i &#38;gt; tmp
 mv tmp $i
 exiftool -orientation=&#34;Horizontal (normal)&#34; -overwrite_original $i
elif [ &#34;$orient&#34; = &#34;270&#34; ]; then
 jpegtran -rotate 270 -copy all $i &#38;gt; tmp
 mv tmp $i
 exiftool -orientation=&#34;Horizontal (normal)&#34; -overwrite_original $i
fi
}

####Modifier le LensType
function LType {
lens=$(exiftool -Lens $i)
if [ &#34;$(echo $lens &#124; cut -d &#34; &#34; -f3-5)&#34; = &#34;18.0 - 55.0mm&#34; ]; then
 exiftool -LensType=&#34;Canon EF-S 18-55mm f/3.5-5.6&#34; $i
elif [ &#34;$(echo $lens &#124; cut -d &#34; &#34; -f3)&#34; = &#34;200.0mm&#34; ]; then
 exiftool -LensType=&#34;Canon EF 200mm f/2.8L II&#34; $i
elif [ &#34;$(echo $lens &#124; cut -d &#34; &#34; -f3)&#34; = &#34;50.0mm&#34; ]; then
 exiftool -LensType=&#34;Canon EF 50mm f/1.8&#34; $i
fi
}

####Sortie volontaire par le bouton annuler
function sortie {
zenity --warning --text=&#34;Не указан каталог \nДальнейшая работа сценария невозможна.&#34;
exit
}

######################
##Début du Programme##
######################

#detection de l'appareil photo : gphoto2 =&#38;gt; si il y a quelque chose, proposer de prendre l'appareil photo detecte et alors -&#38;gt; action.
if [ &#34;$(gphoto2 --auto-detect &#124; wc -l)&#34; -ge 3 ]; then
 apn=&#34;$(gphoto2 --auto-detect)&#34;
 zenity --question --text=&#34;Камера обнаружена ? \n\n$apn&#34; --title=&#34;Автоматическое обнаружение&#34;
 okgphoto=$?
else
 okgphoto=1
fi

#Si pas d'appareil detecté ou annulation, choisir un repertoire avec zenity --file-selection --directory contenant des photos (ou alors selectionner les photos), puis action
if [ &#34;$okgphoto&#34; = &#34;1&#34; ]; then
 rep=$(zenity --file-selection --directory --title=&#34;Выбор каталога для импорта&#34;)
 if [ &#34;$rep&#34; = &#34;&#34; ]; then
  sortie
 fi
fi

#choix des actions a effectuer
action=$(zenity --list --checklist\
         --width=390 --height=290\
         --title=&#34;Что делать?&#34;\
         --text=&#34;Выберите действия для выполнения либо нажмите отменить&#34;\
         --column=&#34; &#34; --column=&#34;Описание&#34;\
         TRUE    &#34;Импорт фотографий&#34;\
         FALSE    &#34;Удаление файлов на устройстве&#34;\
         FALSE    &#34;Переименование фотографий&#34;\
         TRUE    &#34;Организовать фотографии&#34;\
         TRUE    &#34;Поворот jpeg согласно exifs&#34;\
         FALSE    &#34;Создать файл каталога&#34;\
         TRUE    &#34;Установите тип цели в EXIFS из .cr2&#34;)
import=$(echo &#34;$action&#34; &#124; grep &#34;Импорт фотографий&#34;)
if [ &#34;$action&#34; = &#34;&#34; ]; then
 sortie
elif [ &#34;$import&#34; = &#34;&#34; ]; then
 zenity --warning --text=&#34;Нечего делать, \nДальнейшая работа сценария невозможна.&#34;
 exit
fi
#choix du repertoire de base
repbase=$(zenity --file-selection --directory --title=&#34;Выбор целевого каталога&#34; --text=&#34;Выбрать базовый каталог, куда фотографии будут скопированы :&#34;)
if [ &#34;$repbase&#34; = &#34;&#34; ]; then
  sortie
fi

#import des photos dans le repertoire de base
cd $repbase
supprime=$(echo &#34;$action&#34; &#124; grep &#34;Удаление файлов на устройстве&#34;)
if [ &#34;$supprime&#34; = &#34;&#34; ]; then
 if [ &#34;$okgphoto&#34; = &#34;1&#34; ]; then  #pas PTP
  cp -v &#34;$rep&#34;/*.jpg &#34;$rep&#34;/*.JPG &#34;$rep&#34;/*.cr2 &#34;$rep&#34;/*.CR2 . &#124; zenity --progress --text=&#34;Пожалуйста, подождите\nИмпорт текущих фото...&#34; --pulsate --auto-close
 else #PTP
  gphoto2 --get-all-files &#124; zenity --progress --text=&#34;Пожалуйста, подождите\nИмпорт текущих фото...&#34; --pulsate --auto-close
 fi
else
 if [ &#34;$okgphoto&#34; = &#34;1&#34; ]; then  #pas PTP
  mv -v &#34;$rep&#34;/*.jpg &#34;$rep&#34;/*.JPG &#34;$rep&#34;/*.cr2 &#34;$rep&#34;/*.CR2 . &#124; zenity --progress --text=&#34;Пожалуйста, подождите\nПеремещение фотографий...&#34; --pulsate --auto-close
 else #PTP
  gphoto2 --get-all-files &#124; zenity --progress --text=&#34;Пожалуйста, подождите\nИмпорт текущих фото...&#34; --pulsate --auto-close
  gphoto2 --delete-all-files --recurse &#124; zenity --progress --text=&#34;Пожалуйста, подождите\nУдаление текущей фотографии...&#34; --pulsate --auto-close
 fi
fi
if [ &#34;$?&#34; != &#34;0&#34; ]; then
 zenity --error --text=&#34;Произошла ошибка при импорте камеры.\nОстановить сценарий.&#34; --title=&#34;Ошибка&#34;
 exit
fi

###########################
##Préparation des actions##
###########################

#Modifier le LensType
modifltype=$(echo &#34;$action&#34; &#124; grep &#34;Установите тип цели в EXIFS из .cr2&#34;)

#Renommage
renommer=$(echo &#34;$action&#34; &#124; grep &#34;Переименование фотографий&#34;)
if [ &#34;$renommer&#34; != &#34;&#34; ]; then
 zenity --info --text=&#34;В следующем окне выберите как переименовать фотографии. Эти данные (год, месяц, день, ...), взяты из информации exifs каждой фотографии.\n\nВарианты :\n%a : Аббревиатура дней (например Пн)\n%A : День (например Понедельник)\n%b : Абберевиатура месяца (например Ян)\n%B : Месяц\n%d : День месяца (например 01)\n%H : Часы\n%M : Минуты\n%m : Месяц по счету\n%y : Последние две цифры года (например 90)'\n%Y : Год (например 2600)\n%P : Модель камеры \n\nНапример : %P-%H-%M для имен типа : Модель-Часы-Минуты&#34;
 renom=$(zenity --entry \
         --title=&#34;Классификация&#34; \
         --text=&#34;Укажите как переименовывать фотографии (например %P-%H-%M) :&#34;\
         --entry-text &#34;%P-%H-%M&#34;)
fi

#Pivoter
pivoter=$(echo &#34;$action&#34; &#124; grep &#34;Поворот jpeg согласно exifs&#34;)

#Tri
classer=$(echo &#34;$action&#34; &#124; grep &#34;Организовать фотографии&#34;)
if [ &#34;$classer&#34; != &#34;&#34; ]; then
 zenity --info --text=&#34;В следующем окне выберите как классифицировать каталог. Эти данные (год, месяц, день, ...), взяты из информации exifs каждой фотографии.\n\nВарианты :\n%a : Аббревиатура дней (например Пн)\n%A : День (например Понедельник)\n%b : Абберевиатура месяца (например Ян)\n%B : Месяц\n%d : День месяца (например 01)\n%H : Часы\n%M : Минуты\n%m : Месяц по счету\n%y : Последние две цифры года (например 90)'\n%Y : Год (например 2600)\n%P : Модель камеры \n\nНапример : %Y/%B/%d/ для имен типа : путь/к/базе/год/месяц/день/&#34;
 Class=$(zenity --entry \
         --title=&#34;Классификация&#34; \
         --text=&#34;Укажите как организовать базу (например %Y/%B/%d/) :&#34;\
         --entry-text &#34;%Y/%B/%d/&#34;)
fi

#Catalogue
cata=$(echo &#34;$action&#34; &#124; grep &#34;Создать файл каталога&#34;)
if [ &#34;$cata&#34; != &#34;&#34; ]; then
 cat=$(zenity --entry \
       --title=&#34;Каталог&#34; \
       --text=&#34;Введите имя каталога :&#34;)
 repcat=&#34;&#34;$repbase&#34;/&#34;$cat&#34;&#34;
 imagescat=$(zenity --file-selection --multiple --title=&#34;Выбор картинок для каталога&#34; --text=&#34;Выберите изображения, которые будут находиться в каталоге :&#34;)
 if test ! -e &#34;$repcat&#34;; then
  mkdir -p &#34;$repcat&#34;
 fi
else
 imagescat=&#34;&#34;
fi

#Nombre d'images
njpg=$(ls *.jpg *.JPG &#124; wc -w)
ncr2=$(ls *.CR2 *.cr2 &#124; wc -w)

###########################
####Programme par image####
###########################

ajpg=0
for i in *.jpg *.JPG; do
#variables contenant les differents exifs
 exiftime=$(exiftool -CreateDate -d &#34;%a %A %b %B %d %H %m %y %Y %M&#34; $i)
 a=&#34;$(echo $exiftime &#124; cut -d &#34; &#34; -f4)&#34;
 A=&#34;$(echo $exiftime &#124; cut -d &#34; &#34; -f5)&#34;
 b=&#34;$(echo $exiftime &#124; cut -d &#34; &#34; -f6)&#34;
 B=&#34;$(echo $exiftime &#124; cut -d &#34; &#34; -f7)&#34;
 d=&#34;$(echo $exiftime &#124; cut -d &#34; &#34; -f8)&#34;
 H=&#34;$(echo $exiftime &#124; cut -d &#34; &#34; -f9)&#34;
 m=&#34;$(echo $exiftime &#124; cut -d &#34; &#34; -f10)&#34;
 y=&#34;$(echo $exiftime &#124; cut -d &#34; &#34; -f11)&#34;
 Y=&#34;$(echo $exiftime &#124; cut -d &#34; &#34; -f12)&#34;
 M=&#34;$(echo $exiftime &#124; cut -d &#34; &#34; -f13)&#34;
 P=&#34;$( exiftool -Model $i &#124; cut -d &#34; &#34; -f21)&#34;
#renommage
 if [ &#34;$renommer&#34; != &#34;&#34; ]; then
  nom=$(echo &#34;$renom&#34; &#124; sed s/&#34;%a&#34;/&#34;$a&#34;/ &#124; sed s/&#34;%A&#34;/&#34;$A&#34;/ &#124; sed s/&#34;%b&#34;/&#34;$b&#34;/ &#124; sed s/&#34;%B&#34;/&#34;$B&#34;/ &#124; sed s/&#34;%d&#34;/&#34;$d&#34;/ &#124; sed s/&#34;%H&#34;/&#34;$H&#34;/ &#124; sed s/&#34;%m&#34;/&#34;$m&#34;/ &#124; sed s/&#34;%y&#34;/&#34;$y&#34;/ &#124; sed s/&#34;%Y&#34;/&#34;$Y&#34;/ &#124; sed s/&#34;%M&#34;/&#34;$M&#34;/ &#124; sed s/&#34;%P&#34;/&#34;$P&#34;/)-$(echo &#34;$i&#34; &#124; cut -d &#34;_&#34; -f2)
  mv $i $nom
  i=&#34;$nom&#34;
 fi
#pivotage
 if [ &#34;$pivoter&#34; != &#34;&#34; ]; then
  pivot $i;
 fi
#classer
 if [ &#34;$classer&#34; != &#34;&#34; ]; then
  reptri=&#34;$repbase&#34;/$(echo &#34;$Class&#34; &#124; sed s/&#34;%a&#34;/&#34;$a&#34;/ &#124; sed s/&#34;%A&#34;/&#34;$A&#34;/ &#124; sed s/&#34;%b&#34;/&#34;$b&#34;/ &#124; sed s/&#34;%B&#34;/&#34;$B&#34;/ &#124; sed s/&#34;%d&#34;/&#34;$d&#34;/ &#124; sed s/&#34;%H&#34;/&#34;$H&#34;/ &#124; sed s/&#34;%m&#34;/&#34;$m&#34;/ &#124; sed s/&#34;%y&#34;/&#34;$y&#34;/ &#124; sed s/&#34;%Y&#34;/&#34;$Y&#34;/ &#124; sed s/&#34;%P&#34;/&#34;$P&#34;/)
  if test ! -e $reptri; then
   mkdir -p $reptri
  fi
  mv $i $reptri
 else reptri=&#34;$repbase&#34;
 fi
#cataloguer
 if [ &#34;$(echo $imagescat &#124; grep &#34;$i&#34;)&#34; != &#34;&#34; ]; then
  ln -s &#34;$reptri&#34;&#34;$i&#34; &#34;$repcat&#34;/
 fi
ajpg=$[$ajpg + 1]
echo $[100*$ajpg/$njpg]
done &#124; zenity --progress --text=&#34;Пожалуйста, подождите\nВыполнение действий над jpeg...&#34; --auto-close

acr2=0
for i in *.cr2 *.CR2; do
#variables contenant les exifs
 exiftime=$(exiftool -CreateDate -d &#34;%a %A %b %B %d %H %m %y %Y %M&#34; $i)
 a=&#34;$(echo $exiftime &#124; cut -d &#34; &#34; -f4)&#34;
 A=&#34;$(echo $exiftime &#124; cut -d &#34; &#34; -f5)&#34;
 b=&#34;$(echo $exiftime &#124; cut -d &#34; &#34; -f6)&#34;
 B=&#34;$(echo $exiftime &#124; cut -d &#34; &#34; -f7)&#34;
 d=&#34;$(echo $exiftime &#124; cut -d &#34; &#34; -f8)&#34;
 H=&#34;$(echo $exiftime &#124; cut -d &#34; &#34; -f9)&#34;
 m=&#34;$(echo $exiftime &#124; cut -d &#34; &#34; -f10)&#34;
 y=&#34;$(echo $exiftime &#124; cut -d &#34; &#34; -f11)&#34;
 Y=&#34;$(echo $exiftime &#124; cut -d &#34; &#34; -f12)&#34;
 M=&#34;$(echo $exiftime &#124; cut -d &#34; &#34; -f13)&#34;
 P=&#34;$( exiftool -Model $i &#124; cut -d &#34; &#34; -f21)&#34;
#modifier le lenstype
 if [ &#34;$modifltype&#34; != &#34;&#34; ]; then
  LType $i;
 fi
#renommage
 if [ &#34;$renommer&#34; != &#34;&#34; ]; then
  nom=$(echo &#34;$renom&#34; &#124; sed s/&#34;%a&#34;/&#34;$a&#34;/ &#124; sed s/&#34;%A&#34;/&#34;$A&#34;/ &#124; sed s/&#34;%b&#34;/&#34;$b&#34;/ &#124; sed s/&#34;%B&#34;/&#34;$B&#34;/ &#124; sed s/&#34;%d&#34;/&#34;$d&#34;/ &#124; sed s/&#34;%H&#34;/&#34;$H&#34;/ &#124; sed s/&#34;%m&#34;/&#34;$m&#34;/ &#124; sed s/&#34;%y&#34;/&#34;$y&#34;/ &#124; sed s/&#34;%Y&#34;/&#34;$Y&#34;/ &#124; sed s/&#34;%M&#34;/&#34;$M&#34;/ &#124; sed s/&#34;%P&#34;/&#34;$P&#34;/)-$(echo &#34;$i&#34; &#124; cut -d &#34;_&#34; -f2)
  mv $i $nom
  i=&#34;$nom&#34;
 fi
#classer
 if [ &#34;$classer&#34; != &#34;&#34; ]; then
reptri=&#34;$repbase&#34;/$(echo &#34;$Class&#34; &#124; sed s/&#34;%a&#34;/&#34;$a&#34;/ &#124; sed s/&#34;%A&#34;/&#34;$A&#34;/ &#124; sed s/&#34;%b&#34;/&#34;$b&#34;/ &#124; sed s/&#34;%B&#34;/&#34;$B&#34;/ &#124; sed s/&#34;%d&#34;/&#34;$d&#34;/ &#124; sed s/&#34;%H&#34;/&#34;$H&#34;/ &#124; sed s/&#34;%m&#34;/&#34;$m&#34;/ &#124; sed s/&#34;%y&#34;/&#34;$y&#34;/ &#124; sed s/&#34;%Y&#34;/&#34;$Y&#34;/ &#124; sed s/&#34;%P&#34;/&#34;$P&#34;/)
 if test ! -e $reptri; then
  mkdir -p $reptri
 fi
 mv $i $reptri
 else reptri=&#34;$repbase&#34;
 fi
#cataloguer
 if [ &#34;$(echo $imagescat &#124; grep &#34;$i&#34;)&#34; != &#34;&#34; ]; then
  ln -s &#34;$reptri&#34;&#34;$i&#34; &#34;$repcat&#34;/
 fi
acr2=$[$acr2 + 1]
echo $[100*$acr2/$ncr2]
done &#124; zenity --progress --text=&#34;Пожалуйста, подождите\nВыполнение действий над cr2...&#34; --auto-close

#Fin du programme
zenity --info --text=&#34;Импорт окончен !&#34;
exit</pre>
<p>Однако многое лично меня смутило&#8230; Для начала я хотел чтобы все zenity отображающие процессы показывали не бездумно
<pre>zenity --progress --auto-close --pulsate</pre>
<p> а реально отображали бы состояние процесса.<br />
Ну и опять же даже не сильно вникая можно очень многое сделать гораздо проще.<br />
В общем немного подаставав обитателей канала <strong>#linux</strong> сети <a href="http://www.rus-net.org/">RusNet IRC Network</a> а главное получив неоценимую помощь и подсказки от <a href="http://www.linux.org.ru/whois.jsp?nick=ramok">ramok</a> в конце концов дошел вот до такого. </p>
<pre class="brush: bash;">#!/bin/bash

#import-photos

#################################################################################
#Copyright (C) 2007 Free Software Foundation.

#This program is free software; you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation; either version 2 of the License, or
#(at your option) any later version.

#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#GNU General Public License for more details.

#You should have received a copy of the GNU General Public License
#along with this program; if not, write to the Free Software
#Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

##################################################################################

################################################
#Purpose: Automate import photos from digital camera using gphoto2 through PTP and /bin/bash
#Based on http://forum.ubuntu-fr.org/viewtopic.php?id=146629&#38;amp;p=1
#Date: Пятница, 31 Июль 2009
#Authors: init_6, ramok
#Improvements, Feedback, comments: Please go to http://sudormrf.wordpress.com/2009/07/31/импорт-фотографий-из-цифровых-камер/
#Notes: To use script first install media-gfx/gphoto2, media-libs/exiftool
#Version: 1.?
################################################

#ВАЖНО! - ДЕЛИТЕСЬ УСОВЕРШЕНСТВОВАНИЯМИ СКРИПТА С ОБЩЕСТВЕННОСТЬЮ

function config {
    cd `dirname $0`;

    rep=$HOME&#34;/Photos&#34;;

    if [ &#34;$(gphoto2 --auto-detect &#124; wc -l)&#34; -ge 3 ]; then
        zenity --question --text=&#34;Камера обнаружена ? \n\n$(gphoto2 --auto-detect)&#34; --title=&#34;Автоматическое обнаружение&#34;;
        ok_gphoto=$?;
    else
        ok_gphoto=1;
    fi
}

function num_files {
    if [ ${ok_gphoto} = 0 ]; then
        num_files=$(gphoto2 --list-files &#124; grep -ve '^There' &#124; wc -l);
    fi
}

function copy_pictures {
    if [ ${ok_gphoto} = 0 ]; then
        (for ((file=1;file/dev/null; echo $(($file*100/$num_files)); done) &#124; zenity --progress --auto-close --text=&#34;Пожалуйста подождите,\nИмпорт текущих фото...&#34;;
        if [ $? != 0 ]; then
            zenity --error --text=&#34;Ошибка импорта фотографий&#34;;
            cancel;
        fi
    fi
}

function delete_pictures {
    if [ ${ok_gphoto} = 0 ]; then
        (for ((file=1;file/dev/null; echo $(($file*100/$num_files)); done) &#124; zenity --progress --auto-close --text=&#34;Пожалуйста подождите,\nУдаление фотографий...&#34;;
        if [ $? != 0 ]; then
            zenity --error --text=&#34;Ошибка удаления фотографий&#34;;
            cancel;
        fi
    fi
}

function move_pictures {
    copy_pictures;
    delete_pictures;
}

function extract {
    if [ ${num_files} = 0 ]; then
        zenity --error --text=&#34;Нет фотографий&#34; --title=&#34;Ошибка&#34;;
        cancel;
    fi

    cd &#34;$rep&#34;;

    echo &#34;$ACTION&#34; &#124; grep &#34;Сохранить файлы на устройстве&#34; &#38;gt;/dev/null;
    if [ &#34;$?&#34; = 0 ]; then
        copy_pictures;
    else
        move_pictures;
    fi
    if [ &#34;${PIPESTATUS[0]}&#34; != 0 ]; then
        zenity --error --text=&#34;Произошла ошибка при импорте камеры&#34; --title=&#34;Ошибка&#34;;
        cancel;
    fi

    zenity --info --text=&#34;В следующем окне выберите как классифицировать каталог. Эти данные (год, месяц, день, ...), взяты из информации exifs каждой фотографии.\n\nВарианты :\n%a : Аббревиатура дней (например Пн)\n%A : День (например Понедельник)\n%b : Абберевиатура месяца (например Ян)\n%B : Месяц\n%d : День месяца (например 01)\n%H : Часы\n%M : Минуты\n%m : Месяц по счету\n%y : Последние две цифры года (например 90)'\n%Y : Год (например 2600)\n%P : Модель камеры \n\nНапример : %Y/%B/%d/ для имен типа : путь/к/базе/год/месяц/день/&#34;
    Class=$(zenity --entry \
         --title=&#34;Классификация&#34; \
         --text=&#34;Укажите как организовать базу (например %Y/%B/%d/) :&#34;\
         --entry-text &#34;%Y/%B/%d/&#34;)

    ajpg=0
    for i in *.jpg *.JPG; do
        eval $(exiftool -CreateDate -d &#34;a=%a A=%A b=%b B=%B d=%d h=%H m=%m y=%y Y=%Y M=%M&#34; $i &#124; sed -e 's/.*: //')
        repcible=&#34;$rep&#34;/$(echo &#34;$Class&#34; &#124; sed s/&#34;%a&#34;/&#34;$a&#34;/ &#124; sed s/&#34;%A&#34;/&#34;$A&#34;/ &#124; sed s/&#34;%b&#34;/&#34;$b&#34;/ &#124; sed s/&#34;%B&#34;/&#34;$B&#34;/ &#124; sed s/&#34;%d&#34;/&#34;$d&#34;/ &#124; sed s/&#34;%H&#34;/&#34;$H&#34;/ &#124; sed s/&#34;%m&#34;/&#34;$m&#34;/ &#124; sed s/&#34;%y&#34;/&#34;$y&#34;/ &#124; sed s/&#34;%Y&#34;/&#34;$Y&#34;/ &#124; sed s/&#34;%P&#34;/&#34;$P&#34;/)
        if test ! -e $repcible; then
            mkdir -p $repcible
        fi
        mv $i $repcible
        ajpg=$[$ajpg + 1]
        echo $[100*$ajpg/$num_files]
    done &#124; zenity --progress --text=&#34;Пожалуйста, подождите\nВыполнение действий над jpeg...&#34; --auto-close

    zenity --info --text=&#34;Фотографии были успешно импортированы&#34; --title=&#34;Информация&#34;;

}

function cancel {
    if [ &#34;${PIPESTATUS[0]}&#34; != 0 ]; then
        exit
    fi
}

function actions {
    extract;
}

config;

num_files;

ACTION=$(zenity --list --checklist --width=390 --height=290\
            --title=&#34;Выбор операций для выполнения&#34;\
            --text=&#34;Нажмите кнопку ОК, чтобы начать импортирующими фотографии.\nВыберите для выполнения операций : &#34;\
            --column=&#34; &#34; --column=&#34;Описание&#34;\
            TRUE    &#34;Сохранить файлы на устройстве&#34; );

cancel;

actions;</pre>
<p>Собственно основные моменты база фотографий располагается в $HOME&#8221;/Photos&#8221;. Далее происходит импорт фотографий в каталог база/год/месяц/день/ создания фотографии.</p>
<p>Использование вообще банально сохраняете скрипт к примеру в /usr/local/bin/import-photos делаете его исполнимым</p>
<pre>chmod +x /usr/local/bin/import-photos</pre>
<p>Далее для <a href="http://www.gnome.org/">gnome</a> в <strong>gnome-volume-properties</strong> &#8220;Сменные устройства и носители&#8221; для <strong>цифровых камер</strong> просто устанавливаете команду <strong>/usr/local/bin/import-photos</strong><br />
Вот приблизительно так</p>
<p><a href="http://sudormrf.wordpress.com/files/2009/07/gnome-volume-properties.png"><img src="http://sudormrf.wordpress.com/files/2009/07/gnome-volume-properties.png?w=300" alt="gnome-volume-properties" title="gnome-volume-properties" width="630" height="383" class="aligncenter size-full wp-image-428" /></a></p>
<p>Далее при появлении цифровых камер происходит следующее в начале появляется пара диалоговых окон гнома </p>
<p>В первом надо поставить галочку напротив &#8220;Всегда выполнять это действие&#8221; и нажать Ок. Иначе это окно будет появляться постоянно при вставке носителя.</p>
<p><a href="http://sudormrf.wordpress.com/files/2009/07/gnome-dialog-1.png"><img src="http://sudormrf.wordpress.com/files/2009/07/gnome-dialog-1.png" alt="gnome-dialog-1" title="gnome-dialog-1" width="433" height="321" class="aligncenter size-full wp-image-429" /></a></p>
<p>И вот такое окно</p>
<p><a href="http://sudormrf.wordpress.com/files/2009/07/gnome-dialog-2.png"><img src="http://sudormrf.wordpress.com/files/2009/07/gnome-dialog-2.png" alt="gnome-dialog-2" title="gnome-dialog-2" width="473" height="186" class="aligncenter size-full wp-image-430" /></a></p>
<p>Во втором окне необходимо нажать на &#8220;Импортировать фотографии&#8221; тогда начинает работать скрипт</p>
<p><a href="http://sudormrf.wordpress.com/files/2009/07/import-photos-1.png"><img src="http://sudormrf.wordpress.com/files/2009/07/import-photos-1.png" alt="import-photos-1" title="import-photos-1" width="550" height="187" class="aligncenter size-full wp-image-431" /></a></p>
<p>Собственно скрипт автоматически обнаружил носитель с фотографиями. Далее диалог о сохранении файлов на обнаруженном носителе.</p>
<p><a href="http://sudormrf.wordpress.com/files/2009/07/import-photos-2.png"><img src="http://sudormrf.wordpress.com/files/2009/07/import-photos-2.png" alt="import-photos-2" title="import-photos-2" width="495" height="312" class="aligncenter size-full wp-image-432" /></a></p>
<p>Сам процесс копирования&#8230;</p>
<p><a href="http://sudormrf.wordpress.com/files/2009/07/import-photos-3.png"><img src="http://sudormrf.wordpress.com/files/2009/07/import-photos-3.png" alt="import-photos-3" title="import-photos-3" width="203" height="148" class="aligncenter size-full wp-image-433" /></a></p>
<p>Окно с напоминанием форматов времени.</p>
<p><a href="http://sudormrf.wordpress.com/files/2009/07/import-photos-4.png"><img src="http://sudormrf.wordpress.com/files/2009/07/import-photos-4.png" alt="import-photos-4" title="import-photos-4" width="513" height="439" class="aligncenter size-full wp-image-434" /></a></p>
<p>И диалог задания формата сортировки базы данных картинок.</p>
<p><a href="http://sudormrf.wordpress.com/files/2009/07/import-photos-5.png"><img src="http://sudormrf.wordpress.com/files/2009/07/import-photos-5.png" alt="import-photos-5" title="import-photos-5" width="420" height="133" class="aligncenter size-full wp-image-435" /></a></p>
<p>Ну и собственно</p>
<p><a href="http://sudormrf.wordpress.com/files/2009/07/import-photos-6.png"><img src="http://sudormrf.wordpress.com/files/2009/07/import-photos-6.png" alt="import-photos-6" title="import-photos-6" width="396" height="145" class="aligncenter size-full wp-image-436" /></a></p>
<p>На этом все. <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Ubuntu - Debian script aggiornamento]]></title>
<link>http://runner75.wordpress.com/2009/07/29/ubuntu-debian-script-aggiornamento/</link>
<pubDate>Wed, 29 Jul 2009 08:53:17 +0000</pubDate>
<dc:creator>runner75</dc:creator>
<guid>http://runner75.wordpress.com/2009/07/29/ubuntu-debian-script-aggiornamento/</guid>
<description><![CDATA[So che un buntu è presente uno strumento per gli aggiornamenti automatici, ma come al solito&#8230; ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>So che un buntu è presente uno strumento per gli aggiornamenti automatici, ma come al solito&#8230; se non so come funzionano le cose non sono contento!</p>
<p>Per aggiornare il sistema ho quindi scritto un paio di script che&#8230;<!--more-->sfruttando i comandi apt-get ed aptitude agiornano il sistema.</p>
<p>Gli script sono compatibili con tutti i sistemi che usano apt-get ed aptittude (prerequisiti).</p>
<p>Praticamente sono una semplice sequenza di comandi, ne ho creati 2 per permettere di scegliere la versione da shell o la versione &#8220;grafica&#8221; con zenity, va da se che la versione con zenity ha zenity come prerequisito!!</p>
<p><strong>Prerequisiti:</strong></p>
<p>apt-get<br />
aptitude<br />
zenity (per la versione grafica</p>
<p>Qualora mancassero aptitude o zenity &#8230;<br />
per i meno scafati, aprite un terminale e digitate:<br />
<em>sudo apt-get install aptitude<br />
sudo apt-get install zenity</em></p>
<p>Oppure installateli da synaptic&#8230;</p>
<p><strong>Per lanciare lo script da shell:</strong></p>
<p>Una volta creato il file con lo script all&#8217;interno e resolo eseguibile:</p>
<p>Aprire un terminale e digitare:</p>
<p><em>sudo ./nomefile</em></p>
<p><strong>Per la nciare lo script grafico:</strong></p>
<p>Una volta creato il file con lo script e resolo eseguibile si hanno 2 strade; la prima è di lanciarlo come se fosse uno script da shell.</p>
<p>L&#8217;altra strada (che è quella per cui è nato) è di lanciarlo da Nautilus (praticamente averlo nel tasto destro del mouse), per farlo bisogna copiare lo script in /home/nomeutente/.gnome2/nautilus-script   per arrivare nela cartella corretta consiglio:</p>
<p>Risorse -&#62; Cartella home</p>
<p>premere ctrl-h per visualizzare le cartelle nascoste</p>
<p>doppio click su .gnome2</p>
<p>doppio click su nautilus-script</p>
<p>copiare lo script</p>
<p>ora se andate sul desktop e premete il tasto destro troverete una voce &#8220;script&#8221; all&#8217;interno vi sarà il vostro script!</p>
<p>NOTE TECNICHE:</p>
<p>Chi come me usa un proxy per connettersi ad internet deve decommentare (togliere il #) le righe con la parloa &#8220;export&#8221; e sostituire a<br />
username -&#62; il proprio username (sul proxy)<br />
pasword -&#62; la propria password (sul proxy)<br />
proxy -&#62; indirizzo o nome del proxy<br />
porta -&#62; la porta utilizzata dal proxy</p>
<p><strong>Ecco i 2 script</strong></p>
<p><strong><em>Da Shell (non grafico)</em></strong></p>
<blockquote><p>#!/bin/bash<br />
# Script di: Runner75<br />
# Sito: runner75.wordpress.com<br />
# Script per aggiornamento di un sistema che usa apt-get ed aptitude.<br />
# Nato su Ubuntu Jaunty 9.04<br />
# 29_07_09<br />
# /*<br />
# * &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
# * &#8220;LA LICENZA BEER-WARE&#8221; (Versione 42):<br />
# * Questo file è stato scritto da Runner75. Fin quando questo testo<br />
# * di licenza rimane invariato, puoi fare quel cavolo che ti pare con questa roba.<br />
# * Se un giorno ci incontreremo, e se pensi che il mio codice sia servito a qualcosa,<br />
# * puoi offrirmi una birra come ringraziamento. Runner75<br />
# * &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
# */<br />
echo &#8220;#Eseguo export del proxy&#8221;<br />
#export http_proxy=http://username:password@proxy:porta<br />
#export ftp_proxy=http://username:password@proxy:porta<br />
echo &#8220;# Aggiornamento lista pacchetti nei repository\n(comando sudo apt-get update lanciato 2 volte)&#8221;<br />
sudo apt-get update<br />
sudo apt-get update<br />
echo &#8220;# Controllo dipendenze mancanti\n(comando sudo apt-get -y check)&#8221;<br />
sudo apt-get -y check<br />
echo &#8220;# Aggiornamento pacchetti\n(comando sudo aptitude -y safe-upgrade&#8221;<br />
sudo aptitude -y safe-upgrade<br />
echo &#8220;# Aggiornamento lista pacchetti nei repository\n(comando sudo apt-get update lanciato 2 volte)&#8221;<br />
sudo apt-get update<br />
sudo apt-get update<br />
echo &#8220;# Rimozione pacchetti scaricati ed installati\n(comando sudo aptitude clean&#8221;<br />
sudo aptitude clean</p></blockquote>
<p><strong><em>Script con grafica:</em></strong></p>
<p>#!/bin/bash<br />
# Script di: Runner75<br />
# Sito: runner75.wordpress.com<br />
# Script per aggiornamento di un sistema che usa apt-get ed aptitude.<br />
# Nato su Ubuntu Jaunty 9.04<br />
# 29_07_09<br />
# /*<br />
# * &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
# * &#8220;LA LICENZA BEER-WARE&#8221; (Versione 42):<br />
# * Questo file è stato scritto da Runner75. Fin quando questo testo<br />
# * di licenza rimane invariato, puoi fare quel cavolo che ti pare con questa roba.<br />
# * Se un giorno ci incontreremo, e se pensi che il mio codice sia servito a qualcosa,<br />
# * puoi offrirmi una birra come ringraziamento. Runner75<br />
# * &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
# */<br />
(<br />
echo &#8220;#Eseguo export del proxy&#8221;<br />
export http_proxy=http://mtartar:F4nt4m4n@139.128.19.7:8080<br />
export ftp_proxy=http://mtartar:F4nt4m4n@139.128.19.7:8080<br />
echo &#8220;# Aggiornamento lista pacchetti nei repository\n(comando sudo apt-get update lanciato 2 volte)&#8221;<br />
gksu apt-get update<br />
sudo apt-get update<br />
echo &#8220;# Controllo dipendenze mancanti\n(comando sudo apt-get -y check)&#8221;<br />
sudo apt-get -y check<br />
echo &#8220;# Aggiornamento pacchetti\n(comando sudo aptitude -y safe-upgrade&#8221;<br />
sudo aptitude -y safe-upgrade<br />
echo &#8220;# Aggiornamento lista pacchetti nei repository\n(comando sudo apt-get update lanciato 2 volte)&#8221;<br />
sudo apt-get update<br />
sudo apt-get update<br />
echo &#8220;# Rimozione pacchetti scaricati ed installati\n(comando sudo aptitude clean)&#8221;<br />
sudo aptitude clean ) &#124; (zenity &#8211;width=300 &#8211;height=100 &#8211;progress &#8211;pulsate &#8211;auto-close &#8211;title=&#8221;Aggiornamento&#8221;)</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[zenity - 간단한 gtk+ 기반 다이얼로그 프로그램]]></title>
<link>http://shellbt.wordpress.com/2009/07/16/zenity-ucn-gtk-ay-uaioi-caiy/</link>
<pubDate>Thu, 16 Jul 2009 04:56:50 +0000</pubDate>
<dc:creator>shellbt</dc:creator>
<guid>http://shellbt.wordpress.com/2009/07/16/zenity-ucn-gtk-ay-uaioi-caiy/</guid>
<description><![CDATA[사용법: zenity [옵션...] 도움말 옵션: -?, &#8211;help 도움말 옵션을 봅니다 &#8211;help-all 모든 도움말 옵션을 봅니다 &#8211;help-g]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>사용법:<br />
zenity [옵션...]</p>
<p>도움말 옵션:<br />
-?, &#8211;help 도움말 옵션을 봅니다<br />
&#8211;help-all 모든 도움말 옵션을 봅니다<br />
&#8211;help-general 일반 옵션을 표시합니다<br />
&#8211;help-calendar 달력 옵션을 표시합니다<br />
&#8211;help-entry 텍스트 입력란 옵션을 표시합니다<br />
&#8211;help-error 오류 옵션을 표시합니다<br />
&#8211;help-info 정보 옵션을 표시합니다<br />
&#8211;help-file-selection 파일 선택 옵션을 표시합니다<br />
&#8211;help-list 목록 옵션을 표시합니다<br />
&#8211;help-notification 알림 아이콘 옵션을 표시합니다<br />
&#8211;help-progress 진행 옵션을 표시합니다<br />
&#8211;help-question 물음 옵션을 표시합니다<br />
&#8211;help-warning 주의 옵션을 표시합니다<br />
&#8211;help-scale 눈금 옵션을 표시합니다<br />
&#8211;help-text-info 텍스트 정보 옵션을 표시합니다<br />
&#8211;help-misc 기타 옵션을 표시합니다<br />
&#8211;help-gtk GTK+ 옵션 표시</p>
<p>프로그램 옵션:<br />
&#8211;calendar 달력 대화 상자를 표시합니다<br />
&#8211;entry 텍스트 입력 대화 창을 표시합니다<br />
&#8211;error 오류 대화 상자를 표시합니다<br />
&#8211;info 정보 대화 상자를 표시합니다<br />
&#8211;file-selection 파일 선택상자를 표시합니다<br />
&#8211;list 목록 대화 상자를 표시합니다<br />
&#8211;notification 알림을 표시합니다<br />
&#8211;progress 진행 표시상자를 표시합니다<br />
&#8211;question 질문 대화 상자를 표시합니다<br />
&#8211;warning 주의 대화 상자를 표시합니다<br />
&#8211;scale 눈금값 대화 상자를 표시합니다<br />
&#8211;text-info 텍스트 정보 대화 창을 표시합니다<br />
&#8211;display=DISPLAY X display to use</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Zenity : A combination of gtk and bash]]></title>
<link>http://rahimanuddin.wordpress.com/2009/06/25/zenity-a-combination-of-gtk-and-bash/</link>
<pubDate>Thu, 25 Jun 2009 10:31:52 +0000</pubDate>
<dc:creator>rahimanuddin</dc:creator>
<guid>http://rahimanuddin.wordpress.com/2009/06/25/zenity-a-combination-of-gtk-and-bash/</guid>
<description><![CDATA[Zenity is a tool that help you to create a common functional GTK+ dialogs. It have various dialogs t]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Zenity is a tool that help you to create a common functional GTK+ dialogs. It have various dialogs that each of them have different ways of presenting data and acquire data from user input.</p>
<p><strong>Some example scripts</strong></p>
<p>* szDate=$(zenity —calendar —text &#8220;Pick a day&#8221; —title &#8220;Medical Leave&#8221; —day 28 —month 8 —year 2009); echo $szDate</p>
<p>This would display the given date in calendar</p>
<p>* szAnswer=$(zenity —entry —text &#8220;where are you?&#8221; —entry-text &#8220;at lab&#8221;); echo $szAnswer</p>
<p>This would display a box with given text</p>
<p>* zenity —error —text &#8220;Error Message! &#8220;</p>
<p>An error message</p>
<p>* zenity —info —text &#8220;Join us at www.glugjntucep.wikidot.com.&#8221;</p>
<p>A text window</p>
<p>* szSavePath=$(zenity —file-selection —save —confirm-overwrite);echo $szSavePath</p>
<p>File selection dialog box</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[ConvertToAmv: un semplice modo per convertire in AMV su Ubuntu!]]></title>
<link>http://axelbuntu.wordpress.com/2009/05/31/converttoamv-un-semplice-modo-per-convertire-in-amv-su-ubuntu/</link>
<pubDate>Sun, 31 May 2009 15:38:43 +0000</pubDate>
<dc:creator>axelbuntu</dc:creator>
<guid>http://axelbuntu.wordpress.com/2009/05/31/converttoamv-un-semplice-modo-per-convertire-in-amv-su-ubuntu/</guid>
<description><![CDATA[Ho scritto questo semplice applicativo (basandomi su una versione di ffmpeg modificata per convertir]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Ho scritto questo semplice applicativo (basandomi su una versione di ffmpeg modificata per convertire gli amv) per permettere a tutti semplicemente di convertire i propri video in amv, unico formato video supportato da alcuni lettori mp3;<br />
Il programma offre una semplice interfaccia in Zenity, e salva il file convertito nella home;<br />
Una volta installato, si può trovare un collegamento al programma in Applicazioni&#8211;&#62;Audio e Video.<br />
È scaricabile <a href="http://www.fileden.com/getfile.php?file_path=http://www.fileden.com/files/2007/6/12/1168744/ConvertToAmv_1.0_all.deb">qui</a><br />
Spero di esservi stato utile!<br />
Bye!</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Suivre les modifications d’un répertoire]]></title>
<link>http://zigazou.wordpress.com/2009/05/21/suivre-les-modifications-d%e2%80%99un-repertoire/</link>
<pubDate>Thu, 21 May 2009 14:15:50 +0000</pubDate>
<dc:creator>zigazou</dc:creator>
<guid>http://zigazou.wordpress.com/2009/05/21/suivre-les-modifications-d%e2%80%99un-repertoire/</guid>
<description><![CDATA[Voici un script Python pour connaître les modifications subies par un répertoire entre un instant A ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Voici un script Python pour connaître les modifications subies par un répertoire entre un instant A et un instant B. Comble du bonheur, ce n’est pas un programme en ligne de commande.</p>
<p><!--more--></p>
<p>Ce programme comble (enfin je crois) un manque en la matière car des commandes existent qui font plus ou moins ça :</p>
<ul>
<li><strong>diff</strong> : permet de comparer deux répertoires, mais il ne permet pas de comparer un répertoire avec lui-même…</li>
<li><strong>dnotify</strong> : permet de suivre les modifications en temps réel et d’exécuter un action quand une modification a lieu.  S’il n y a pas de modification, dnotify ne rend pas la main…</li>
</ul>
<h2>Pré-requis</h2>
<p>Le programme utilise zenity et yelp qui devraient être installés par défaut sur Ubuntu (Gnome).</p>
<h2>Installation</h2>
<p><a title="Télécharger le script diffrep" href="http://zigazou.free.fr/blog/diffrep">Télécharger le script</a>.</p>
<p>Copier le script dans votre répertoire ~/bin. Il peut porter le nom que vous voulez, moi je l’ai appelé “Répertoire avant-après”, n’ayons pas peur des accents et des espaces !</p>
<p>Donnez-lui les droits en exécution :</p>
<div id="attachment_187" class="wp-caption aligncenter" style="width: 430px"><img class="size-full wp-image-187" title="Donner les droits en exécution au script" src="http://zigazou.wordpress.com/files/2009/05/diffrepexecution.png" alt="Donner les droits en exécution au script" width="420" height="319" /><p class="wp-caption-text">Donner les droits en exécution au script</p></div>
<p>Il est ensuite possible de créer un lanceur sur le bureau. Sous Nautilus, faites apparaître le menu contextuel en cliquant avec le bouton de droite de la souris sur le bureau :</p>
<div id="attachment_189" class="wp-caption aligncenter" style="width: 292px"><img class="size-full wp-image-189" title="Menu contextuel de Nautilus" src="http://zigazou.wordpress.com/files/2009/05/diffrepcreerlanceur.png" alt="Menu contextuel de Nautilus" width="282" height="196" /><p class="wp-caption-text">Menu contextuel de Nautilus</p></div>
<p>Cliquer sur Créer un lanceur…, la fenêtre suivante apparaît :</p>
<div id="attachment_188" class="wp-caption aligncenter" style="width: 430px"><img class="size-full wp-image-188" title="Créer un lanceur sur le bureau" src="http://zigazou.wordpress.com/files/2009/05/diffreplanceur.png" alt="Créer un lanceur sur le bureau" width="420" height="192" /><p class="wp-caption-text">Créer un lanceur sur le bureau</p></div>
<p>Choisissez Application comme type de lanceur, donnez le nom que vous voulez et sélectionnez le script avec le bouton Parcours…. Il est également possible de changer l’icône en cliquant dessus.</p>
<h2>Utilisation</h2>
<p>Ce programme est très simple d’utilisation :</p>
<ul>
<li>vous sélectionnez un ou plusieurs répertoires, un cliché est automatiquement pris,</li>
<li>vous exécutez les tâches dont vous voulez connaitre le comportement,</li>
<li>vous cliquez sur le bouton Valider,</li>
<li>vous lisez le résultat.</li>
</ul>
<p>Le cliché inclut tous les sous-répertoires qu’il peut trouver.</p>
<p>Le programme est très rapide car les fichiers ne sont pas lus, seules les informations accessibles par la commande ls sont comparées.</p>
<p>Note : Il peut aussi être appelé depuis la ligne de commande en donnant les répertoires en paramètres, cela évite de devoir passer par la fenêtre de sélection. Le reste est identique.</p>
<h2>Exemple</h2>
<p>Dans cet exemple, je vais suivre les modifications de mon répertoire .mozilla lorsque je lance Firefox 3.</p>
<p>Avant de lancer Firefox, je lance le programme. La fenêtre de sélection de répertoire apparaît. Je sélectionne le répertoire et clique sur Valider.</p>
<div id="attachment_185" class="wp-caption aligncenter" style="width: 430px"><img class="size-full wp-image-185" title="Sélection du répertoire" src="http://zigazou.wordpress.com/files/2009/05/diffrepselection.png" alt="Sélection du répertoire" width="420" height="266" /><p class="wp-caption-text">Sélection du répertoire</p></div>
<p>Le premier cliché est réalisé et le message suivant apparaît :</p>
<div id="attachment_186" class="wp-caption aligncenter" style="width: 430px"><img class="size-full wp-image-186" title="Premier cliché réalisé" src="http://zigazou.wordpress.com/files/2009/05/diffrepsuivant.png" alt="Premier cliché réalisé" width="420" height="150" /><p class="wp-caption-text">Premier cliché réalisé</p></div>
<p>Je lance donc Firefox comme prévu. Une fois Firefox lancé, je clique sur Valider. La fenêtre des résultats s’affiche alors :</p>
<div id="attachment_184" class="wp-caption aligncenter" style="width: 430px"><img class="size-full wp-image-184" title="Fenêtre des résultats" src="http://zigazou.wordpress.com/files/2009/05/diffrepresultats.png" alt="Fenêtre des résultats" width="420" height="493" /><p class="wp-caption-text">Fenêtre des résultats</p></div>
<p>Et voilà !</p>
<h2>Fonctionnement</h2>
<h3>Sélection de répertoire</h3>
<p>La sélection du ou des répertoires se fait avec zenity :</p>
<blockquote>
<pre>zenity --file-selection --directory --multiple</pre>
</blockquote>
<p>Explications :</p>
<ul>
<li><strong>&#8211;file-selection</strong> : fait apparaître la fenêtre de sélection de fichiers,</li>
<li><strong>&#8211;directory</strong> : fonctionne en mode sélection de répertoire</li>
<li><strong>&#8211;multiple</strong> : permet de sélectionner plusieurs répertoires</li>
</ul>
<p>En mode sélection multiple, zenity retourne une ligne contenant les répertoires séparés par un &#124;.</p>
<h3>Prise de cliché</h3>
<p>Le programme utilise la commande ls pour récupérer les répertoires, les fichiers et leur état à un instant donné :</p>
<blockquote>
<pre>ls -AlRZ --time-style=long-iso <strong>repertoire</strong> &#124; grep -v -e "^total" -e "^$"</pre>
</blockquote>
<p>Description :</p>
<ul>
<li><strong>ls</strong> :<strong><br />
</strong></p>
<ul>
<li><strong>-A</strong> : affiche tous les fichiers, même cachés à l’exception de . et ..,</li>
<li><strong>-l</strong> : affichage complet,</li>
<li><strong>-R</strong> : analyse récursive,</li>
<li><strong>-Z</strong> : récupère le contexte SELinux.</li>
<li><strong>repertoire</strong> : répertoire(s) à analyser</li>
</ul>
</li>
<li><strong>grep</strong> :
<ul>
<li><strong>-v</strong> : inverse le filtrage de grep,</li>
<li><strong>-e &#8220;^total&#8221;</strong> : élimine les lignes de totaux,</li>
<li><strong>-e &#8220;^$&#8221;</strong> : élimine les lignes vides.</li>
</ul>
</li>
</ul>
<p>Toutes ces informations sont enregistrées à chaque prise de cliché pour ensuite être analysées.</p>
<p>La toute première lettre des droits fournis par ls -l permet de connaître le type de fichier :</p>
<ul>
<li><strong>d</strong> : répertoire,</li>
<li><strong>-</strong> : fichier standard,</li>
<li><strong>b</strong> : fichier bloc spécial (device),</li>
<li><strong>c</strong> : fichier caractère spécial (device),</li>
<li><strong>l</strong> : lien symbolique,</li>
<li><strong>p</strong> : tube nommé,</li>
<li><strong>s</strong> : socket.</li>
</ul>
<h3>Analyse des différences</h3>
<p>Les clichés sont indexés avec le chemin absolu de chaque fichier et répertoire.</p>
<p>L’algorithme d’analyse est plutôt simple :</p>
<ul>
<li><strong>ajout</strong> : on regarde les entrées présentes dans le second cliché mais pas dans le premier,</li>
<li><strong>suppression</strong> : on regarde les entrées présentes dans le premier cliché mais pas dans le second,</li>
<li><strong>modification</strong> : on regarde si les informations de l’entrée ont changé entre les 2 clichés (type d’entrée, propriétaire, groupe, contexte SELinux, taille, jour et heure de modification).</li>
</ul>
<h3>Affichage des résultats</h3>
<p>Pour afficher les résultats, on génère un bête fichier HTML que yelp se chargera d’afficher. Yelp est normalement l’afficheur d’aide en ligne de Gnome mais il peut afficher n’importe quel fichier HTML (sans trop pousser non plus…) que vous lui fournissez.</p>
<p>Idéal pour notre cas.</p>
<h2>Code source</h2>
<p>Oui, le code source est lourd et mal commenté (quick and dirty)…</p>
<pre>#!/usr/bin/env python
# coding=utf8
import sys
from subprocess import call,Popen,PIPE
from os.path import abspath,join,dirname,basename
from tempfile import NamedTemporaryFile

def decoupe_entree(ligne):
  elements=ligne.split(None,8)
  entree={
    "droits"      :elements[0],
    "proprietaire":elements[2],
    "groupe"      :elements[3],
    "contexte"    :elements[4],
    "taille"      :elements[5],
    "jour"        :elements[6],
    "heure"       :elements[7],
    "nom"         :elements[8]
  }

  lettre_type=elements[0][0]
  entree["type"]="fichier de type inconnu"
  if lettre_type=="d": entree["type"]="répertoire"
  if lettre_type=="-": entree["type"]="fichier"
  if lettre_type=="b": entree["type"]="fichier bloc spécial"
  if lettre_type=="c": entree["type"]="fichier caractère spécial"
  if lettre_type=="l": entree["type"]="lien symbolique"
  if lettre_type=="p": entree["type"]="tube nommé"
  if lettre_type=="s": entree["type"]="socket"

  return entree

def exec_analyse(repertoires):
  cmd1=['ls','-AlRZ','--time-style=long-iso']+repertoires
  cmd2=['grep','-v','-e','^total','-e','^$']

  p1=Popen(cmd1,stdout=PIPE,stderr=PIPE)
  p2=Popen(cmd2,stdin=p1.stdout,stdout=PIPE,stderr=None)

  lignes=p2.communicate()[0].splitlines()

  repcourant=""
  entrees   ={}
  for ligne in lignes:
    if ligne.startswith("/"):
      repcourant=ligne[0:-1]
    else:
      entree=decoupe_entree(ligne)
      entrees[join(repcourant,entree['nom'])]=entree

  return entrees

def compare_entree(avant,apres):
  differences=[]
  comparaisons={
    "type"        : "le type a changé",
    "proprietaire": "le propriétaire a changé",
    "groupe"      : "le groupe a changé",
    "contexte"    : "le contexte SELinux a changé",
    "taille"      : "la taille a changé",
    "jour"        : "la date de modification a changé",
    "heure"       : "l’heure de modification a changé"
  }

  for composant in comparaisons:
    if avant[composant]!=apres[composant]:
      differences.append(comparaisons[composant]+" (%s → %s)"%(avant[composant],apres[composant]))

  return differences

def compare_entrees(entrees_avant,entrees_apres):
  ajouts       =[]
  suppressions =[]
  modifications=[]

  # Recherche les suppressions et les modifications
  for entree in entrees_avant:
    if entree not in entrees_apres:
      # Entrée supprimée
      suppressions.append(entree)
      continue

    if entrees_avant[entree]!=entrees_apres[entree]:
      # Entrées différentes
      modifications.append(entree)

  # Recherche les ajouts:
  for entree in entrees_apres:
    if entree not in entrees_avant:
      # Nouvelle entrée
      ajouts.append(entree)

  return [ajouts,suppressions,modifications]

def prepare_nom(chemin):
  chemin=chemin.replace("&#38;","&#38;amp;").replace("&#62;","&#38;gt;").replace("&#60;","&#38;tt;")
  return dirname(chemin)+"/&#60;strong&#62;"+basename(chemin)+"&#60;/strong&#62;"

def affiche_differences(entrees_avant,entrees_apres,ajouts,suppressions,modifications):
  html ='&#60;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"&#62;\n'
  html+='&#60;html lang="fr"&#62;\n'

  html+='&#60;head&#62;\n'
  html+='&#60;title&#62;Suivi des modifications&#60;/title&#62;\n'
  html+='&#60;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&#62;\n'
  html+='&#60;/head&#62;\n'

  html+='&#60;body&#62;\n'
  html+='&#60;h1&#62;Suivi des modifications&#60;/h1&#62;'

  html+='&#60;h2&#62;Ajouts&#60;/h2&#62;\n'
  if len(ajouts)==0:
    html+='&#60;p&#62;Aucun ajout&#60;/p&#62;\n'
  else:
    html+='&#60;ul&#62;\n'
    for ajout in ajouts:
      html+='&#60;li&#62;'+prepare_nom(ajout)+' (&#60;i&#62;'+entrees_apres[ajout]["type"]+'&#60;/i&#62;)&#60;/li&#62;\n'
    html+='&#60;/ul&#62;\n'

  html+='&#60;h2&#62;Suppressions&#60;/h2&#62;\n'
  if len(suppressions)==0:
    html+='&#60;p&#62;Aucune suppression&#60;/p&#62;\n'
  else:
    html+='&#60;ul&#62;\n'
    for suppression in suppressions:
      html+='&#60;li&#62;'+prepare_nom(suppression)+' (&#60;i&#62;'+entrees_avant[suppression]["type"]+'&#60;/i&#62;)&#60;/li&#62;\n'
    html+='&#60;/ul&#62;\n'

  html+='&#60;h2&#62;Modifications&#60;/h2&#62;\n'
  if len(modifications)==0:
    html+='&#60;p&#62;Aucune modification&#60;/p&#62;\n'
  else:
    html+='&#60;ul&#62;\n'
    for modification in modifications:
      html+='&#60;li&#62;'+prepare_nom(modification)
      diffs=compare_entree(entrees_avant[modification],entrees_apres[modification])
      html+='&#60;ul&#62;\n'
      for diff in diffs:
        html+='&#60;li&#62;'+diff+'&#60;/li&#62;\n'
      html+="&#60;/ul&#62;\n"
      html+='&#60;/li&#62;\n'
    html+='&#60;/ul&#62;\n'

  html+='&#60;/body&#62;\n'
  html+='&#60;/html&#62;'

  return html  

if len(sys.argv)&#62;=2:
  rep_donnes=sys.argv[1:]
else:
  rep_donnes=Popen(['zenity','--file-selection','--directory','--multiple'],stdout=PIPE).communicate()[0].splitlines()[0]
  if rep_donnes=="": exit(0)
  rep_donnes=rep_donnes.split('&#124;')

repertoires=[]
for rep in rep_donnes:
  rep=rep.strip()
  if rep=="": continue
  rep=abspath(rep)
  if rep in repertoires: continue
  repertoires.append(abspath(rep))

if len(repertoires)==0: exit(0)

entrees_avant=exec_analyse(repertoires)

call(["zenity","--info","--title=Premier cliché réalisé","--text=Un premier cliché du répertoire a été réalisé.\nVeuillez cliquer sur le bouton pour lancer le second et afficher les différences"])

entrees_apres=exec_analyse(repertoires)

(ajouts,suppressions,modifications)=compare_entrees(entrees_avant,entrees_apres)

html=affiche_differences(entrees_avant,entrees_apres,ajouts,suppressions,modifications)
sortie=NamedTemporaryFile(suffix=".html")
sortie.write(html)
sortie.flush()
call(["yelp",sortie.name])</pre>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Enviar mensajes remotamente]]></title>
<link>http://inforlife.wordpress.com/2009/05/06/enviar-mensajes-remotamente/</link>
<pubDate>Wed, 06 May 2009 10:00:04 +0000</pubDate>
<dc:creator>rortegap</dc:creator>
<guid>http://inforlife.wordpress.com/2009/05/06/enviar-mensajes-remotamente/</guid>
<description><![CDATA[Con solo un comando podemos enviar mensajes de error, información, etc. Pero hay que tener instalado]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><img class="alignright size-full wp-image-433" title="error" src="http://inforlife.wordpress.com/files/2009/05/error1.jpg" alt="error" width="81" height="74" /></p>
<p>Con solo un comando podemos enviar mensajes de error, información, etc. Pero hay que tener instalado ssh.</p>
<p>Para instalar ssh escribimos en la terminal:</p>
<p><code>sudo aptitude install ssh</code></p>
<p>Ya que tenemos instalado ssh, entramos en el ordenador al que le queremos enviar el mensaje con la línea de comandos:</p>
<p><code><!--more-->ssh usuario@IP</code></p>
<p>Donde:</p>
<ul>
<li>usuario, es el usuario del PC al que queremos entrar.</li>
<li>IP, es la IP del PC al que queremos entrar.</li>
</ul>
<p>Una vez dentro, ejecutamos para enviar el mensaje, el comando:</p>
<p><code>zenity --error --text "Esto es una prueba" --display :0</code></p>
<p>donde:</p>
<ul>
<li>zenity, es el comando que necesitamos.</li>
<li>&#8211;error, es el tipo de mensaje que queremos enviar. Para ver todos los tipos de mensajes que hay, puedes poner en la terminal:</li>
</ul>
<p><code>man zenity</code></p>
<p>y buscas todos los tipos de mensajes que podrás poner.</p>
<ul>
<li>&#8211;text, sirve para que podamos escribir el texto.</li>
<li>&#8220;Esto es una prueba&#8221;, es el texto que queremos escribir en el mensaje.</li>
<li>&#8211;display :0, es obligatorio ponerlo, sino, no funcionaría.</li>
</ul>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Search Google from terminal and save output to a file]]></title>
<link>http://linuxfanatic.wordpress.com/2009/05/06/search-google-from-terminal-and-save-output-to-a-file/</link>
<pubDate>Wed, 06 May 2009 08:38:04 +0000</pubDate>
<dc:creator>Tushar Neupaney</dc:creator>
<guid>http://linuxfanatic.wordpress.com/2009/05/06/search-google-from-terminal-and-save-output-to-a-file/</guid>
<description><![CDATA[Are you thinking to search and query for google from terminal shell with bash script. And what if yo]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Are you thinking to search and query for google from terminal shell with bash script. And what if you want to redirect the output to a text file. You can do it with the following code.</p>
<p>This code also features zenity in order to save the output and query for what you are searching. This code is very productive and you can use it for many purposes.</p>
<p>Enjoy!</p>
<p><code><br />
#!/bin/bash</p>
<p>squery=$(zenity --text)<br />
file="/home/tushar/Desktop/search.txt"<br />
(lynx "http://www.google.com/search?q=$(echo $squery&#124;sed -e 's/+/%2B/g' -e 's/ /+/g')"&#62;$file) &#124; zenity --progress \<br />
--title="Quering for the provided tag in google" \<br />
--text="Searching google ..... "\<br />
--percentage=0<br />
-- pulsate<br />
</code></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[jerome - a Songbird library consolidation script]]></title>
<link>http://dinofizz.wordpress.com/2009/02/16/jerome-a-songbird-library-consolidation-script/</link>
<pubDate>Mon, 16 Feb 2009 07:44:35 +0000</pubDate>
<dc:creator>dinofizz</dc:creator>
<guid>http://dinofizz.wordpress.com/2009/02/16/jerome-a-songbird-library-consolidation-script/</guid>
<description><![CDATA[I use Songbird 1.0.0 to listen to music and manage my ipod, and it&#8217;s a really great app with m]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>I use <a href="http://getsongbird.com/">Songbird</a> 1.0.0 to listen to music and manage my ipod, and it&#8217;s a really great app with many cool features and add ons. The only feature I was missing was iTunes-style library consolidation &#8211; where all your music files are copied to folders on your hard drive by artist  then album.</p>
<p>Being new to the Linux environment as well as Python I decided that a good excercise in learning both would be to make my own little script to consolidate a Sonbird library. And so <a href="http://code.google.com/p/jerome">jerome</a> was born.</p>
<p>jerome uses python with <a href="http://oss.itsystementwicklung.de/trac/pysqlite/">pysqlite</a> to access the Songbird library and <a href="http://live.gnome.org/Zenity">zenity</a> as a simple GUI, with output folder selection and progress bar.</p>
<p>So if anyone out there is using Songbird and wishes to consolidate their music library, check out jerome!</p>
<p><a href="http://code.google.com/p/jerome/">jerome &#8211; Google Code</a>.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[My script for configuring file associations in wine]]></title>
<link>http://opensuse1501.wordpress.com/2008/11/09/my-script-for-configuring-file-associations-in-wine/</link>
<pubDate>Sun, 09 Nov 2008 13:03:57 +0000</pubDate>
<dc:creator>tomdwright</dc:creator>
<guid>http://opensuse1501.wordpress.com/2008/11/09/my-script-for-configuring-file-associations-in-wine/</guid>
<description><![CDATA[Hi, I have just written a script which should help everyone who wants to configure which programs wi]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Hi,</p>
<p>I have just written a script which should help everyone who wants to configure which programs wine uses to open certain filetypes (e.g. you can set all .doc files to open with OpenOffice.org). The script is written in bash and uses zenity and sed.</p>
<p>Look here for more info:</p>
<p><a href="http://opensuse1501.wordpress.com/my-programsscripts/" target="_self">http://opensuse1501.wordpress.com/my-programsscripts/</a></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Time Up Dude Ver2]]></title>
<link>http://tuxomaniac.wordpress.com/2008/09/23/time-up-dude-ver2/</link>
<pubDate>Tue, 23 Sep 2008 00:52:59 +0000</pubDate>
<dc:creator>Cyriac</dc:creator>
<guid>http://tuxomaniac.wordpress.com/2008/09/23/time-up-dude-ver2/</guid>
<description><![CDATA[Additional Features form old version ## Snooze for 10mins ## Starts triggering only if HDD temperatu]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Additional Features form <a href="http://tuxomaniac.wordpress.com/2008/09/21/time-up-dude-ver101/">old version</a></p>
<p>##  Snooze for 10mins<br />
##  Starts triggering only if HDD temperature above 40 degrees<br />
##  Pops when temp is above 49 degrees wateva the time it is <br />
##  Additional package needed from previous version : hddtemp<br />
##  Resets the counter to 60 when system goes idle for 5 mins</p>
<p><code>sudo apt-get install hddtemp</code></p>
<p>The new code is<!--more--><br />
<code>work=TRUE<br />
tee=40<br />
teex=49<br />
echo "60" &#62; /home/cyriac/logs/timeupdude/testf<br />
while [ $work = TRUE ]<br />
do<br />
hdte=`sudo hddtemp -n /dev/sda1&#124;cut -d':' -f3&#124;sed 's/ //g'`<br />
if [ $hdte -lt $tee ]<br />
then<br />
test=cont<br />
fi<br />
if [ $hdte -gt $tee ]<br />
then<br />
timeot=w&#124;grep x-session-m&#124;cut -d':' -f3&#124;cut -d' ' -f5&#124;cut -d'.' -f1<br />
if [ $timeot &#62; 5 ]<br />
    then<br />
    echo "60" &#62; /home/cyriac/logs/timeupdude/testf<br />
    fi<br />
tt=`cat /home/cyriac/logs/timeupdude/testf`<br />
#echo $tt<br />
if [ $tt -eq 0 ]<br />
#if [ $x &#62;10 ]<br />
then<br />
    #if [ $hrs -eq $con ]<br />
    #then<br />
#    work=FALSE<br />
    ans=`zenity --title "TIME UP DUDE" --text "YOUR UPTIME IS OVER AN HOUR NOW " --list --radiolist --column "SELECTION" --column "ACTION" False SHUTDOWN True CONTINUE_WORKING(next_pop_at_30mins) False SNOOZE_for_10mins`<br />
if [ $ans = CONTINUE_WORKING\(next_pop_at_30mins\) ]<br />
then<br />
push=30<br />
fi<br />
if [ $ans = SNOOZE_for_10mins ]<br />
then<br />
push=10<br />
fi</p>
<p>        if [ $ans  SHUTDOWN ]<br />
        then<br />
#        con=`expr $con + 1`<br />
#        echo con<br />
#        sleep 65<br />
        echo $push &#62; /home/cyriac/logs/timeupdude/testf<br />
        else<br />
#        echo shut<br />
        sudo shutdown -ah now<br />
        fi<br />
    #fi<br />
else<br />
sleep 60<br />
tt=`expr $tt - 1`<br />
echo $tt&#62; /home/cyriac/logs/timeupdude/testf<br />
fi<br />
fi<br />
if [ $hdte -gt $teex]<br />
then<br />
tans=`zenity --title "HOTT HDD" --text "THE HDD IS OVER 49°C" --list --radiolist --column "SELECTION" --column "ACTION" False SHUTDOWN True CONTINUE_WORKING`<br />
    if [ $ans -eq CONTINUE_WORKING ]<br />
        then<br />
#        con=`expr $con + 1`<br />
#        echo con<br />
#        sleep 65<br />
        echo $push &#62; /home/cyriac/logs/timeupdude/testf<br />
        else<br />
#        echo shut<br />
        sudo shutdown -ah now<br />
        fi<br />
fi</p>
<p>done<br />
</code><br />
please leave comments on the code <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Time Up Dude ver1.01]]></title>
<link>http://tuxomaniac.wordpress.com/2008/09/21/time-up-dude-ver101/</link>
<pubDate>Sun, 21 Sep 2008 17:33:20 +0000</pubDate>
<dc:creator>Cyriac</dc:creator>
<guid>http://tuxomaniac.wordpress.com/2008/09/21/time-up-dude-ver101/</guid>
<description><![CDATA[Necessity is the mother of all inventions. Yes that is true. And for inventions to take place there ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Necessity is the mother of all inventions. Yes that is true. And for inventions to take place there should be a motivator.</p>
<p>I had very bad HDD crashes recently and i think the problem is the extreme use of my system which is on almost for 22 hrs a day on holidays and 14hrs on weekdays.</p>
<p>So i decided to make a tool to notify me when it is 1hr of use and give me options to shutdown and continue using.<br />
This was the first thing i did after installing an OS on the replaced HDD this time. My of the insipriation for trying it out is my senior at college <a href="http://sriunplugged.blogspot.com">srijith</a>.</p>
<p>He also has a similar tool but more better.<br />
So here goes the stuff.</p>
<p>my username is cyriac<br />
and i belong to a group script on my system.</p>
<p>Basic things to do prior to working my script.</p>
<p>edit the sudoers file.<br />
log in as root<br />
<code>visudo</code><br />
add the line<br />
<code>%script ALL=NOPASSWD: ALL</code></p>
<p>note that i belong to the group script<br />
now create a folders in the home directory with names /logs and /logs/timeupdude</p>
<p><code>mkdir ~/logs/timeupdude -p</code></p>
<p>make a textfile with name timeupdude<br />
and paste the code below.</p>
<p><code>work=TRUE<br />
echo "60" &#62; /home/cyriac/logs/timeupdude/testf<br />
while [ $work = TRUE ]<br />
do<br />
tt=`cat /home/cyriac/logs/timeupdude/testf`<br />
if [ $tt -eq 0 ]<br />
then<br />
ans=`zenity - -title "TIME UP DUDE" - -text "YOUR UPTIME IS OVER AN HOUR NOW " - -list - -radiolist - -column "SELECTION" - -column "ACTION" False SHUTDOWN True CONTINUE_WORKING`<br />
if [ $ans = CONTINUE ]<br />
then<br />
echo "60" &#62; /home/cyriac/logs/timeupdude/testf<br />
else<br />
sudo shutdown -ah now<br />
fi<br />
else<br />
sleep 60<br />
tt=`expr $tt - 1`<br />
echo $tt&#62; /home/cyriac/logs/timeupdude/testf<br />
fi<br />
done</code></p>
<p>Save the file and make it excec by</p>
<p><code>chmod +x timeupdude</code></p>
<p>copy the file to /etc/init.d<br />
and add it to the boot up</p>
<p><code>update-rc.d timeupdude defaults</code></p>
<p>Now restart the computer and the timeupdude is on the run..<br />
The tool first shows the screen below when it is 1hr.</p>
<p><a href="http://tuxomaniac.wordpress.com/files/2008/09/untitled.jpg"><img class="alignnone size-full wp-image-57" title="TimeUpDude_v1.01" src="http://tuxomaniac.wordpress.com/files/2008/09/untitled.jpg" alt="" width="318" height="236" /></a></p>
<p>If SHUTDOWN is pressed the system shuts down else if CONTINUE_WORKING is pressed you can continue working until this window again pops up in 30mins</p>
<p>You can also edit the time by scannin my script.<br />
And this script works with Gnome machines only.</p>
<p>Please note that the options in the zenity needs to be &#8211; - ie minusminus. not &#8211;<br />
Will come up with a new version with the ideas my `guru`;) suggested.. <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
<p><a href="http://tuxomaniac.wordpress.com/2008/09/23/time-up-dude-ver2">New code available</a> </p>
<p>Please leave comments so that i can find mistakes i made and improve.. <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Agenda de contatos com interface do zenity]]></title>
<link>http://tonolinux.wordpress.com/2008/09/20/agenda-de-contatos-com-interface-do-zenity/</link>
<pubDate>Sat, 20 Sep 2008 21:18:53 +0000</pubDate>
<dc:creator>lemuelroberto</dc:creator>
<guid>http://tonolinux.wordpress.com/2008/09/20/agenda-de-contatos-com-interface-do-zenity/</guid>
<description><![CDATA[Já tem um bom tempo que eu testo algumas agenda em shell disponíveis no VOL e em outros sites. Mas f]]></description>
<content:encoded><![CDATA[Já tem um bom tempo que eu testo algumas agenda em shell disponíveis no VOL e em outros sites. Mas f]]></content:encoded>
</item>
<item>
<title><![CDATA[Zenity o cómo interactuar gráficamente con el usuario desde un script]]></title>
<link>http://andalinux.wordpress.com/2008/08/13/zenity-o-como-interactuar-graficamente-con-el-usuario-desde-un-script/</link>
<pubDate>Wed, 13 Aug 2008 06:00:17 +0000</pubDate>
<dc:creator>jasvazquez</dc:creator>
<guid>http://andalinux.wordpress.com/2008/08/13/zenity-o-como-interactuar-graficamente-con-el-usuario-desde-un-script/</guid>
<description><![CDATA[Suele ser habitual cuando se desarrollan scripts bash tener que interactuar con el usuario para ofre]]></description>
<content:encoded><![CDATA[Suele ser habitual cuando se desarrollan scripts bash tener que interactuar con el usuario para ofre]]></content:encoded>
</item>
<item>
<title><![CDATA[Grub et gestion du prochain démarrage]]></title>
<link>http://bobbybionic.wordpress.com/2008/05/05/grub-et-gestion-du-prochain-demarrage/</link>
<pubDate>Mon, 05 May 2008 09:34:22 +0000</pubDate>
<dc:creator>BobbyBionic</dc:creator>
<guid>http://bobbybionic.wordpress.com/2008/05/05/grub-et-gestion-du-prochain-demarrage/</guid>
<description><![CDATA[Depuis que Debian me fait des misères, il me faut redémarrer sous Ubuntu pour jouir de la télévision]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Depuis que Debian me fait des misères, il me faut redémarrer sous Ubuntu pour jouir de la télévision (heureusement, ce supplice est rare, mais bon, la C1 étant repartie je ne désespère pas de voir bientôt les multiples défaites lyonnaises, par exemple hein <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>Attendre patiemment l&#8217;invite de Grub c&#8217;est loin d&#8217;être palpitant, tout comme devoir le laisser paramétré à 5s, c&#8217;est un temps fou de perdu à chaque démarrage !</p>
<p>Bref, ceci peut très bien être appliqué à un redémarrage sous n&#8217;importe quel OS, par exemple sous Windows pour les plus fous d&#8217;entre nous <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>Passons aux choses sérieuses et modifions le fichier <code>/boot/grub/menu.lst</code> (avec les droits root, <code>gedit /boot/grub/menu.lst</code> par exemple) plus particulièrement le passage<br />
<code>default 0</code><br />
que nous transformons en<br />
<code>default saved</code><br />
comme expliqué juste au dessus :<br />
<code># You can specify 'saved' instead of a number. In this case, the default entry</code><br />
<code># is the entry saved with the command 'savedefault'.</code></p>
<p>Maintenant, il nous faut donc modifier le fameux <code>savedefault</code>, c&#8217;est bien, vous êtes bilingue et vous suivez !</p>
<p>Nous nous rendons donc dans la section concernant le système &#8220;alternatif&#8221;, chez moi Ubuntu, elle ressemble à ça :<br />
<code>title           Ubuntu, kernel 2.6.20-15-generic</code><br />
<code>root            (hd0,0)</code><br />
<code>kernel          /boot/vmlinuz-2.6.20-15-generic [...]</code><br />
<code>initrd          /boot/initrd.img-2.6.20-15-generic</code><br />
<code>quiet</code></p>
<p>Et nous rajoutons la ligne<br />
<code>savedefault 0</code></p>
<p>Le <code>0</code> correspond au (n-1)ième <code>title</code> dans le menu grub, ce qui veut dire que le décompte commence à 0 et que l&#8217;éventuelle ligne &#8220;Other OS&#8230;&#8221; est comptée. Pour le premier système d&#8217;exploitation, il faut donc indiquer 0.</p>
<p>Bien, maintenant que le menu grub est paramétré, découvrons la commande magique : <code>grub-set-default</code></p>
<p>Celle-ci fonctionne de la même manière que précédemment, pour que le prochain démarrage se fasse sur le système d&#8217;exploitation correspondant au 3e <code>title</code> il faut donc indiquer<br />
<code>grub-set-default 2</code></p>
<p>Et voilà <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Vous avez compris le principe ? Vous savez donc désormais comment jongler avec vos systèmes d&#8217;exploitation, sans oublier en cas de jonglage multisystème le fameux <code>savedefault x</code> où il se doit.</p>
<p><ins>Bonus track</ins> : le script de tonton Bionic pour redémarrer, attention, ça décoiffe !</p>
<p><code>#!/bin/bash</code></p>
<p><code>if zenity --question --title "Redémarrer sous Ubuntu ?" --text 'Redémarrer sous Ubuntu ?' ;</code><br />
<code>then</code><br />
<code>grub-set-default 2</code><br />
<code>reboot</code><br />
<code>else</code><br />
<code>exit</code><br />
<code>fi</code></p>
<p>Le tout appelé en gksu par une icône sur le tableau de bord, l&#8217;est fort quand même ce Bionic&#8230;</p>
<p>Have fun !</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Exif Tags....]]></title>
<link>http://readthisaloud.wordpress.com/2008/04/23/exif-tags/</link>
<pubDate>Wed, 23 Apr 2008 15:59:30 +0000</pubDate>
<dc:creator>Rock &#39;n Snap</dc:creator>
<guid>http://readthisaloud.wordpress.com/2008/04/23/exif-tags/</guid>
<description><![CDATA[It&#8217;s been a while since I last blogged, because I&#8217;ve been quite busy lately and haven]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>It&#8217;s been a while since I last blogged, because I&#8217;ve been quite busy lately and haven&#8217;t found an interesting topic to blog about.</p>
<p>I&#8217;ve asked my good friend, Bernd, to write a small application for me that would let me edit the EXIF data of my photos. He wrote me this basic tool that pretty much just adds a comment to the EXIF data of my photos.</p>
<p><!--more--></p>
<p>You start the application, then a little pop-up dialog appears and asks you to type in the text for your comment field. <a href="http://readthisaloud.wordpress.com/files/2008/04/exif.png"></a> After choosing the right text you click OK, and then you can select the photos you want to provide with this comment. It&#8217;s very easy, and very similar to ID3-tagging with mp3s.</p>
<p style="text-align:center;"><img class="size-medium wp-image-38" src="http://readthisaloud.wordpress.com/files/2008/04/exif.png?w=247" alt="" width="247" height="134" /></p>
<p>The tool is written in Python, which means it&#8217;s platform independent and you can run it everywhere where Python is installed. It depends on the following packages zenity and exiv2, so make sure you have these installed before running the application.</p>
<p>Download the source code from <a href="http://media.b23.at/download/ec.sh.txt" target="_blank">here</a> and then rename it from &#8216;ec.sh.txt&#8217; to &#8216;ec.sh&#8217;. You can now run exif comment from your console by typing sh ec.sh or simply make a shortcut on your desktop to &#8216;./ec.sh&#8217;. As said before this will run anywhere and you don&#8217;t need to install it, just run it as it is.</p>
<p>If you know a similar tool, that is even more powerful, then please let me know. Also if you have any ideas on how it could be improved let me know and I&#8217;ll pass it onto Bernd.</p>
<p>Enjoy your Exif Comment!</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Zenity progress pulsate bar dialog example]]></title>
<link>http://linuxconfig.wordpress.com/2008/01/10/zenity-progress-pulsate-bar-dialog-example/</link>
<pubDate>Thu, 10 Jan 2008 01:35:03 +0000</pubDate>
<dc:creator>linuxconfig</dc:creator>
<guid>http://linuxconfig.wordpress.com/2008/01/10/zenity-progress-pulsate-bar-dialog-example/</guid>
<description><![CDATA[Here is an example of Zenity progress pulsate bar dialog. Depending on your desktop manager your out]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Here is an example of Zenity progress pulsate bar dialog. Depending on your desktop manager your output may be different:</p>
<p><code>yes &#124; zenity --progress  --width 350 --pulsate --text "Testing Zenity Progress Bar" --title "Zenity Pulsate Progress Bar"</code></p>
<p><img src="http://www.linuxconfig.org/images/book_images/zenity.jpg" alt="Zenity progress pulsate bar dialog example" width="354" height="144" /></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Vedere e scaricare i video di Youtube senza flash]]></title>
<link>http://frafra.wordpress.com/2007/11/03/vedere-e-scaricare-i-video-di-youtube-senza-flash/</link>
<pubDate>Sat, 03 Nov 2007 13:17:21 +0000</pubDate>
<dc:creator>frafra</dc:creator>
<guid>http://frafra.wordpress.com/2007/11/03/vedere-e-scaricare-i-video-di-youtube-senza-flash/</guid>
<description><![CDATA[Spesso vorremmo scaricare o vedere un video da youtube. Purtroppo youtube necessita di flash player,]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Spesso vorremmo scaricare o vedere un video da youtube. Purtroppo youtube necessita di flash player, una applicazione proprietaria che, per Linux, va solo su x86. Proprio oggi ho dovuto configurare un ibook g3 (processore ppc), e ho elaborato un sistema per risolvere il problema. Un semplice script che, una volta immesso il link della pagina dove è presente il video, scarica il filmato in formato flv. A questo punto possiamo aprirlo con VLC o un programma che usi xine, come gxine o totem&#45;xine. Consiglio di mettere lo script in /usr/share/bin, in modo tale da poter essere richiamato facilmente, nel caso dovessimo richiamarlo da linea di comando o da uno starter da mettere sul nostro pannello di gnome/kde/xfce. Lo script richiede zenity, wget e youtube&#45;dl per funzionare. Creiamo un file, chiamato youtube&#45;download.sh, con questo codice:</p>
<blockquote><p><code><br />
#!/bin/bash<br />
URL=$(youtube&#45;dl &#45;g $(zenity &#45;&#45;entry &#45;&#45;title=&#34;Youtube Download&#34; &#45;&#45;text=&#34;Inserisci qui il link del video&#34;))<br />
NAME=$(zenity &#45;&#45;entry &#45;&#45;title=&#34;Youtube Download&#34; &#45;&#45;text=&#34;Inserisci il nome del video&#34;)<br />
wget $URL &#45;O &#34;$NAME.flv&#34; 2&#62;&#38;1 &#124; sed &#45;u &#39;s/.*\ \([0&#45;9]\+%\)\ \+\([0&#45;9.]\+\ [KMB\/s]\+\)$/\1\n# Downloading \2/&#39; &#124;\<br />
zenity &#45;&#45;progress &#45;&#45;title=&#34;Downloading...&#34;</code></p></blockquote>
<p>Se vogliamo che alla fine del download venga avviato il video, basta inserire alla fine:</p>
<blockquote><p><code>vlc &#34;$NAME.flv&#34;</code></p></blockquote>
<p>&#8230;oppure, al posto di vlc, mettere gxine o totem. Se vogliamo che questi video finiscano direttamente in una cartella, tra la prima e la seconda riga dello script, inseriamo:</p>
<blockquote><p><code>cd /home/utente/youtube/</code></p></blockquote>
<p>&#8230;dove /home/utente/youtube è il percorso dove avremo i nostri video.<br />
Ricordate che per poter eseguire lo script dovete dare il permesso di esecuzione, con:</p>
<blockquote><p><code>chmod +x youtube&#45;download.sh</code></p></blockquote>
<p>Il bello di questo script è che non necessita di essere avviato da terminale, in quanto si basa su zenity; una applicazione gtk che permette di visualizzare semplici finestre che, in questo caso, ci permettono di inserire informazioni o di visualizzare lo stato di un download.</p>
<p>Lo script è migliorabile ovviamente, si possono inserire più opzioni o modificarlo a proprio piacimento. Spero che possa esservi utile <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
</div>]]></content:encoded>
</item>

</channel>
</rss>
