Contenu | Rechercher | Menus

Annonce

Si vous avez des soucis pour rester connecté, déconnectez-vous puis reconnectez-vous depuis ce lien en cochant la case
Me connecter automatiquement lors de mes prochaines visites.

À propos de l'équipe du forum.

#51 Le 19/02/2009, à 14:57

AnsuzPeorth

Re : get-canal, le retour...

Tu connais le poids du fichier téléchargé au depart ? Si oui, c'est juste une histoire de calcul (finalement, les maths qu'on nous a obligé à apprendre, nous sert un peu...!)

Perso, je ne m'embeterais pas avec les progress, j'indiquerais juste le nom et le poids du fichier (refresh 5s par exemple). Je trouve gourmand en ressource juste pour afficher une progress....Enfin, c'est juste mon avis smile


Interface graphique pour bash, python ou autre: glade2script
Support Tchat: http://chat.jabberfr.org/muckl_int/inde … ade2script  (Hors ligne)

Hors ligne

#52 Le 19/02/2009, à 15:00

Lancelin

Re : get-canal, le retour...

Ah oui, je n'avais même pas vu que je demandais de chercher des fichiers à un endroit où je savais pertinemment ne pas les y trouver.
"La vieillesse est un naufrage"
Et c'est d'autant plus vrai que je ne comprends pas quelle manip tu veux me faire faire. Il me semble que quel que soit le dossier depuis lequel j'exécute le script le dossier de conf sera toujours (est toujours) sur la racine du home.
Pour moi (mais mes souvenirs de programmeur VB amateur et autodidacte s'estomptent dans les brumes de l'oubli) le problème se situe sur les lignes de ce genre :

<action>'./$SCRIPT' --gtk "GET_VIDEO" "$VIDEO" & sleep 2</action>

Tant qu'il n'y aura rien d'autre que l'indication de la racine (./) rien ne changera.
Il me semble qu'il faudrait une variable quelconque prenant en charge le choix du dossier par l'utilisateur. C'est le cas (je n'ai pas cherché comment c'est codé) pour le dossier de stockage des vidéos où ça fonctionne très bien et si j'atoute Applications tel que

<action>'./Applications/$SCRIPT' --gtk "GET_VIDEO" "$VIDEO" & sleep 2</action>

tout est OK.
Si je m'égare indique-moi précisément la marche à suivre pour le test.

Et en ce qui concerne les barres de progression il suffirait juste que tu enlèves les KB/s et MB/s pour que je sois content.

#53 Le 19/02/2009, à 16:07

redisded

Re : get-canal, le retour...

AnsuzPeorth a écrit :

Tu connais le poids du fichier téléchargé au depart ? Si oui, c'est juste une histoire de calcul (finalement, les maths qu'on nous a obligé à apprendre, nous sert un peu...!)

Perso, je ne m'embeterais pas avec les progress, j'indiquerais juste le nom et le poids du fichier (refresh 5s par exemple). Je trouve gourmand en ressource juste pour afficher une progress....Enfin, c'est juste mon avis smile

Je ne connais pas la taille du flux à l'avance, peut-ete y'a t-il moyen de le récupérer.
Sinon, c'est vrai que les barres de progressions sont gourmandes, mais j'aime bien le concept alors je vais quand meme essayer d'optimiser cela. Maintenant si vous trouvez vraiment le script trop lourd en ressources on peu essayer de faire sans . C'est jute ton avis mais il m'interesse autant que les autres. wink

@ Lancelin :

Le lancemant  dans la balise action ne devrait pas poser de pb puisque la notation ./scripts.sh, sert à lancer le script "script.sh" à partir du dossier courant. Au début du script, une variable $SCRIPT est initialisée avec le nom du script.
La ligne dont tu nous parle signifie donc : lancer le script $script qui se trouve dans le dossier courant.
Cela ne devrait donc pas (à priori) poser de pb si tu déplace ou renomme le script. En revanche, c'est ce qui fait que tu ne peut pas lancer le script par son chemin absolu.
Cependant, afin d'éliminer une nouvelle hypothèse, j'ai fait quelques modifs pour forcer le script à toujours s'apeller par son chemin absolu.
Comme je ne suis pas sur que cela reglera le pb, je ne voudrais pas publier une mise à jour juste pour ca. pourrait-tu donc stp faire le test directement en remplacant TOUT le contenu de ton script par ceci :

#!/bin/bash
############################################################################################################################################################
# Script de téléchargements des emissions réccurentes de Canal +.				   
# Ce script utilise les flux rss du site http://www.vosflux.tv/site/ pour l'indexation des vidéos. 
#												   
# Ce script est un logiciel libre ; vous pouvez le redistribuer et/ou le modifier selon les	   
# termes de la Licence Publique Générale GNU ( GNU GPL ) publiée par la Free Software  Foundation.  
#												   
#							       				    #												   
#											Redisded   
#				Historique des versions : 					   
# - Version 0.3 (18/02/09)
#	Ajout de quelques émissions recemment apparues sur le site www.vosflux.tv.									   
#	Ajout d'une gestion de la fréquence de rafraichissement des barres de progression pour moduler la charge cpu.
#	Correction d'un bug dans la configuration.						   
#	Correction d'un bug empêchant le renommage du script.
#	Affichage de la dernière liste des videos affichées au lancement du script.					   
#	Légère modification de l'interface principale.						   
#	Correction orthographique.								   
# - Version 0.2 (17/02/09)									   
#	Modification des barres de chargements pour atténuer une surcharge cpu.			   
# - Version 0.1 (16/02/09)									   
#	Version originale. Permet le téléchargement des vidéos de chaque emission.    		   
#												   
############################################################################################################################################################


##### Déclaration des variables. #####
# Déclaration du numéro de version du script.
export VERSION="0.3"
# Déclaration du dossier contenant le script
export DIR=$(dirname $0)
# Déclaration du nom du script.
export SCRIPT=$(basename $0)
# Emplacement du dossier de configuration
export CONF_DIR="/home/"$USER"/.get-canal.conf"
# Emplacement du dossier temporaire.
export TEMP_DIR="/tmp/get-canal.tmp"
# Déclaration de la variable servant à gérer les numéros des téléchargements dans la file d'attente.
export DL_NUM="1"
# Déclaration du répertoire de téléchargement des vidéos.
export DOWNLOAD_DIR="$(grep DOWNLOAD_DIR= $CONF_DIR/get-canal.cfg | cut -d"=" -f2)"
# Déclaration du player vidéo.
export VIDEO_PLAYER="$(grep VIDEO_PLAYER= $CONF_DIR/get-canal.cfg | cut -d"=" -f2)"
# Déclaration du popup apparaissant pendant les temps de chargements.
export  POPUP='
<window window_position="1" decorated="false" skip_taskbar_hint="true">
  <vbox>
    <text>
      <input>echo "$MESS"</input>
    </text>
  </vbox>
</window>
'
# Déclaration de l'en-tête de la playlist.
TEXT_PLAYLIST="[playlist]"

##### Déclaration des fonctions utilisées par gtkdialog. #####
# Fonction de gestion des numéros des vidéos dans la file d'attente des téléchargements.
NB_PROGRESSBAR () {
while true ; do
	if grep -q $DL_NUM $TEMP_DIR/progress_bar.list ; then
		DL_NUM=$(( $DL_NUM + 1 ))
	else
		break
	fi
done
echo $DL_NUM
}

# Fonction d'affichage de la liste des vidéos pour l'emission choisie par l'utilisateur.
SHOW_LIST () {
export MESS="Chargement de la liste des vidéos. Veuillez patientez..." ; gtkdialog --program=POPUP & pid=$!
if [ -f "$TEMP_DIR/index.$1" ] ; then
	kill -9 $pid ; exit 0
fi
STREAM_URL="http://www.vosflux.tv/emission/$1/rss"
wget -v "$STREAM_URL" -O - | iconv -f ISO-8859-15 -t UTF-8 >"$TEMP_DIR/index.$1"
TITRES="$(sed -e 's/></\n/g' -e 's/</>/g' "$TEMP_DIR/index.$1" | grep "title" | sed '1d' | cut -d">" -f2)"
DATES="$(sed -e 's/></\n/g' "$TEMP_DIR/index.$1" | grep "url=" | cut -d"\"" -f2 | sed -e '/_AUTO_/s/.*\(..\)\(..\)\(..\)_AUTO_.*/\3-\2-\1/g' -e '/_CAN_/s/.*\(..\)\(..\)\(..\)_CAN_.*/\3-\2-\1/g')"
VIDEOS="$(sed -e 's/></\n/g' "$TEMP_DIR/index.$1" | grep "url=" | cut -d"\"" -f2)"
echo -e $TITRES

i="1"
n=$(echo -e "$TITRES" | wc -l)
while [ "$i" -le "$n" ] ; do
	echo "$(echo "$TITRES" | head -$i | tail -1)|$(echo -e "$DATES" | head -$i | tail -1)|$(echo -e "$VIDEOS" | head -$i | tail -1)"  >>$TEMP_DIR/videos.$1
	i=$(( $i + 1 ))
done
kill -9 $pid
}

# Fonction de téléchargement de la vidéo sélectionnée.
GET_VIDEO () {
export MESS="Lancement du téléchargement..." ; gtkdialog --program=POPUP & pid=$!
NB_PROGRESSBAR
sleep 1
if [ "$DL_NUM" -gt "10" ] ; then
	kill -9 $pid
	notify-send -t 3000 -i stop "Impossible de lancer plus de 10 téléchargements simultanés"
	tmp_list=$(grep -v "next=" $TEMP_DIR/progress_bar.list)
	echo -e "$tmp_list" >$TEMP_DIR/progress_bar.list
else
	ID=$(head -1 "$TEMP_DIR/show_list" | sed -e 's/.*(\(.*\))/\1/g')
	TITRE_TEMP=$(grep "$1" "$TEMP_DIR/videos.$ID" | cut -d"|" -f1 | sed -e 's/ /_/g')
	DATE_DIFF=$(grep "$1" "$TEMP_DIR/videos.$ID" | cut -d"|" -f2)
	TITRE="$TITRE_TEMP"_"$DATE_DIFF.flv"
	echo "$DL_NUM" >>$TEMP_DIR/progress_bar.list
	echo "" >$TEMP_DIR/progress_bar$DL_NUM.log
	kill -9 $!
	wget -O "$TEMP_DIR/videos/$TITRE" "$1" 2>>$TEMP_DIR/progress_bar$DL_NUM.log & kill -9 $pid
	echo "TITRE=$TITRE" >$TEMP_DIR/progress_bar$DL_NUM.log
	tmp_list=$(grep -v "next=" $TEMP_DIR/progress_bar.list)
	echo -e "$tmp_list" >$TEMP_DIR/progress_bar.list
	while ps aux | tr -s ' ' | cut -d" " -f2 | grep $! ; do
		sleep $(grep REFRESH_DELAY= $CONF_DIR/get-canal.cfg | cut -d"=" -f2)
	done
	#sleep 1
	if [ -f "$TEMP_DIR/videos/$TITRE" ] ; then
		notify-send -t 3000 -i info "Téléchargement terminé : $TITRE" & echo -e ". . . . . . . 100\nTITRE=$TITRE" >$TEMP_DIR/progress_bar$DL_NUM.log
	fi
fi
}

# Fonction de sauvegarde de la vidéo sélectionnée.
SAVE_FILE () {
titre=$(grep TITRE= $TEMP_DIR/progress_bar$1.log | cut -d"=" -f2)
if [ "$titre" = "" ] ; then
	export MESS="Aucune vidéo à sauvegarder !" ; gtkdialog --program=POPUP & sleep 3 ; kill -9 $!
elif ps aux | grep "wget -O /tmp/get-canal.tmp/videos/$titre" | grep -v "grep" ; then
	export MESS="Veuillez attendre la fin du téléchargement !" ; gtkdialog --program=POPUP & sleep 3 ; kill -9 $!
elif [ -f "$DOWNLOAD_DIR"/"$titre" ] ; then
	notify-send -t 3000 -i stop "L'émission $titre à déja été sauvegardée !"
else
	mv "$TEMP_DIR/videos/$titre" "$DOWNLOAD_DIR/$titre" && notify-send -t 3000 -i "filesave" "Emission sauvegardée : $titre" || notify-send -t 3000 -i stop "Impossible de sauvegarder la vidéo : $titre"
fi
}

# Fonction servant à enlever la vidéo sélectionnée de la liste des téléchargements.
DELETE_FILE () {
titre=$(grep TITRE= $TEMP_DIR/progress_bar$1.log | cut -d"=" -f2)
if [ "$titre" = "" ] ; then
	export MESS="Aucune vidéo à supprimer !" ; gtkdialog --program=POPUP & sleep 3 ; kill -9 $!
elif ps aux | grep "wget -O /tmp/get-canal.tmp/videos/$titre" | grep -v "grep" ; then
	kill -9 $(ps aux | grep "wget -O /tmp/get-canal.tmp/videos/$titre" | grep -v "grep" | tr -s ' ' |cut -d " " -f2)
	progress_bar_list=$(grep -v "$1" $TEMP_DIR/progress_bar.list)
	echo -e "$progress_bar_list" >$TEMP_DIR/progress_bar.list ; echo "0" >$TEMP_DIR/progress_bar$1.log
	rm -f "$TEMP_DIR/videos/$titre" && notify-send -t 3000 -i stop "Téléchargement annulé : $titre"
else
	progress_bar_list=$(grep -v "$1" $TEMP_DIR/progress_bar.list)
	echo -e "$progress_bar_list" >$TEMP_DIR/progress_bar.list ; echo "0" >$TEMP_DIR/progress_bar$1.log
fi
}

# Fonction d'affichage des barres de progression.
PROGRESS_BAR () {
while true ; do
	if head -1 $TEMP_DIR/progress_bar$1.log | grep -q ^0$ ; then
		echo 0  ; echo " " ; sleep $(grep REFRESH_DELAY= $CONF_DIR/get-canal.cfg | cut -d"=" -f2)
	elif head -1 $TEMP_DIR/progress_bar$1.log | grep -q ". . . . . . . 100" ; then
		echo 100
		echo $(grep TITRE= $TEMP_DIR/progress_bar$1.log | cut -d"=" -f2) : Terminé
		sleep $(grep REFRESH_DELAY= $CONF_DIR/get-canal.cfg | cut -d"=" -f2)
	else
		echo $(tail -2 $TEMP_DIR/progress_bar$1.log | head -1 | sed 's/^[ \t]*//' | tr -s " " | cut -d" " -f7 | grep -v [[:alpha:]] | sed -e 's/%//g' -e 's/»/100/g')
		echo $(grep TITRE= $TEMP_DIR/progress_bar$1.log | cut -d"=" -f2) : $(tail -2 $TEMP_DIR/progress_bar$1.log | head -1 | sed 's/^[ \t]*//' | tr -s ' ' | cut -d" " -f9 | sed -e 's/\[.*\]/Terminé/g')
	sleep $(grep REFRESH_DELAY= $CONF_DIR/get-canal.cfg | cut -d"=" -f2)
	fi
done
}

# Fonction de modification de la playlist
ADD_PLAYLIST () {
titre=$(grep "TITRE=" "$TEMP_DIR/progress_bar$1.log" | cut -d"=" -f2)
if [ "$titre" = "" ] ; then
	export MESS="Aucune vidéo à ajouter !" ; gtkdialog --program=POPUP & sleep 3 ; kill -9 $!
elif ps aux | grep "wget -O /tmp/get-canal.tmp/videos/$titre" | grep -v "grep" ; then
	export MESS="Veuillez attendre la fin du téléchargement !" ; gtkdialog --program=POPUP & sleep 3 ; kill -9 $!
elif cat $TEMP_DIR/playlist.pls | grep "$titre" ; then
	notify-send -t 3000 -i stop "L'émission $titre est déja présente dans votre playlist !"
else
	n=$(head -1 "/$TEMP_DIR/playlist.id")
	n=$(($n+1))
	echo "$n" >"/$TEMP_DIR/playlist.id"
	if [ -f "$TEMP_DIR/videos/$titre" ] ; then
		echo "$n=$TEMP_DIR/videos/$titre" >>/$TEMP_DIR/playlist.info
	elif [ -f "$DOWNLOAD_DIR/$titre" ] ; then
		echo "$n=$DOWNLOAD_DIR/videos/$titre" >>/$TEMP_DIR/playlist.info
	else
		notify-send "La video $titre est introuvable ! Veuillez la re-télécharger."
	fi
	echo "$TEXT_PLAYLIST" >$TEMP_DIR/playlist.pls
	cat "/$TEMP_DIR/playlist.info" | while read line ; do
		echo "File$(echo $line | cut -d"=" -f1)=file://$(echo $line | cut -d"=" -f2)" >>$TEMP_DIR/playlist.pls
	done
fi
}

##### Lecture des arguments passés au script et lancement des fonctions gtkdialog si argument -g ou --gtk passé au script. #####
if [ "$1" != "" ] ; then
	while getopts "gh-:" option ; do
		if [ "$option" = "-" ] ; then
			case $OPTARG in
				gtk)
					option=g
					;;
				help)
					option=h	
					;;
				*)
					echo "$OPTARG : option inconnue." ; echo "$MAN" ; exit 2
					;;
			esac
		fi
		case $option in
			g)
				shift ; $1 "$2" ; exit 0
				;;
			h)
				zenity --info --title="$0" --text="$options" ; exit 0
				;;
			?)
				echo "$option : option inconnue." ; echo "$MAN" ; exit 2
				;;
		esac
	done
fi


##### Déclaration des fenêtres gtkdialog. #####
# Déclaration de la fenêtre configuration.
export MAIN_CONFIG='
<window title="Configuration de '$SCRIPT'" window_position="1">
  <vbox>
    <frame Répertoire de téléchargement des fichiers>
      <hbox>
        <entry accept="directory" activates_default="true">
          <label>Choisissez un répertoire</label>
          <default>'$PWD'</default>          
          <variable>FILE_DIRECTORY</variable>
        </entry>
        <button>
          <input file stock="gtk-open"></input>
          <action type="fileselect">FILE_DIRECTORY</action>
        </button>
      </hbox>
    </frame>
    <frame Lecteur vidéo préféré>
      <combobox case-sensitive="false" value-in-list="true">
        <variable>VIDEO_PLAYER</variable>
        <item>kaffeine</item>
        <item>mplayer</item>
        <item>totem</item>
        <item>vlc</item>
        <item>xine</item>
      </combobox>
    </frame>
    <hbox>
      <button ok></button>
      <button cancel></button>
    </hbox>
  </vbox>
</window>
'

# Déclaration de la fenêtre principale.
export MAIN_PROGRAMM='
<window title="'$SCRIPT'" window_position="1">
  <vbox>
    <notebook labels="Principal|Téléchargements automatiques|Options">
      <hbox>
        <vbox>
          <text wrap="true" width-chars="32" use_markup="true">
            <label>Choisissez une émission puis cliquez sur la loupe.</label>
          </text>
          <combobox case-sensitive="false" value-in-list="true">
            <item>+ Clair (226)</item>
            <item>Action discrète (594)</item>
            <item>Canal presque (593)</item>
            <item>Chris Esquerre (230)</item>
            <item>Dimanche+ (228)</item>
            <item>Groland magzine (45)</item>
            <item>L'\''édition spéciale (229)</item>
            <item>L'\''effet papillon (13)</item>
            <item>La boite à question (44)</item>
            <item>La matinale (227)</item>
            <item>La semaine de Guillon (595)</item>
            <item>Le buzz du jour (47)</item>
            <item>Le grand journal (14)</item>
            <item>Le meilleur du hier (48)</item>
            <item>Le petit journal actu (43)</item>
            <item>Le petit journal people (42)</item>
            <item>Le zapping (46)</item>
            <item>Les bonus de Guillaume (592)</item>
            <item>Les guignols (36)</item>
            <item>Pépites sur le net (41)</item>
            <item>Salut les terriens! (12)</item>
            <item>SAV des emissions (40)</item>
            <item>Têtes à claques (231)</item>
            <variable>EMISSION</variable>
          </combobox>
          <button>
            <input file icon="gtk-find"></input>
            <action>echo "$EMISSION" >$TEMP_DIR/show_list ; sed -i "/EMISSION/s/=.*/=$EMISSION/g" $CONF_DIR/get-canal.cfg ; '$DIR/$SCRIPT' --gtk "SHOW_LIST" "$(echo "$EMISSION" | sed -e '\''s/.*(\(.*\))/\1/g'\'')"</action>
            <action type="refresh">VIDEO</action>
          </button>
          <text wrap="true" width-chars="32" use_markup="true">
            <label>"  Double-cliquez sur une vidéo pour la télécharger."</label>
          </text>
          <tree headers_visible="false" exported_column="2">
            <label>          Titre          | Date | Adresse de la vidéo </label>
            <input>cat $TEMP_DIR/videos.$(head -1 "$TEMP_DIR/show_list" | sed -e '\''s/.*(\(.*\))/\1/g'\'')</input>
            <variable>VIDEO</variable>
            <action>'$DIR/$SCRIPT' --gtk "GET_VIDEO" "$VIDEO" & sleep 2</action>
          </tree>
        </vbox>
        <frame Téléchargements>
          <hbox>
            <progressbar>
              <input>'$DIR/$SCRIPT' --gtk "PROGRESS_BAR" "1"</input>
            </progressbar>
            <button>
              <input file icon="filesave"></input>
              <action>'$DIR/$SCRIPT' --gtk "SAVE_FILE" "1"</action>
            </button>
            <button sensitive="true">
              <input file icon="redo"></input>
              <action>'$DIR/$SCRIPT' --gtk "ADD_PLAYLIST" "1"</action>
              <action type="refresh">PLAYLIST</action>
            </button>
            <button>
              <input file icon="stop"></input>
              <action>'$DIR/$SCRIPT' --gtk "DELETE_FILE" "1"</action>
            </button>
          </hbox>
          <hbox>
            <progressbar>
              <input>'$DIR/$SCRIPT' --gtk "PROGRESS_BAR" "2"</input>
            </progressbar>
            <button>
              <input file icon="filesave"></input>
              <action>'$DIR/$SCRIPT' --gtk "SAVE_FILE" "2"</action>
            </button>
            <button sensitive="false">
              <input file icon="redo"></input>
              <action>OK</action>
            </button>
            <button>
              <input file icon="stop"></input>
              <action>'$DIR/$SCRIPT' --gtk "DELETE_FILE" "2"</action>
            </button>
          </hbox>
          <hbox>
            <progressbar>
              <input>'$DIR/$SCRIPT' --gtk "PROGRESS_BAR" "3"</input>
            </progressbar>
            <button>
              <input file icon="filesave"></input>
              <action>'$DIR/$SCRIPT' --gtk "SAVE_FILE" "3"</action>
            </button>
            <button sensitive="false">
              <input file icon="redo"></input>
              <action>OK</action>
            </button>
            <button>
              <input file icon="stop"></input>
              <action>'$DIR/$SCRIPT' --gtk "DELETE_FILE" "3"</action>
          </button>
          </hbox>
          <hbox>
            <progressbar>
              <input>'$DIR/$SCRIPT' --gtk "PROGRESS_BAR" "4"</input>
            </progressbar>
            <button>
              <input file icon="filesave"></input>
              <action>'$DIR/$SCRIPT' --gtk "SAVE_FILE" "4"</action>
            </button>
            <button sensitive="false">
              <input file icon="redo"></input>
              <action>OK</action>
            </button>
            <button>
              <input file icon="stop"></input>
              <action>'$DIR/$SCRIPT' --gtk "DELETE_FILE" "4"</action>
            </button>
          </hbox>
          <hbox>
            <progressbar>
              <input>'$DIR/$SCRIPT' --gtk "PROGRESS_BAR" "5"</input>
            </progressbar>
          <button>
             <input file icon="filesave"></input>
              <action>'$DIR/$SCRIPT' --gtk "SAVE_FILE" "5"</action>
            </button>
            <button sensitive="false">
              <input file icon="redo"></input>
              <action>OK</action>
            </button>
            <button>
              <input file icon="stop"></input>
              <action>'$DIR/$SCRIPT' --gtk "DELETE_FILE" "5"</action>
            </button>
          </hbox>
          <hbox>
            <progressbar>
              <input>'$DIR/$SCRIPT' --gtk "PROGRESS_BAR" "6"</input>
            </progressbar>
            <button>
              <input file icon="filesave"></input>
              <action>'$DIR/$SCRIPT' --gtk "SAVE_FILE" "6"</action>
            </button>
            <button sensitive="false">
              <input file icon="redo"></input>
              <action>OK</action>
            </button>
            <button>
              <input file icon="stop"></input>
              <action>'$DIR/$SCRIPT' --gtk "DELETE_FILE" "6"</action>
            </button>
          </hbox>
          <hbox>
            <progressbar>
              <input>'$DIR/$SCRIPT' --gtk "PROGRESS_BAR" "7"</input>
            </progressbar>
            <button>
              <input file icon="filesave"></input>
              <action>'$DIR/$SCRIPT' --gtk "SAVE_FILE" "7"</action>
            </button>
            <button sensitive="false">
              <input file icon="redo"></input>
              <action>OK</action>
            </button>
            <button>
              <input file icon="stop"></input>
              <action>'$DIR/$SCRIPT' --gtk "DELETE_FILE" "7"</action>
            </button>
          </hbox>
          <hbox>
            <progressbar>
              <input>'$DIR/$SCRIPT' --gtk "PROGRESS_BAR" "8"</input>
            </progressbar>
            <button>
              <input file icon="filesave"></input>
              <action>'$DIR/$SCRIPT' --gtk "SAVE_FILE" "8"</action>
            </button>
            <button sensitive="false">
              <input file icon="redo"></input>
              <action>OK</action>
            </button>
            <button>
              <input file icon="stop"></input>
              <action>'$DIR/$SCRIPT' --gtk "DELETE_FILE" "8"</action>
          </button>
          </hbox>
          <hbox>
            <progressbar>
              <input>'$DIR/$SCRIPT' --gtk "PROGRESS_BAR" "9"</input>
            </progressbar>
            <button>
              <input file icon="filesave"></input>
              <action>'$DIR/$SCRIPT' --gtk "SAVE_FILE" "9"</action>
            </button>
            <button sensitive="false">
              <input file icon="redo"></input>
              <action>OK</action>
            </button>
            <button>
              <input file icon="stop"></input>
              <action>'$DIR/$SCRIPT' --gtk "DELETE_FILE" "9"</action>
            </button>
          </hbox>
          <hbox>
            <progressbar>
              <input>'$DIR/$SCRIPT' --gtk "PROGRESS_BAR" "10"</input>
            </progressbar>
            <button>
              <input file icon="filesave"></input>
              <action>'$DIR/$SCRIPT' --gtk "SAVE_FILE" "10"</action>
            </button>
            <button sensitive="false">
              <input file icon="redo"></input>
              <action>OK</action>
            </button>
            <button>
              <input file icon="stop"></input>
              <action>'$DIR/$SCRIPT' --gtk "DELETE_FILE" "10"</action>
            </button>
          </hbox>
          <hbox>
            <text>
              <input>echo "Raffraichir les barres toutes les"</input>
            </text>
            <text>
              <input>grep REFRESH_DELAY= $CONF_DIR/get-canal.cfg | cut -d"=" -f2</input>
              <variable>REFRESH_DELAY</variable>
            </text>
            <text>
              <input>echo "secondes"</input>
            </text>
          </hbox>
          <hbox>
            <button>
              <input file icon="gtk-remove"></input>
              <action>REFRESH_DELAY=$(grep REFRESH_DELAY= $CONF_DIR/get-canal.cfg | cut -d"=" -f2) ; if [ "$REFRESH_DELAY" -gt "1" ] ; then RD=$(($REFRESH_DELAY-1)) ; sed -i "/REFRESH_DELAY=/s/=.*/=$RD/g" $CONF_DIR/get-canal.cfg ; fi</action>
              <action type="refresh">REFRESH_DELAY</action>
            </button>
            <button>
              <input file icon="gtk-add"></input>
              <action>REFRESH_DELAY=$(grep REFRESH_DELAY= $CONF_DIR/get-canal.cfg | cut -d"=" -f2) ; if [ "$REFRESH_DELAY" -lt "5" ] ; then RD=$(($REFRESH_DELAY+1)) ; sed -i "/REFRESH_DELAY=/s/=.*/=$RD/g" $CONF_DIR/get-canal.cfg ; fi</action>
              <action type="refresh">REFRESH_DELAY</action>
            </button>
          </hbox>
        </frame>
        <frame Playlist>
          <tree headers_visible="false">
            <width>300</width><height>250</height>
            <label>Titre</label>
            <input>cat $TEMP_DIR/playlist.info</input>
            <variable>PLAYLIST</variable>
          </tree>
        </frame>
      </hbox>
    </notebook>
    <hbox>
      <button>
        <input file icon="exit"></input>
        <label>Quitter</label>
        <action type="exit">OK</action>
      </button>
    </hbox>
  </vbox>
</window>
'
##### Execution du script. #####
# Vérification de l'existance d'un dossier de configuration et lancement éventuel de la fenêtre de configuration.
if [ ! -d "$CONF_DIR" ] ; then
	mkdir "$CONF_DIR"
	echo "REFRESH_DELAY=1" >>$CONF_DIR/get-canal.cfg
	VARIABLES=`gtkdialog --program=MAIN_CONFIG`
	eval $VARIABLES
	if [ "$EXIT" != "OK" ] ; then
		exit 1
	fi
	if grep "DOWNLOAD_DIR=" $CONF_DIR/get-canal.cfg ; then
		config=$(grep -v "DOWNLOAD_DIR=" $CONF_DIR/get-canal.cfg)
		echo -e "$config\nDOWNLOAD_DIR=$FILE_DIRECTORY" >$CONF_DIR/get-canal.cfg
	else
		echo "DOWNLOAD_DIR=$FILE_DIRECTORY" >>$CONF_DIR/get-canal.cfg
	fi
	export DOWNLOAD_DIR="$FILE_DIRECTORY"
	if grep "VIDEO_PLAYER=" $CONF_DIR/get-canal.cfg ; then
		config=$(grep -v "VIDEO_PLAYER=" $CONF_DIR/get-canal.cfg)
		echo -e "$config\nVIDEO_PLAYER=$VIDEO_PLAYER" >$CONF_DIR/get-canal.cfg
	else
		echo "VIDEO_PLAYER=$VIDEO_PLAYER" >>$CONF_DIR/get-canal.cfg
	fi
else
	export DOWNLOAD_DIR="$(grep DOWNLOAD_DIR= $CONF_DIR/get-canal.cfg | cut -d"=" -f2)"
	export VIDEO_PLAYER="$(grep VIDEO_PLAYER= $CONF_DIR/get-canal.cfg | cut -d"=" -f2)"
	if [ "$DOWNLOAD_DIR" = "" ] || [ "$VIDEO_PLAYER" = "" ] ; then
		touch $CONF_DIR/get-canal.cfg
		VARIABLES=`gtkdialog --program=MAIN_CONFIG`
		eval $VARIABLES
		if [ "$EXIT" != "OK" ] ; then
			exit 1
		fi
		if grep "DOWNLOAD_DIR=" $CONF_DIR/get-canal.cfg ; then
			config=$(grep -v "DOWNLOAD_DIR=" $CONF_DIR/get-canal.cfg)
			echo -e "$config\nDOWNLOAD_DIR=$FILE_DIRECTORY" >$CONF_DIR/get-canal.cfg
		else
			echo "DOWNLOAD_DIR=$FILE_DIRECTORY" >>$CONF_DIR/get-canal.cfg
		fi
		export DOWNLOAD_DIR="$FILE_DIRECTORY"
		if grep "VIDEO_PLAYER=" $CONF_DIR/get-canal.cfg ; then
			config=$(grep -v "VIDEO_PLAYER=" $CONF_DIR/get-canal.cfg)
			echo -e "$config\nVIDEO_PLAYER=$VIDEO_PLAYER" >$CONF_DIR/get-canal.cfg
		else
			echo "VIDEO_PLAYER=$VIDEO_PLAYER" >>$CONF_DIR/get-canal.cfg
		fi
	fi
fi
if ! grep REFRESH_DELAY=. $CONF_DIR/get-canal.cfg ; then
	echo "REFRESH_DELAY=1" >>$CONF_DIR/get-canal.cfg
fi
if ! grep EMISSION=.* $CONF_DIR/get-canal.cfg ; then
	echo "EMISSION=\"+ Clair226\"" >>$CONF_DIR/get-canal.cfg
fi

# Préparation du dossier temporaire.
if [ ! -d "$TEMP_DIR" ] ; then
	mkdir -p $TEMP_DIR/videos
else 
	rm -rf $TEMP_DIR/* ; mkdir -p $TEMP_DIR/videos
fi
touch $TEMP_DIR/progress_bar.list
for i in $(seq 1 10) ; do
	echo "0" >$TEMP_DIR/progress_bar$i.log
done

echo "0" >/$TEMP_DIR/playlist.id
# Chargement de la liste de la dernière emission affichée.
SHOW_LIST $(grep EMISSION= $CONF_DIR/get-canal.cfg | cut -d"\"" -f2 | sed -e 's/.*(\(.*\))/\1/g')
echo $(grep EMISSION= $CONF_DIR/get-canal.cfg | cut -d"\"" -f2) >$TEMP_DIR/show_list

# Lancement de la fenêtre principale.
gtkdialog --program=MAIN_PROGRAMM

# Supression du dossier temporaire.
rm -rf "$TEMP_DIR"

# "Kill" des processus résiduels.
killall $(basename $SCRIPT)
for i in $(ps aux | grep "/tmp/get-canal.tmp/" | grep -v grep | tr -s ' ' | cut -d" " -f2) ; do
	kill -9 $i
done
exit 0

Sur cette version, je suis en train de bosser sur la playlist, il y a donc quelques petites modifs par rapport à la précédentes version, mais celles-ci ne sont pas encore fonctionnelles, donc, merci à toi de ne pas en tenir compte.

Et sinon, merci également de consacrer du temps au debuggage du script.

P.S :

Lancelin a écrit :

Et en ce qui concerne les barres de progression il suffirait juste que tu enlèves les KB/s et MB/s pour que je sois content.

En ce qui me concerne, il suffirait que le script fonctionne chez toi comme c'est prévu qu'il fonctionne pour que je soit content wink

Dernière modification par redisded (Le 19/02/2009, à 16:09)

Hors ligne

#54 Le 19/02/2009, à 17:26

Lancelin

Re : get-canal, le retour...

Ça marche !!!
Le chemin absolu, il me semblait bien qu'il devait exister quelque chose comme ça...
Et puisque maintenant tu dois être content, je le suis aussi (enfin quand il n'y aura plus les inutiles KB/s et MB/s wink) !

Et ce que je trouve bien dans ton script c'est la possibilité laissée à l'utilisateur de télécharger ce qu'il veut quand il veut.
Il me semble (j'ai la flemme de tout relire) que quelqu'un te proposait une sélection de vidéos avec un téléchargement automatique (comme le script de Ras'). Je ne serais pas forcément contre à condition que tu laisses également le choix de télécharger comme actuellement.

Dernière modification par Lancelin (Le 19/02/2009, à 17:41)

#55 Le 19/02/2009, à 18:06

redisded

Re : get-canal, le retour...

Lancelin a écrit :

Ça marche !!!
Le chemin absolu, il me semblait bien qu'il devait exister quelque chose comme ça...
Et puisque maintenant tu dois être content, je le suis aussi (enfin quand il n'y aura plus les inutiles KB/s et MB/s wink) !

Et ce que je trouve bien dans ton script c'est la possibilité laissée à l'utilisateur de turbocharger ce qu'il veut quand il veut.
Il me semble (j'ai la flemme de tout relire) que quelqu'un te proposait une sélection de vidéos avec un téléchargement automatique (comme le script de Ras'). Je ne serais pas forcément contre à condition que tu laisses également le choix de télécharger comme actuellement.

enfin une bonne nouvelle wink

Pour les progress_bar je continue mes recherches. Si d'autres rencontrent le pb, merci à eux de se manifester.

Pour ce qui est du téléchargement auto je pense que je rajouterai la possibilité de créer un évenement crontab qui va chercher tout les jours les vidéos trouvés pour les emissions qui seront séléctionnées par l'utilisateur.
Rassure-toi, la gui et la possibilité de télécharger les videos de son choix resteront. Je me suis pas battu avec gtkdialog pour dégager ca dans un mois wink

Pour les barres de progression, pourrait-tu stp faire les manips que j'ai demandées à Jhon_Wayne dans ce post : http://forum.ubuntu-fr.org/viewtopic.ph … 9#p2435599

(en fait fait suivre la procédure du début du post jusqu'au EDIT: et me poster le retour des commandes.)

Encore merci à toi de l'interet que tu porte au script.

EDIT : Bizzare, parce que si j'ai bien tout suivi, Utodeb avait le meme pb d'affichage sur les barres et mon correctif apporté post 42 (intégré au script que je vient de poster) semble avoir réglé le pb chez lui...
Utodeb, pourrait-tu me confirmer que j'ai bien tout suivi stp? roll

Dernière modification par redisded (Le 19/02/2009, à 18:16)

Hors ligne

#56 Le 19/02/2009, à 18:23

Lancelin

Re : get-canal, le retour...

Voili-voilou...

lancelin@lancelin-M40:~$ cat /tmp/get-canal.tmp/progress_bar1.log
TITRE=Salut_les_Terriens!_(1)_14-02-09.flv
82.96.58.33, 82.96.58.63
Connexion vers vod-flash.canalplus.fr|82.96.58.33|:80... connecté.
requête HTTP transmise, en attente de la réponse... 200 OK
Longueur: 76 962 047 (73M) [video/x-flv]

    0K .......... .......... .......... .......... ..........  0%   86.05 KB/s
   50K .......... .......... .......... .......... ..........  0%   45.78 KB/s
  100K .......... .......... .......... .......... ..........  0%  170.42 KB/s
  150K .......... .......... .......... .......... ..........  0%  215.05 KB/s
  200K .......... .......... .......... .......... ..........  0%  211.96 KB/s
  250K .......... .......... .......... .......... ..........  0%  264.84 KB/s
  300K .......... .......... .......... .......... ..........  0%  263.45 KB/s
  350K .......... .......... .......... .......... ..........  0%  287.57 KB/s
  400K .......... .......... .......... .......... ..........  0%  337.04 KB/s
  450K .......... .......... .......... .......... ..........  0%  282.65 KB/s
  500K .......... .......... .......... .......... ..........  0%  312.57 KB/s
  550K .......... .......... .......... .......... ..........  0%  352.26 KB/s
  600K .......... .......... .......... .......... ..........  0%  358.63 KB/s
  650K .......... .......... .......... .......... ..........  0%  361.87 KB/s
  700K .......... .......... .......... .......... ..........  0%  404.95 KB/s
  750K .......... .......... .......... .......... ..........  1%  351.82 KB/s
  800K .......... .......... .......... .......... ..........  1%  422.61 KB/s
  850K .......... .......... .......... .......... ..........  1%  407.41 KB/s
  900K .......... .......... .......... .......... ..........  1%  399.58 KB/s
  950K .......... .......... .......... .......... ..........  1%  393.97 KB/s
 1000K .......... .......... .......... .......... ..........  1%  477.39 KB/s
 1050K .......... .......... .......... .......... ..........  1%  420.26 KB/s
 1100K .......... .......... .......... .......... ..........  1%  484.33 KB/s
 1150K .......... .......... .......... .......... ..........  1%  484.49 KB/s
 1200K .......... .......... .......... .......... ..........  1%  499.67 KB/s
 1250K .......... .......... .......... .......... ..........  1%  486.30 KB/s
 1300K .......... .......... .......... .......... ..........  1%  488.34 KB/s
 1350K .......... .......... .......... .......... ..........  1%  521.59 KB/s
 1400K .......... .......... .......... .......... ..........  1%  495.41 KB/s
 1450K .......... .......... .......... .......... ..........  1%  514.19 KB/s
 1500K .......... .......... .......... .......... ..........  2%  510.01 KB/s
 1550K .......... .......... .......... .......... ..........  2%  514.96 KB/s
 1600K .......... .......... .......... .......... ..........  2%  590.91 KB/s
 1650K .......... .......... .......... .......... ..........  2%  529.68 KB/s
 1700K .......... .......... .......... .......... ..........  2%  591.49 KB/s
 1750K .......... .......... .......... .......... ..........  2%  532.26 KB/s
 1800K .......... .......... .......... .......... ..........  2%  580.72 KB/s
 1850K .......... .......... .......... .......... ..........  2%  615.64 KB/s
 1900K .......... .......... .......... .......... ..........  2%  528.90 KB/s
 1950K .......... .......... .......... .......... ..........  2%  635.42 KB/s
 2000K .......... .......... .......... .......... ..........  2%  614.97 KB/s
 2050K .......... .......... .......... .......... ..........  2%  586.71 KB/s
 2100K .......... .......... .......... .......... ..........  2%  620.79 KB/s
 2150K .......... .......... .......... .......... ..........  2%  605.08 KB/s
 2200K .......... .......... .......... .......... ..........  2%  292.36 KB/s
 2250K .......... .......... .......... .......... ..........  3%  121.53 MB/s
 2300K .......... .......... .......... .......... ..........  3%   86.43 KB/s
 2350K .......... .......... .......... .......... ..........  3%  177.13 KB/s
 2400K .......... .......... .......... .......... ..........  3%  185.34 KB/s
 2450K .......... .......... .......... .......... ..........  3%  233.47 KB/s
 2500K .......... .......... .......... .......... ..........  3%  244.33 KB/s
 2550K .......... .......... .......... .......... ..........  3%  257.46 KB/s
 2600K .......... .......... .......... .......... ..........  3%  297.68 KB/s
 2650K .......... .......... .......... .......... ..........  3%  281.74 KB/s
 2700K .......... .......... .......... .......... ..........  3%  333.30 KB/s
 2750K .......... .......... .......... .......... ..........  3%  305.59 KB/s
 2800K .......... .......... .......... .......... ..........  3%  338.16 KB/s
 2850K .......... .......... .......... .......... ..........  3%  341.48 KB/s
 2900K .......... .......... .......... .......... ..........  3%  389.00 KB/s
 2950K .......... .......... .......... .......... ..........  3%  344.00 KB/s
 3000K .......... .......... .......... .......... ..........  4%  401.04 KB/s
 3050K .......... .......... .......... .......... ..........  4%  350.59 KB/s
 3100K .......... .......... .......... .......... ..........  4%  415.60 KB/s
 3150K .......... .......... .......... .......... ..........  4%  418.50 KB/s
 3200K .......... .......... .......... .......... ..........  4%  406.32 KB/s
 3250K .......... .......... .......... .......... ..........  4%  416.98 KB/s
 3300K .......... .......... .......... .......... ..........  4%  419.96 KB/s
 3350K .......... .......... .......... .......... ..........  4%  437.48 KB/s
 3400K .......... .......... .......... .......... ..........  4%  471.86 KB/s
 3450K .......... .......... .......... .......... ..........  4%  506.69 KB/s
 3500K .......... .......... .......... .......... ..........  4%  431.90 KB/s
 3550K .......... .......... .......... .......... ..........  4%  495.57 KB/s
 3600K .......... .......... .......... .......... ..........  4%  431.49 KB/s
 3650K .......... .......... .......... .......... ..........  4%  522.33 KB/s
 3700K .......... .......... .......... .......... ..........  4%  511.42 KB/s
 3750K .......... .......... .......... .......... ..........  5%  535.01 KB/s
 3800K .......... .......... .......... .......... ..........  5%  477.36 KB/s
 3850K .......... .......... .......... .......... ..........  5%  534.13 KB/s
 3900K .......... .......... .......... .......... ..........  5%  522.85 KB/s
 3950K .......... .......... .......... .......... ..........  5%  538.80 KB/s
 4000K .......... .......... .......... .......... ..........  5%  537.75 KB/s
 4050K .......... .......... .......... .......... ..........  5%  543.83 KB/s
 4100K .......... .......... .......... .......... ..........  5%  608.01 KB/s
 4150K .......... .......... .......... .......... ..........  5%  581.48 KB/s
 4200K .......... .......... .......... .......... ..........  5%  578.93 KB/s
 4250K .......... .......... .......... .......... ..........  5%  617.60 KB/s
 4300K .......... .......... .......... .......... ..........  5%  665.22 KB/s
 4350K .......... .......... .......... .......... ..........  5%  595.04 KB/s
 4400K .......... .......... .......... .......... ..........  5%  637.96 KB/s
 4450K .......... .......... .......... .......... ..........  5%  624.66 KB/s
 4500K .......... .......... .......... .......... ..........  6%  626.46 KB/s
 4550K .......... .......... .......... .......... ..........  6%  658.82 KB/s
 4600K .......... .......... .......... .......... ..........  6%  649.30 KB/s
 4650K .......... .......... .......... .......... ..........  6%  651.34 KB/s
 4700K .......... .......... .......... .......... ..........  6%  299.32 KB/s
 4750K .......... .......... .......... .......... ..........  6%  114.76 MB/s
 4800K .......... .......... .......... .......... ..........  6%  126.81 KB/s
 4850K .......... .......... .......... .......... ..........  6%  132.38 KB/s
 4900K .......... .......... .......... .......... ..........  6%  264.55 KB/s
 4950K .......... .......... .......... .......... ..........  6%  198.10 KB/s
 5000K .......... .......... .......... .......... ..........  6%  211.91 KB/s
 5050K .......... .......... .......... .......... ..........  6%  197.21 KB/s
 5100K .......... .......... .......... .......... .....lancelin@lancelin-M40:~$ bash -x get-canal.sh --gtk "PROGRESS_BAR" "1"
bash: get-canal.sh: Aucun fichier ou dossier de ce type
lancelin@lancelin-M40:~$ bash -x /home/lancelin/Applications/get-canal.sh --gtk "PROGRESS_BAR" "1"
+ export VERSION=0.3
+ VERSION=0.3
++ dirname /home/lancelin/Applications/get-canal.sh
+ export DIR=/home/lancelin/Applications
+ DIR=/home/lancelin/Applications
++ basename /home/lancelin/Applications/get-canal.sh
+ export SCRIPT=get-canal.sh
+ SCRIPT=get-canal.sh
+ export CONF_DIR=/home/lancelin/.get-canal.conf
+ CONF_DIR=/home/lancelin/.get-canal.conf
+ export TEMP_DIR=/tmp/get-canal.tmp
+ TEMP_DIR=/tmp/get-canal.tmp
+ export DL_NUM=1
+ DL_NUM=1
++ grep DOWNLOAD_DIR= /home/lancelin/.get-canal.conf/get-canal.cfg
++ cut -d= -f2
+ export DOWNLOAD_DIR=/home/lancelin/Applications/Canal
+ DOWNLOAD_DIR=/home/lancelin/Applications/Canal
++ grep VIDEO_PLAYER= /home/lancelin/.get-canal.conf/get-canal.cfg
++ cut -d= -f2
+ export VIDEO_PLAYER=totem
+ VIDEO_PLAYER=totem
+ export 'POPUP=
<window window_position="1" decorated="false" skip_taskbar_hint="true">
  <vbox>
    <text>
      <input>echo "$MESS"</input>
    </text>
  </vbox>
</window>
'
+ POPUP='
<window window_position="1" decorated="false" skip_taskbar_hint="true">
  <vbox>
    <text>
      <input>echo "$MESS"</input>
    </text>
  </vbox>
</window>
'
+ TEXT_PLAYLIST='[playlist]'
+ '[' --gtk '!=' '' ']'
+ getopts gh-: option
+ '[' - = - ']'
+ case $OPTARG in
+ option=g
+ case $option in
+ shift
+ PROGRESS_BAR 1
+ true
+ head -1 /tmp/get-canal.tmp/progress_bar1.log
+ grep -q '^0$'
+ head -1 /tmp/get-canal.tmp/progress_bar1.log
+ grep -q '. . . . . . . 100'
++ tail -2 /tmp/get-canal.tmp/progress_bar1.log
++ head -1
++ sed 's/^[ \t]*//'
++ tr -s ' '
++ cut '-d ' -f7
++ grep -v '[[:alpha:]]'
++ sed -e s/%//g -e $'s/\302\273/100/g'
+ echo 65
65
++ grep TITRE= /tmp/get-canal.tmp/progress_bar1.log
++ cut -d= -f2
++ tail -2 /tmp/get-canal.tmp/progress_bar1.log
++ head -1
++ sed 's/^[ \t]*//'
++ tr -s ' '
++ cut '-d ' -f9
++ sed -e 's/\[.*\]/Terminé/g'
+ echo 'Salut_les_Terriens!_(1)_14-02-09.flv' : KB/s
Salut_les_Terriens!_(1)_14-02-09.flv : KB/s
++ grep REFRESH_DELAY= /home/lancelin/.get-canal.conf/get-canal.cfg
++ cut -d= -f2
+ sleep 1
+ true
+ head -1 /tmp/get-canal.tmp/progress_bar1.log
+ grep -q '^0$'
+ head -1 /tmp/get-canal.tmp/progress_bar1.log
+ grep -q '. . . . . . . 100'
++ tail -2 /tmp/get-canal.tmp/progress_bar1.log
++ head -1
++ sed 's/^[ \t]*//'
++ tr -s ' '
++ cut '-d ' -f7
++ grep -v '[[:alpha:]]'
++ sed -e s/%//g -e $'s/\302\273/100/g'
+ echo 65
65
++ grep TITRE= /tmp/get-canal.tmp/progress_bar1.log
++ cut -d= -f2
++ tail -2 /tmp/get-canal.tmp/progress_bar1.log
++ head -1
++ sed 's/^[ \t]*//'
++ tr -s ' '
++ cut '-d ' -f9
++ sed -e 's/\[.*\]/Terminé/g'
+ echo 'Salut_les_Terriens!_(1)_14-02-09.flv' : KB/s
Salut_les_Terriens!_(1)_14-02-09.flv : KB/s
++ grep REFRESH_DELAY= /home/lancelin/.get-canal.conf/get-canal.cfg
++ cut -d= -f2
+ sleep 1
+ true
+ head -1 /tmp/get-canal.tmp/progress_bar1.log
+ grep -q '^0$'
+ head -1 /tmp/get-canal.tmp/progress_bar1.log
+ grep -q '. . . . . . . 100'
++ tail -2 /tmp/get-canal.tmp/progress_bar1.log
++ head -1
++ sed 's/^[ \t]*//'
++ tr -s ' '
++ cut '-d ' -f7
++ grep -v '[[:alpha:]]'
++ sed -e s/%//g -e $'s/\302\273/100/g'
+ echo 65
65
++ grep TITRE= /tmp/get-canal.tmp/progress_bar1.log
++ cut -d= -f2
++ tail -2 /tmp/get-canal.tmp/progress_bar1.log
++ head -1
++ sed 's/^[ \t]*//'
++ tr -s ' '
++ cut '-d ' -f9
++ sed -e 's/\[.*\]/Terminé/g'
+ echo 'Salut_les_Terriens!_(1)_14-02-09.flv' : KB/s
Salut_les_Terriens!_(1)_14-02-09.flv : KB/s
++ grep REFRESH_DELAY= /home/lancelin/.get-canal.conf/get-canal.cfg
++ cut -d= -f2
+ sleep 1
+ true
+ head -1 /tmp/get-canal.tmp/progress_bar1.log
+ grep -q '^0$'
+ head -1 /tmp/get-canal.tmp/progress_bar1.log
+ grep -q '. . . . . . . 100'
++ tail -2 /tmp/get-canal.tmp/progress_bar1.log
++ head -1
++ sed 's/^[ \t]*//'
++ tr -s ' '
++ cut '-d ' -f7
++ grep -v '[[:alpha:]]'
++ sed -e s/%//g -e $'s/\302\273/100/g'
+ echo 65
65
++ grep TITRE= /tmp/get-canal.tmp/progress_bar1.log
++ cut -d= -f2
++ tail -2 /tmp/get-canal.tmp/progress_bar1.log
++ head -1
++ sed 's/^[ \t]*//'
++ tr -s ' '
++ cut '-d ' -f9
++ sed -e 's/\[.*\]/Terminé/g'
+ echo 'Salut_les_Terriens!_(1)_14-02-09.flv' : KB/s
Salut_les_Terriens!_(1)_14-02-09.flv : KB/s
++ grep REFRESH_DELAY= /home/lancelin/.get-canal.conf/get-canal.cfg
++ cut -d= -f2
+ sleep 1
+ true
+ head -1 /tmp/get-canal.tmp/progress_bar1.log
+ grep -q '^0$'
+ head -1 /tmp/get-canal.tmp/progress_bar1.log
+ grep -q '. . . . . . . 100'
++ tail -2 /tmp/get-canal.tmp/progress_bar1.log
++ head -1
++ sed 's/^[ \t]*//'
++ tr -s ' '
++ cut '-d ' -f7
++ grep -v '[[:alpha:]]'
++ sed -e s/%//g -e $'s/\302\273/100/g'
+ echo 66
66
++ grep TITRE= /tmp/get-canal.tmp/progress_bar1.log
++ cut -d= -f2
++ tail -2 /tmp/get-canal.tmp/progress_bar1.log
++ head -1
++ sed 's/^[ \t]*//'
++ tr -s ' '
++ cut '-d ' -f9
++ sed -e 's/\[.*\]/Terminé/g'
+ echo 'Salut_les_Terriens!_(1)_14-02-09.flv' : KB/s
Salut_les_Terriens!_(1)_14-02-09.flv : KB/s
++ grep REFRESH_DELAY= /home/lancelin/.get-canal.conf/get-canal.cfg
++ cut -d= -f2
+ sleep 1
+ true
+ head -1 /tmp/get-canal.tmp/progress_bar1.log
+ grep -q '^0$'
+ head -1 /tmp/get-canal.tmp/progress_bar1.log
+ grep -q '. . . . . . . 100'
++ tail -2 /tmp/get-canal.tmp/progress_bar1.log
++ head -1
++ sed 's/^[ \t]*//'
++ tr -s ' '
++ cut '-d ' -f7
++ grep -v '[[:alpha:]]'
++ sed -e s/%//g -e $'s/\302\273/100/g'
+ echo 66
66
++ grep TITRE= /tmp/get-canal.tmp/progress_bar1.log
++ cut -d= -f2
++ tail -2 /tmp/get-canal.tmp/progress_bar1.log
++ head -1
++ sed 's/^[ \t]*//'
++ tr -s ' '
++ cut '-d ' -f9
++ sed -e 's/\[.*\]/Terminé/g'
+ echo 'Salut_les_Terriens!_(1)_14-02-09.flv' : KB/s
Salut_les_Terriens!_(1)_14-02-09.flv : KB/s
++ grep REFRESH_DELAY= /home/lancelin/.get-canal.conf/get-canal.cfg
++ cut -d= -f2
+ sleep 1
+ true
+ head -1 /tmp/get-canal.tmp/progress_bar1.log
+ grep -q '^0$'
+ head -1 /tmp/get-canal.tmp/progress_bar1.log
+ grep -q '. . . . . . . 100'
++ tail -2 /tmp/get-canal.tmp/progress_bar1.log
++ head -1
++ sed 's/^[ \t]*//'
++ tr -s ' '
++ cut '-d ' -f7
++ grep -v '[[:alpha:]]'
++ sed -e s/%//g -e $'s/\302\273/100/g'
+ echo 67
67
++ grep TITRE= /tmp/get-canal.tmp/progress_bar1.log
++ cut -d= -f2
++ tail -2 /tmp/get-canal.tmp/progress_bar1.log
++ head -1
++ sed 's/^[ \t]*//'
++ tr -s ' '
++ cut '-d ' -f9
++ sed -e 's/\[.*\]/Terminé/g'
+ echo 'Salut_les_Terriens!_(1)_14-02-09.flv' : KB/s
Salut_les_Terriens!_(1)_14-02-09.flv : KB/s
++ grep REFRESH_DELAY= /home/lancelin/.get-canal.conf/get-canal.cfg
++ cut -d= -f2
+ sleep 1
+ true
+ head -1 /tmp/get-canal.tmp/progress_bar1.log
+ grep -q '^0$'
+ head -1 /tmp/get-canal.tmp/progress_bar1.log
+ grep -q '. . . . . . . 100'
++ tail -2 /tmp/get-canal.tmp/progress_bar1.log
++ head -1
++ sed 's/^[ \t]*//'
++ tr -s ' '
++ cut '-d ' -f7
++ grep -v '[[:alpha:]]'
++ sed -e s/%//g -e $'s/\302\273/100/g'
+ echo 67
67
++ grep TITRE= /tmp/get-canal.tmp/progress_bar1.log
++ cut -d= -f2
++ tail -2 /tmp/get-canal.tmp/progress_bar1.log
++ head -1
++ sed 's/^[ \t]*//'
++ tr -s ' '
++ cut '-d ' -f9
++ sed -e 's/\[.*\]/Terminé/g'
+ echo 'Salut_les_Terriens!_(1)_14-02-09.flv' : MB/s
Salut_les_Terriens!_(1)_14-02-09.flv : MB/s
++ grep REFRESH_DELAY= /home/lancelin/.get-canal.conf/get-canal.cfg
++ cut -d= -f2
+ sleep 1
+ true
+ head -1 /tmp/get-canal.tmp/progress_bar1.log
+ grep -q '^0$'
+ head -1 /tmp/get-canal.tmp/progress_bar1.log
+ grep -q '. . . . . . . 100'
++ tail -2 /tmp/get-canal.tmp/progress_bar1.log
++ head -1
++ sed 's/^[ \t]*//'
++ tr -s ' '
++ cut '-d ' -f7
++ grep -v '[[:alpha:]]'
++ sed -e s/%//g -e $'s/\302\273/100/g'
+ echo 67
67
++ grep TITRE= /tmp/get-canal.tmp/progress_bar1.log
++ cut -d= -f2
++ tail -2 /tmp/get-canal.tmp/progress_bar1.log
++ head -1
++ sed 's/^[ \t]*//'
++ tr -s ' '
++ cut '-d ' -f9
++ sed -e 's/\[.*\]/Terminé/g'
+ echo 'Salut_les_Terriens!_(1)_14-02-09.flv' : KB/s
Salut_les_Terriens!_(1)_14-02-09.flv : KB/s
++ grep REFRESH_DELAY= /home/lancelin/.get-canal.conf/get-canal.cfg
++ cut -d= -f2
+ sleep 1
+ true
+ head -1 /tmp/get-canal.tmp/progress_bar1.log
+ grep -q '^0$'
+ head -1 /tmp/get-canal.tmp/progress_bar1.log
+ grep -q '. . . . . . . 100'
++ tail -2 /tmp/get-canal.tmp/progress_bar1.log
++ head -1
++ sed 's/^[ \t]*//'
++ tr -s ' '
++ cut '-d ' -f7
++ grep -v '[[:alpha:]]'
++ sed -e s/%//g -e $'s/\302\273/100/g'
+ echo 68
68
++ grep TITRE= /tmp/get-canal.tmp/progress_bar1.log
++ cut -d= -f2
++ tail -2 /tmp/get-canal.tmp/progress_bar1.log
++ head -1
++ sed 's/^[ \t]*//'
++ tr -s ' '
++ cut '-d ' -f9
++ sed -e 's/\[.*\]/Terminé/g'
+ echo 'Salut_les_Terriens!_(1)_14-02-09.flv' : KB/s
Salut_les_Terriens!_(1)_14-02-09.flv : KB/s
++ grep REFRESH_DELAY= /home/lancelin/.get-canal.conf/get-canal.cfg
++ cut -d= -f2
+ sleep 1

C'est moi qui te remercie smile

#57 Le 19/02/2009, à 18:48

redisded

Re : get-canal, le retour...

Arrrg !!!

Je viens de comprendre le pb. Désolé la réponse se trouvait déja dans le log de utodeb mais j'étais passé à coté.
Du coup, je pense que le pb de utodeb n'est pas réglé au niveau de l'affichage mais simplement sur la bonne progression de la barre.

La cause du pb est toute simple :

wget ne renvoi pas exactement les memes infos chez vous que chez moi ! (question de version j'imagine)

exemple, chez vous :

    0K .......... .......... .......... .......... ..........  0%   55.67 KB/s
   50K .......... .......... .......... .......... ..........  0%   75.34 KB/s
  100K .......... .......... .......... .......... ..........  0%   76.78 KB/s
  150K .......... .......... .......... .......... ..........  0%  121.94 KB/s
  200K .......... .......... .......... .......... ..........  0%  122.53 KB/s
  250K .......... .......... .......... .......... ..........  0%  165.92 KB/s
  300K .......... .......... .......... .......... ..........  0%  116.22 KB/s
  350K .......... .......... .......... .......... ..........  0%  100.60 KB/s
  400K .......... .......... .......... .......... ..........  0%   88.79 KB/s
  450K .......... .......... .......... .......... ..........  0%   75.78 KB/s
  500K .......... .......... .......... .......... ..........  0%  104.75 KB/s
  550K .......... .......... .......... .......... ..........  0%  101.13 KB/s
  600K .......... .......... .......... .......... ..........  0%   94.96 KB/s
  650K .......... .......... .......... .......... ..........  0%   83.43 KB/s
  700K .......... .......... .......... .......... ..........  0%   68.16 KB/s
  750K .......... .......... .......... .......... ..........  0%   67.22 KB/s
  800K .......... .......... .......... .......... ..........  0%   33.11 KB/s
  850K .......... .......... .......... .......... ..........  0%  108.67 KB/s
  900K .......... .......... .......... .......... ..........  0%   63.89 KB/s
  950K .......... .......... .......... .......... ..........  0%   70.55 KB/s

chez moi :

     0K .......... .......... .......... .......... ..........  0% 41,9K 28m48s
    50K .......... .......... .......... .......... ..........  0%  125K 19m12s
   100K .......... .......... .......... .......... ..........  0%  131K 15m53s
   150K .......... .......... .......... .......... ..........  0%  136K 14m7s
   200K .......... .......... .......... .......... ..........  0% 12,7K 30m14s
   250K .......... .......... .......... .......... ..........  0% 21,4K 34m34s
   300K .......... .......... .......... .......... ..........  0% 31,9K 34m59s
   350K .......... .......... .......... .......... ..........  0% 32,4K 35m14s
   400K .......... .......... .......... .......... ..........  0% 31,6K 35m31s
   450K .......... .......... .......... .......... ..........  0% 25,9K 36m35s
   500K .......... .......... .......... .......... ..........  0% 31,0K 36m45s
   550K .......... .......... .......... .......... ..........  0% 33,1K 36m41s
   600K .......... .......... .......... .......... ..........  0% 58,8K 35m24s

Donc comme j'extrait à chaque fois le 9ème champ pour l'afficher, chez moi, j'ai bien le temp restant, mais chez vous, c'est systématiquement la colonne KB/S qui est renvoyé.

Je vient juste de trouver l'origine du pb, je ne sait trop comment régler ca pour l'instant car je me vois mal jongler avec 2 versions de wget.
Je réfléchi à la question et vous tiens au courant.
En attendant, pourrait tu stp me poster le retour de la commande :

wget --version

pour info, j'ai la 1.11.4 .

En supposant que tu fasse tes mises à jour régulierement, je pense donc que le fait que tu soit sous hardy explique cette différence de version.
Hardy étant une LTS, le script se doit de fonctionner impeccablement dessus...
Je vais faire chauffer les meninges...

Dernière modification par redisded (Le 19/02/2009, à 18:50)

Hors ligne

#58 Le 19/02/2009, à 19:03

Lancelin

Re : get-canal, le retour...

GNU Wget 1.10.2

Je sens la chaleur d'ici big_smile

#59 Le 19/02/2009, à 19:11

wholehog2

Re : get-canal, le retour...

bonjour,

j'ai testé ton script sur ma kubuntu 8.10 et j'ai des problèmes. Puis je utiliser ton script alors que j'utilise kde ?

Après le lancement je choisi vlc comme lecteur et la fenêtre principal s'affiche mais au bout d'environ 5 secondes  le script plante même sans rien faire.

Voici ce que j'ai sur la console:

grep: /home/gilles/.get-canal.conf/get-canal.cfg: Aucun fichier ou dossier de ce type
grep: /home/gilles/.get-canal.conf/get-canal.cfg: Aucun fichier ou dossier de ce type
REFRESH_DELAY=1                                                                      
--2009-02-19 17:59:52--  http://www.vosflux.tv/emission/+/rss                        
Résolution de www.vosflux.tv... 213.186.33.2                                         
Connexion vers www.vosflux.tv|213.186.33.2|:80... connecté.                          
requête HTTP transmise, en attente de la réponse... 200 OK                           
Longueur: non spécifié [text/xml]                                                    
Saving to: `STDOUT'                                                                  

    [ <=>                                                                                                ] 477         --.-K/s   in 0s      

2009-02-19 17:59:53 (44,3 MB/s) - « - » sauvegardé [477]

/title
./get-canal.sh: line 585: 22652 Processus arrêté      gtkdialog --program=POPUP
cat: Clair226: Aucun fichier ou dossier de ce type                             
cat: /tmp/get-canal.tmp/playlist.pls: Aucun fichier ou dossier de ce type      
QPixmap: It is not safe to use pixmaps outside the GUI thread                  
QPixmap: It is not safe to use pixmaps outside the GUI thread                  
QPixmap: It is not safe to use pixmaps outside the GUI thread                  
QPixmap: It is not safe to use pixmaps outside the GUI thread                  
QPainter::begin: Cannot paint on a null pixmap                                 
QPainter::end: Painter not active, aborted                                     

(gtkdialog:22688): Gdk-CRITICAL **: gdk_pixmap_foreign_new_for_display: assertion `(anid != 0)' failed

(gtkdialog:22688): Gdk-CRITICAL **: gdk_draw_drawable: assertion `src != NULL' failed

(gtkdialog:22688): GLib-GObject-CRITICAL **: g_object_unref: assertion `G_IS_OBJECT (object)' failed
QPixmap: It is not safe to use pixmaps outside the GUI thread                                       
QPixmap: It is not safe to use pixmaps outside the GUI thread                                       
QPixmap: It is not safe to use pixmaps outside the GUI thread                                       
QPixmap: It is not safe to use pixmaps outside the GUI thread                                       
QPainter::begin: Cannot paint on a null pixmap                                                      
QPainter::end: Painter not active, aborted                                                          

(gtkdialog:22688): Gdk-CRITICAL **: gdk_pixmap_foreign_new_for_display: assertion `(anid != 0)' failed

(gtkdialog:22688): Gdk-CRITICAL **: gdk_draw_drawable: assertion `src != NULL' failed

(gtkdialog:22688): GLib-GObject-CRITICAL **: g_object_unref: assertion `G_IS_OBJECT (object)' failed
QPixmap: It is not safe to use pixmaps outside the GUI thread                                       
QPixmap: It is not safe to use pixmaps outside the GUI thread                                       
QPixmap: It is not safe to use pixmaps outside the GUI thread                                       
QPixmap: It is not safe to use pixmaps outside the GUI thread                                       
QPainter::begin: Cannot paint on a null pixmap                                                      
QPainter::end: Painter not active, aborted                                                          

(gtkdialog:22688): Gdk-CRITICAL **: gdk_pixmap_foreign_new_for_display: assertion `(anid != 0)' failed

(gtkdialog:22688): Gdk-CRITICAL **: gdk_draw_drawable: assertion `src != NULL' failed

(gtkdialog:22688): GLib-GObject-CRITICAL **: g_object_unref: assertion `G_IS_OBJECT (object)' failed
QPixmap: It is not safe to use pixmaps outside the GUI thread                                       
QPixmap: It is not safe to use pixmaps outside the GUI thread                                       
QPixmap: It is not safe to use pixmaps outside the GUI thread                                       
QPixmap: It is not safe to use pixmaps outside the GUI thread                                       
QPainter::begin: Cannot paint on a null pixmap                                                      
QPainter::end: Painter not active, aborted                                                          

(gtkdialog:22688): Gdk-CRITICAL **: gdk_pixmap_foreign_new_for_display: assertion `(anid != 0)' failed

(gtkdialog:22688): Gdk-CRITICAL **: gdk_draw_drawable: assertion `src != NULL' failed

(gtkdialog:22688): GLib-GObject-CRITICAL **: g_object_unref: assertion `G_IS_OBJECT (object)' failed
QPixmap: It is not safe to use pixmaps outside the GUI thread                                       
QPixmap: It is not safe to use pixmaps outside the GUI thread                                       
QPixmap: It is not safe to use pixmaps outside the GUI thread                                       
QPixmap: It is not safe to use pixmaps outside the GUI thread                                       
QPainter::begin: Cannot paint on a null pixmap                                                      
QPainter::end: Painter not active, aborted                                                          

(gtkdialog:22688): Gdk-CRITICAL **: gdk_pixmap_foreign_new_for_display: assertion `(anid != 0)' failed

(gtkdialog:22688): Gdk-CRITICAL **: gdk_draw_drawable: assertion `src != NULL' failed

(gtkdialog:22688): GLib-GObject-CRITICAL **: g_object_unref: assertion `G_IS_OBJECT (object)' failed
QPixmap: It is not safe to use pixmaps outside the GUI thread                                       
QPixmap: It is not safe to use pixmaps outside the GUI thread                                       
QPixmap: It is not safe to use pixmaps outside the GUI thread                                       
QPixmap: It is not safe to use pixmaps outside the GUI thread                                       
QPainter::begin: Cannot paint on a null pixmap                                                      
QPainter::end: Painter not active, aborted                                                          

(gtkdialog:22688): Gdk-CRITICAL **: gdk_pixmap_foreign_new_for_display: assertion `(anid != 0)' failed

(gtkdialog:22688): Gdk-CRITICAL **: gdk_draw_drawable: assertion `src != NULL' failed

(gtkdialog:22688): GLib-GObject-CRITICAL **: g_object_unref: assertion `G_IS_OBJECT (object)' failed
QPixmap: It is not safe to use pixmaps outside the GUI thread                                       
QPixmap: It is not safe to use pixmaps outside the GUI thread                                       
QPixmap: It is not safe to use pixmaps outside the GUI thread                                       
QPixmap: It is not safe to use pixmaps outside the GUI thread                                       
QPainter::begin: Cannot paint on a null pixmap                                                      
QPainter::end: Painter not active, aborted                                                          

(gtkdialog:22688): Gdk-CRITICAL **: gdk_pixmap_foreign_new_for_display: assertion `(anid != 0)' failed

(gtkdialog:22688): Gdk-CRITICAL **: gdk_draw_drawable: assertion `src != NULL' failed

(gtkdialog:22688): GLib-GObject-CRITICAL **: g_object_unref: assertion `G_IS_OBJECT (object)' failed
QPixmap: It is not safe to use pixmaps outside the GUI thread                                       
QPixmap: It is not safe to use pixmaps outside the GUI thread                                       
QPixmap: It is not safe to use pixmaps outside the GUI thread                                       
QPixmap: It is not safe to use pixmaps outside the GUI thread                                       
QPainter::begin: Cannot paint on a null pixmap                                                      
QPainter::end: Painter not active, aborted                                                          

(gtkdialog:22688): Gdk-CRITICAL **: gdk_pixmap_foreign_new_for_display: assertion `(anid != 0)' failed

(gtkdialog:22688): Gdk-CRITICAL **: gdk_draw_drawable: assertion `src != NULL' failed

(gtkdialog:22688): GLib-GObject-CRITICAL **: g_object_unref: assertion `G_IS_OBJECT (object)' failed
QPixmap: It is not safe to use pixmaps outside the GUI thread                                       
QPixmap: It is not safe to use pixmaps outside the GUI thread                                       
QPixmap: It is not safe to use pixmaps outside the GUI thread                                       
QPixmap: It is not safe to use pixmaps outside the GUI thread                                       
QPainter::begin: Cannot paint on a null pixmap                                                      
QPainter::end: Painter not active, aborted                                                          

(gtkdialog:22688): Gdk-CRITICAL **: gdk_pixmap_foreign_new_for_display: assertion `(anid != 0)' failed

(gtkdialog:22688): Gdk-CRITICAL **: gdk_draw_drawable: assertion `src != NULL' failed

(gtkdialog:22688): GLib-GObject-CRITICAL **: g_object_unref: assertion `G_IS_OBJECT (object)' failed
QPixmap: It is not safe to use pixmaps outside the GUI thread                                       
QPixmap: It is not safe to use pixmaps outside the GUI thread                                       
QPixmap: It is not safe to use pixmaps outside the GUI thread                                       
QPixmap: It is not safe to use pixmaps outside the GUI thread                                       
QPainter::begin: Cannot paint on a null pixmap                                                      
QPainter::end: Painter not active, aborted                                                          

(gtkdialog:22688): Gdk-CRITICAL **: gdk_pixmap_foreign_new_for_display: assertion `(anid != 0)' failed

(gtkdialog:22688): Gdk-CRITICAL **: gdk_draw_drawable: assertion `src != NULL' failed

(gtkdialog:22688): GLib-GObject-CRITICAL **: g_object_unref: assertion `G_IS_OBJECT (object)' failed
QPixmap: It is not safe to use pixmaps outside the GUI thread                                       
QPixmap: It is not safe to use pixmaps outside the GUI thread                                       
QPixmap: It is not safe to use pixmaps outside the GUI thread                                       
QPixmap: It is not safe to use pixmaps outside the GUI thread                                       
QPainter::begin: Cannot paint on a null pixmap                                                      
QPainter::end: Painter not active, aborted                                                          

(gtkdialog:22688): Gdk-CRITICAL **: gdk_pixmap_foreign_new_for_display: assertion `(anid != 0)' failed

(gtkdialog:22688): Gdk-CRITICAL **: gdk_draw_drawable: assertion `src != NULL' failed

(gtkdialog:22688): GLib-GObject-CRITICAL **: g_object_unref: assertion `G_IS_OBJECT (object)' failed
QPixmap: It is not safe to use pixmaps outside the GUI thread                                       
QPixmap: It is not safe to use pixmaps outside the GUI thread                                       
QPixmap: It is not safe to use pixmaps outside the GUI thread                                       
QPixmap: It is not safe to use pixmaps outside the GUI thread
QPainter::begin: Cannot paint on a null pixmap
QPainter::end: Painter not active, aborted

(gtkdialog:22688): Gdk-CRITICAL **: gdk_pixmap_foreign_new_for_display: assertion `(anid != 0)' failed

(gtkdialog:22688): Gdk-CRITICAL **: gdk_draw_drawable: assertion `src != NULL' failed

(gtkdialog:22688): GLib-GObject-CRITICAL **: g_object_unref: assertion `G_IS_OBJECT (object)' failed
gtkdialog: pthread_mutex_lock.c :87 : __pthread_mutex_lock:  L'assertion « mutex->__data.__owner == 0 » a échoué.
./get-canal.sh: line 587: 22688 Abandon                 gtkdialog --program=MAIN_PROGRAMM
Terminated
Terminated
Terminated
Complété
gilles@kubuntu8:~/canal$ Terminated
cut: erreur d'écritureTerminated
: Relais brisé (pipe)
Terminated
Terminated
Terminated
Terminated
Terminated

Hors ligne

#60 Le 19/02/2009, à 19:44

redisded

Re : get-canal, le retour...

wholehog2 a écrit :

bonjour,

j'ai testé ton script sur ma kubuntu 8.10 et j'ai des problèmes. Puis je utiliser ton script alors que j'utilise kde ?

Euuh a priori je dirais oui mais visiblement non sad

Je tourne sous gnome personellement et je ne connais vraiment pas kde du tout.

cependant, il semble que les pb viennent de gtkdialog, et nottament des images utilisées. peut -etre suffit-il d'installer seulement le pack d'icones de gnome (est-ce seulement possible?)

Ce n'est qu'une piste pour le moment, et je dois t'avouer que je ne sait pas trop d'où vient ton pb si ce n'est pas cela.

Si quelqu'un de calé sur gtkdialog ou connaisant bien kde à une idée du souci...

Hors ligne

#61 Le 19/02/2009, à 23:37

AnsuzPeorth

Re : get-canal, le retour...

Faudrait voir avec hizoka, il est sous kubuntu.

Perso, les erreurs type qpainter, jamais vu...! Il faut surement d'autres composants gnome...enfin je dis ça....j'en sais fichtre rien !

Et pour ton problème de progress, affiche le champ 8 et 9 ... Ca sera cohérent au moins (peu importe la version wget) wink

J'ai posté dans le forum dev, j'utilise wget et une progress via tail, jete un oeil, ca pourrait peut etre le faire pour ton cas.


Interface graphique pour bash, python ou autre: glade2script
Support Tchat: http://chat.jabberfr.org/muckl_int/inde … ade2script  (Hors ligne)

Hors ligne

#62 Le 19/02/2009, à 23:51

redisded

Re : get-canal, le retour...

AnsuzPeorth a écrit :

Et pour ton problème de progress, affiche le champ 8 et 9 ... Ca sera cohérent au moins (peu importe la version wget) wink

C'est ce que j'ai fait wink
je jette un oeil à ton post...

Interessant, merci à toi.
Concernant la barre de progression, en fait, la principale différence est que tu formate le texte avant la mise en fichier et que tu te contente ensuite de lire le fichier (alors que oi je copie la sortie brute de wget dans le fichier et que je le traite seulement au moment de l'affichage). Donc bon, à moins que je passe à coté de quelque chose, c'est quasiment le meme processus non ?

Sinon, je peaufine la fonction playlist, modifie le changelog et dépose une mise à jour dans la nuit.

Dernière modification par redisded (Le 19/02/2009, à 23:58)

Hors ligne

#63 Le 20/02/2009, à 00:00

AnsuzPeorth

Re : get-canal, le retour...

Si tu comptes passer par des tail dans tes progress, comme chaque tail sera sur un fichier spécifique, tu pourrais peut être utiliser inotail, moins gourmand que tail.


Interface graphique pour bash, python ou autre: glade2script
Support Tchat: http://chat.jabberfr.org/muckl_int/inde … ade2script  (Hors ligne)

Hors ligne

#64 Le 20/02/2009, à 00:07

AnsuzPeorth

Re : get-canal, le retour...

redisded a écrit :

Concernant la barre de progression, en fait, la principale différence est que tu formate le texte avant la mise en fichier et que tu te contente ensuite de lire le fichier (alors que oi je copie la sortie brute de wget dans le fichier et que je le traite seulement au moment de l'affichage). Donc bon, à moins que je passe à coté de quelque chose, c'est quasiment le meme processus non ?

J'ai pas epluché ton scipt, c'est vrai, j'ai pas vu si tu passais par des tail -f (je pense pas), donc tu boucle, c'est peut etre moins gourmand en ressources d'utiliser des tail ? ou inotail que de boucler sur toutes tes barres (tail boucle aussi toutes les secondes mais mieux qu'en bash je presume, inotail ne reagit qu'a modif du fichier lui, c'est encore mieux)


Interface graphique pour bash, python ou autre: glade2script
Support Tchat: http://chat.jabberfr.org/muckl_int/inde … ade2script  (Hors ligne)

Hors ligne

#65 Le 20/02/2009, à 00:10

redisded

Re : get-canal, le retour...

oki je vais fouiller ca.

Sinon si quelque un sous hardy avait 5 minutes pour tester les barres de progression avant que je livre la mise à jour...
Merci d'avance.

#!/bin/bash
############################################################################################################################################################
# Script de téléchargements des emissions réccurentes de Canal +.				   
# Ce script utilise les flux rss du site http://www.vosflux.tv/site/ pour l'indexation des vidéos. 
#												   
# Ce script est un logiciel libre ; vous pouvez le redistribuer et/ou le modifier selon les	   
# termes de la Licence Publique Générale GNU ( GNU GPL ) publiée par la Free Software  Foundation.  
#												   
#							       				    #												   
#											Redisded   
#				Historique des versions : 					   
# - Version 0.3 (18/02/09)
#	Ajout de quelques émissions recemment apparues sur le site www.vosflux.tv.									   
#	Ajout d'une gestion de la fréquence de rafraichissement des barres de progression pour moduler la charge cpu.
#	Correction d'un bug dans la configuration.						   
#	Correction d'un bug empêchant le renommage du script.
#	Affichage de la dernière liste des videos affichées au lancement du script.					   
#	Légère modification de l'interface principale.						   
#	Correction orthographique.								   
# - Version 0.2 (17/02/09)									   
#	Modification des barres de chargements pour atténuer une surcharge cpu.			   
# - Version 0.1 (16/02/09)									   
#	Version originale. Permet le téléchargement des vidéos de chaque emission.    		   
#												   
############################################################################################################################################################


##### Déclaration des variables. #####
# Déclaration du numéro de version du script.
export VERSION="0.3"
# Déclaration du dossier contenant le script
export DIR=$(dirname $0)
# Déclaration du nom du script.
export SCRIPT=$(basename $0)
# Emplacement du dossier de configuration
export CONF_DIR="/home/"$USER"/.get-canal.conf"
# Emplacement du dossier temporaire.
export TEMP_DIR="/tmp/get-canal.tmp"
# Déclaration de la variable servant à gérer les numéros des téléchargements dans la file d'attente.
export DL_NUM="1"
# Déclaration du répertoire de téléchargement des vidéos.
export DOWNLOAD_DIR="$(grep DOWNLOAD_DIR= $CONF_DIR/get-canal.cfg | cut -d"=" -f2)"
# Déclaration du player vidéo.
export VIDEO_PLAYER="$(grep VIDEO_PLAYER= $CONF_DIR/get-canal.cfg | cut -d"=" -f2)"
# Déclaration du popup apparaissant pendant les temps de chargements.
export  POPUP='
<window window_position="1" decorated="false" skip_taskbar_hint="true">
  <vbox>
    <text>
      <input>echo "$MESS"</input>
    </text>
  </vbox>
</window>
'
# Déclaration de l'en-tête de la playlist.
TEXT_PLAYLIST="#EXTM3U"

##### Déclaration des fonctions utilisées par gtkdialog. #####
# Fonction de gestion des numéros des vidéos dans la file d'attente des téléchargements.
NB_PROGRESSBAR () {
while true ; do
	if grep -q $DL_NUM $TEMP_DIR/progress_bar.list ; then
		DL_NUM=$(( $DL_NUM + 1 ))
	else
		break
	fi
done
echo $DL_NUM
}

# Fonction d'affichage de la liste des vidéos pour l'emission choisie par l'utilisateur.
SHOW_LIST () {
export MESS="Chargement de la liste des vidéos. Veuillez patientez..." ; gtkdialog --program=POPUP & pid=$!
if [ -f "$TEMP_DIR/index.$1" ] ; then
	kill -9 $pid ; exit 0
fi
STREAM_URL="http://www.vosflux.tv/emission/$1/rss"
wget -v "$STREAM_URL" -O - | iconv -f ISO-8859-15 -t UTF-8 >"$TEMP_DIR/index.$1"
TITRES="$(sed -e 's/></\n/g' -e 's/</>/g' "$TEMP_DIR/index.$1" | grep "title" | sed '1d' | cut -d">" -f2)"
DATES="$(sed -e 's/></\n/g' "$TEMP_DIR/index.$1" | grep "url=" | cut -d"\"" -f2 | sed -e '/_AUTO_/s/.*\(..\)\(..\)\(..\)_AUTO_.*/\3-\2-\1/g' -e '/_CAN_/s/.*\(..\)\(..\)\(..\)_CAN_.*/\3-\2-\1/g')"
VIDEOS="$(sed -e 's/></\n/g' "$TEMP_DIR/index.$1" | grep "url=" | cut -d"\"" -f2)"
echo -e $TITRES

i="1"
n=$(echo -e "$TITRES" | wc -l)
while [ "$i" -le "$n" ] ; do
	echo "$(echo "$TITRES" | head -$i | tail -1)|$(echo -e "$DATES" | head -$i | tail -1)|$(echo -e "$VIDEOS" | head -$i | tail -1)"  >>$TEMP_DIR/videos.$1
	i=$(( $i + 1 ))
done
kill -9 $pid
}

# Fonction de téléchargement de la vidéo sélectionnée.
GET_VIDEO () {
export MESS="Lancement du téléchargement..." ; gtkdialog --program=POPUP & pid=$!
NB_PROGRESSBAR
sleep 1
if [ "$DL_NUM" -gt "10" ] ; then
	kill -9 $pid
	notify-send -t 3000 -i stop "Impossible de lancer plus de 10 téléchargements simultanés"
	tmp_list=$(grep -v "next=" $TEMP_DIR/progress_bar.list)
	echo -e "$tmp_list" >$TEMP_DIR/progress_bar.list
else
	ID=$(head -1 "$TEMP_DIR/show_list" | sed -e 's/.*(\(.*\))/\1/g')
	TITRE_TEMP=$(grep "$1" "$TEMP_DIR/videos.$ID" | cut -d"|" -f1 | sed -e 's/ /_/g')
	DATE_DIFF=$(grep "$1" "$TEMP_DIR/videos.$ID" | cut -d"|" -f2)
	TITRE="$TITRE_TEMP"_"$DATE_DIFF.flv"
	echo "$DL_NUM" >>$TEMP_DIR/progress_bar.list
	echo "" >$TEMP_DIR/progress_bar$DL_NUM.log
	kill -9 $!
	wget -cO "$TEMP_DIR/videos/$TITRE" "$1" 2>>$TEMP_DIR/progress_bar$DL_NUM.log & kill -9 $pid
	echo "TITRE=$TITRE" >$TEMP_DIR/progress_bar$DL_NUM.log
	tmp_list=$(grep -v "next=" $TEMP_DIR/progress_bar.list)
	echo -e "$tmp_list" >$TEMP_DIR/progress_bar.list
	while ps aux | tr -s ' ' | cut -d" " -f2 | grep $! ; do
		sleep $(grep REFRESH_DELAY= $CONF_DIR/get-canal.cfg | cut -d"=" -f2)
	done
	#sleep 1
	if grep "sauvegardé" "$TEMP_DIR/progress_bar$DL_NUM.log" ; then
		notify-send -t 3000 -i info "Téléchargement terminé : $TITRE" & echo -e ". . . . . . . 100\nTITRE=$TITRE" >$TEMP_DIR/progress_bar$DL_NUM.log
	fi
fi
}

# Fonction de sauvegarde de la vidéo sélectionnée.
SAVE_FILE () {
titre=$(grep TITRE= $TEMP_DIR/progress_bar$1.log | cut -d"=" -f2)
if [ "$titre" = "" ] ; then
	export MESS="Aucune vidéo à sauvegarder !" ; gtkdialog --program=POPUP & sleep 3 ; kill -9 $!
elif ps aux | grep "wget -cO /tmp/get-canal.tmp/videos/$titre" | grep -v "grep" ; then
	export MESS="Veuillez attendre la fin du téléchargement !" ; gtkdialog --program=POPUP & sleep 3 ; kill -9 $!
elif [ -f "$DOWNLOAD_DIR"/"$titre" ] ; then
	notify-send -t 3000 -i stop "L'émission $titre à déja été sauvegardée !"
else
	if grep "$titre" "$TEMP_DIR/playlist.info" ; then
		download_dir=$(echo "$DOWNLOAD_DIR" | sed -e 's/\//\\\//g')
		temp_dir=$(echo "$TEMP_DIR" | sed -e 's/\//\\\//g')
		sed -i "/$titre/s/$temp_dir\videos/$download_dir/g" $TEMP_DIR/playlist.m3u
	fi
	mv "$TEMP_DIR/videos/$titre" "$DOWNLOAD_DIR/$titre" && notify-send -t 3000 -i "filesave" "Emission sauvegardée : $titre" || notify-send -t 3000 -i stop "Impossible de sauvegarder la vidéo : $titre"
fi
}

# Fonction servant à enlever la vidéo sélectionnée de la liste des téléchargements.
DELETE_FILE () {
titre=$(grep TITRE= $TEMP_DIR/progress_bar$1.log | cut -d"=" -f2)
if [ "$titre" = "" ] ; then
	export MESS="Aucune vidéo à supprimer !" ; gtkdialog --program=POPUP & sleep 3 ; kill -9 $!
elif ps aux | grep "wget -cO /tmp/get-canal.tmp/videos/$titre" | grep -v "grep" ; then
	kill -9 $(ps aux | grep "wget -cO /tmp/get-canal.tmp/videos/$titre" | grep -v "grep" | tr -s ' ' |cut -d " " -f2)
	progress_bar_list=$(grep -v "$1" $TEMP_DIR/progress_bar.list)
	echo -e "$progress_bar_list" >$TEMP_DIR/progress_bar.list ; echo "0" >$TEMP_DIR/progress_bar$1.log
	notify-send -t 3000 -i stop "Téléchargement annulé : $titre"
else
	progress_bar_list=$(grep -v "$1" $TEMP_DIR/progress_bar.list)
	echo -e "$progress_bar_list" >$TEMP_DIR/progress_bar.list ; echo "0" >$TEMP_DIR/progress_bar$1.log
fi
}

# Fonction d'affichage des barres de progression.
PROGRESS_BAR () {
while true ; do
	if head -1 $TEMP_DIR/progress_bar$1.log | grep -q ^0$ ; then
		echo 0  ; echo " " ; sleep $(grep REFRESH_DELAY= $CONF_DIR/get-canal.cfg | cut -d"=" -f2)
	elif head -1 $TEMP_DIR/progress_bar$1.log | grep -q ". . . . . . . 100" ; then
		echo 100
		echo $(grep TITRE= $TEMP_DIR/progress_bar$1.log | cut -d"=" -f2) : Terminé
		sleep $(grep REFRESH_DELAY= $CONF_DIR/get-canal.cfg | cut -d"=" -f2)
	else
		echo $(tail -2 $TEMP_DIR/progress_bar$1.log | head -1 | sed 's/^[ \t]*//' | tr -s " " | cut -d" " -f7 | grep -v [[:alpha:]] | sed -e 's/%//g' -e 's/»/100/g')
		echo $(grep TITRE= $TEMP_DIR/progress_bar$1.log | cut -d"=" -f2) : $(tail -2 $TEMP_DIR/progress_bar$1.log | head -1 | sed 's/^[ \t]*//' | tr -s ' ' | cut -d" " -f8,9 | sed -e 's/\[.*\]/Terminé/g')
	sleep $(grep REFRESH_DELAY= $CONF_DIR/get-canal.cfg | cut -d"=" -f2)
	fi
done
}

# Fonction de modification de la playlist
ADD_PLAYLIST () {
titre=$(grep "TITRE=" "$TEMP_DIR/progress_bar$1.log" | cut -d"=" -f2)
if [ "$titre" = "" ] ; then
	export MESS="Aucune vidéo à ajouter !" ; gtkdialog --program=POPUP & sleep 3 ; kill -9 $!
elif ps aux | grep "wget -cO /tmp/get-canal.tmp/videos/$titre" | grep -v "grep" ; then
	export MESS="Veuillez attendre la fin du téléchargement !" ; gtkdialog --program=POPUP & sleep 3 ; kill -9 $!
elif cat $TEMP_DIR/playlist.m3u | grep "$titre" ; then
	notify-send -t 3000 -i stop "L'émission $titre est déja présente dans votre playlist !"
else
	n=$(head -1 "/$TEMP_DIR/playlist.id")
	n=$(($n+1))
	echo "$n" >"/$TEMP_DIR/playlist.id"
	if [ -f "$DOWNLOAD_DIR/$titre" ] || [ -f "$TEMP_DIR/videos/$titre" ] ; then
		echo "$titre" >>/$TEMP_DIR/playlist.info
	else
		notify-send "La video $titre est introuvable ! Veuillez la re-télécharger."
	fi
	echo "$TEXT_PLAYLIST" >$TEMP_DIR/playlist.m3u
	cat "/$TEMP_DIR/playlist.info" | while read line ; do
		if [ -f "$DOWNLOAD_DIR/$line" ] ; then
			echo "$DOWNLOAD_DIR/$line" >>$TEMP_DIR/playlist.m3u
		elif [ -f "$TEMP_DIR/videos/$line" ] ; then
			echo "$TEMP_DIR/videos/$line" >>$TEMP_DIR/playlist.m3u
		fi
	done
fi
}

##### Lecture des arguments passés au script et lancement des fonctions gtkdialog si argument -g ou --gtk passé au script. #####
if [ "$1" != "" ] ; then
	while getopts "gh-:" option ; do
		if [ "$option" = "-" ] ; then
			case $OPTARG in
				gtk)
					option=g
					;;
				help)
					option=h	
					;;
				*)
					echo "$OPTARG : option inconnue." ; echo "$MAN" ; exit 2
					;;
			esac
		fi
		case $option in
			g)
				shift ; $1 "$2" ; exit 0
				;;
			h)
				zenity --info --title="$0" --text="$options" ; exit 0
				;;
			?)
				echo "$option : option inconnue." ; echo "$MAN" ; exit 2
				;;
		esac
	done
fi


##### Déclaration des fenêtres gtkdialog. #####
# Déclaration de la fenêtre configuration.
export MAIN_CONFIG='
<window title="Configuration de '$SCRIPT'" window_position="1">
  <vbox>
    <frame Répertoire de téléchargement des fichiers>
      <hbox>
        <entry accept="directory" activates_default="true">
          <label>Choisissez un répertoire</label>
          <default>'$PWD'</default>          
          <variable>FILE_DIRECTORY</variable>
        </entry>
        <button>
          <input file stock="gtk-open"></input>
          <action type="fileselect">FILE_DIRECTORY</action>
        </button>
      </hbox>
    </frame>
    <frame Lecteur vidéo préféré>
      <combobox case-sensitive="false" value-in-list="true">
        <variable>VIDEO_PLAYER</variable>
        <item>kaffeine</item>
        <item>mplayer</item>
        <item>totem</item>
        <item>vlc</item>
        <item>xine</item>
      </combobox>
    </frame>
    <hbox>
      <button ok></button>
      <button cancel></button>
    </hbox>
  </vbox>
</window>
'

# Déclaration de la fenêtre principale.
export MAIN_PROGRAMM='
<window title="'$SCRIPT'" window_position="1">
  <vbox>
    <notebook labels="Principal|Téléchargements automatiques|Options">
      <hbox>
        <vbox>
          <text wrap="true" width-chars="32" use_markup="true">
            <label>Choisissez une émission puis cliquez sur la loupe.</label>
          </text>
          <combobox case-sensitive="false" value-in-list="true">
            <item>+ Clair (226)</item>
            <item>Action discrète (594)</item>
            <item>Canal presque (593)</item>
            <item>Chris Esquerre (230)</item>
            <item>Dimanche+ (228)</item>
            <item>Groland magzine (45)</item>
            <item>L'\''édition spéciale (229)</item>
            <item>L'\''effet papillon (13)</item>
            <item>La boite à question (44)</item>
            <item>La matinale (227)</item>
            <item>La semaine de Guillon (595)</item>
            <item>Le buzz du jour (47)</item>
            <item>Le grand journal (14)</item>
            <item>Le meilleur du hier (48)</item>
            <item>Le petit journal actu (43)</item>
            <item>Le petit journal people (42)</item>
            <item>Le zapping (46)</item>
            <item>Les bonus de Guillaume (592)</item>
            <item>Les guignols (36)</item>
            <item>Pépites sur le net (41)</item>
            <item>Salut les terriens! (12)</item>
            <item>SAV des emissions (40)</item>
            <item>Têtes à claques (231)</item>
            <variable>EMISSION</variable>
          </combobox>
          <button>
            <input file icon="gtk-find"></input>
            <action>echo "$EMISSION" >$TEMP_DIR/show_list ; sed -i "/EMISSION/s/=.*/=$EMISSION/g" $CONF_DIR/get-canal.cfg ; '$DIR/$SCRIPT' --gtk "SHOW_LIST" "$(echo "$EMISSION" | sed -e '\''s/.*(\(.*\))/\1/g'\'')"</action>
            <action type="refresh">VIDEO</action>
          </button>
          <text wrap="true" width-chars="32" use_markup="true">
            <label>"  Double-cliquez sur une vidéo pour la télécharger."</label>
          </text>
          <tree headers_visible="false" exported_column="2">
            <label>          Titre          | Date | Adresse de la vidéo </label>
            <input>cat $TEMP_DIR/videos.$(head -1 "$TEMP_DIR/show_list" | sed -e '\''s/.*(\(.*\))/\1/g'\'')</input>
            <variable>VIDEO</variable>
            <action>'$DIR/$SCRIPT' --gtk "GET_VIDEO" "$VIDEO" & sleep 2</action>
          </tree>
        </vbox>
        <frame Téléchargements>
          <hbox>
            <progressbar>
              <input>'$DIR/$SCRIPT' --gtk "PROGRESS_BAR" "1"</input>
            </progressbar>
            <button>
              <input file icon="filesave"></input>
              <action>'$DIR/$SCRIPT' --gtk "SAVE_FILE" "1"</action>
              <action type="refresh">PLAYLIST</action>
            </button>
            <button>
              <input file icon="redo"></input>
              <action>'$DIR/$SCRIPT' --gtk "ADD_PLAYLIST" "1"</action>
              <action type="refresh">PLAYLIST</action>
            </button>
            <button>
              <input file icon="stop"></input>
              <action>'$DIR/$SCRIPT' --gtk "DELETE_FILE" "1"</action>
            </button>
          </hbox>
          <hbox>
            <progressbar>
              <input>'$DIR/$SCRIPT' --gtk "PROGRESS_BAR" "2"</input>
            </progressbar>
            <button>
              <input file icon="filesave"></input>
              <action>'$DIR/$SCRIPT' --gtk "SAVE_FILE" "2"</action>
            </button>
            <button>
              <input file icon="redo"></input>
              <action>'$DIR/$SCRIPT' --gtk "ADD_PLAYLIST" "2"</action>
              <action type="refresh">PLAYLIST</action>
            </button>
            <button>
              <input file icon="stop"></input>
              <action>'$DIR/$SCRIPT' --gtk "DELETE_FILE" "2"</action>
            </button>
          </hbox>
          <hbox>
            <progressbar>
              <input>'$DIR/$SCRIPT' --gtk "PROGRESS_BAR" "3"</input>
            </progressbar>
            <button>
              <input file icon="filesave"></input>
              <action>'$DIR/$SCRIPT' --gtk "SAVE_FILE" "3"</action>
            </button>
            <button>
              <input file icon="redo"></input>
              <action>'$DIR/$SCRIPT' --gtk "ADD_PLAYLIST" "3"</action>
              <action type="refresh">PLAYLIST</action>
            </button>
            <button>
              <input file icon="stop"></input>
              <action>'$DIR/$SCRIPT' --gtk "DELETE_FILE" "3"</action>
          </button>
          </hbox>
          <hbox>
            <progressbar>
              <input>'$DIR/$SCRIPT' --gtk "PROGRESS_BAR" "4"</input>
            </progressbar>
            <button>
              <input file icon="filesave"></input>
              <action>'$DIR/$SCRIPT' --gtk "SAVE_FILE" "4"</action>
            </button>
            <button>
              <input file icon="redo"></input>
              <action>'$DIR/$SCRIPT' --gtk "ADD_PLAYLIST" "4"</action>
              <action type="refresh">PLAYLIST</action>
            </button>
           <button>
              <input file icon="stop"></input>
              <action>'$DIR/$SCRIPT' --gtk "DELETE_FILE" "4"</action>
            </button>
          </hbox>
          <hbox>
            <progressbar>
              <input>'$DIR/$SCRIPT' --gtk "PROGRESS_BAR" "5"</input>
            </progressbar>
          <button>
             <input file icon="filesave"></input>
              <action>'$DIR/$SCRIPT' --gtk "SAVE_FILE" "5"</action>
            </button>
            <button>
              <input file icon="redo"></input>
              <action>'$DIR/$SCRIPT' --gtk "ADD_PLAYLIST" "5"</action>
              <action type="refresh">PLAYLIST</action>
            </button>
            <button>
              <input file icon="stop"></input>
              <action>'$DIR/$SCRIPT' --gtk "DELETE_FILE" "5"</action>
            </button>
          </hbox>
          <hbox>
            <progressbar>
              <input>'$DIR/$SCRIPT' --gtk "PROGRESS_BAR" "6"</input>
            </progressbar>
            <button>
              <input file icon="filesave"></input>
              <action>'$DIR/$SCRIPT' --gtk "SAVE_FILE" "6"</action>
            </button>
            <button>
              <input file icon="redo"></input>
              <action>'$DIR/$SCRIPT' --gtk "ADD_PLAYLIST" "6"</action>
              <action type="refresh">PLAYLIST</action>
            </button>
            <button>
              <input file icon="stop"></input>
              <action>'$DIR/$SCRIPT' --gtk "DELETE_FILE" "6"</action>
            </button>
          </hbox>
          <hbox>
            <progressbar>
              <input>'$DIR/$SCRIPT' --gtk "PROGRESS_BAR" "7"</input>
            </progressbar>
            <button>
              <input file icon="filesave"></input>
              <action>'$DIR/$SCRIPT' --gtk "SAVE_FILE" "7"</action>
            </button>
            <button>
              <input file icon="redo"></input>
              <action>'$DIR/$SCRIPT' --gtk "ADD_PLAYLIST" "7"</action>
              <action type="refresh">PLAYLIST</action>
            </button>
            <button>
              <input file icon="stop"></input>
              <action>'$DIR/$SCRIPT' --gtk "DELETE_FILE" "7"</action>
            </button>
          </hbox>
          <hbox>
            <progressbar>
              <input>'$DIR/$SCRIPT' --gtk "PROGRESS_BAR" "8"</input>
            </progressbar>
            <button>
              <input file icon="filesave"></input>
              <action>'$DIR/$SCRIPT' --gtk "SAVE_FILE" "8"</action>
            </button>
            <button>
              <input file icon="redo"></input>
              <action>'$DIR/$SCRIPT' --gtk "ADD_PLAYLIST" "8"</action>
              <action type="refresh">PLAYLIST</action>
            </button>
            <button>
              <input file icon="stop"></input>
              <action>'$DIR/$SCRIPT' --gtk "DELETE_FILE" "8"</action>
          </button>
          </hbox>
          <hbox>
            <progressbar>
              <input>'$DIR/$SCRIPT' --gtk "PROGRESS_BAR" "9"</input>
            </progressbar>
            <button>
              <input file icon="filesave"></input>
              <action>'$DIR/$SCRIPT' --gtk "SAVE_FILE" "9"</action>
            </button>
            <button>
              <input file icon="redo"></input>
              <action>'$DIR/$SCRIPT' --gtk "ADD_PLAYLIST" "9"</action>
              <action type="refresh">PLAYLIST</action>
            </button>
            <button>
              <input file icon="stop"></input>
              <action>'$DIR/$SCRIPT' --gtk "DELETE_FILE" "9"</action>
            </button>
          </hbox>
          <hbox>
            <progressbar>
              <input>'$DIR/$SCRIPT' --gtk "PROGRESS_BAR" "10"</input>
            </progressbar>
            <button>
              <input file icon="filesave"></input>
              <action>'$DIR/$SCRIPT' --gtk "SAVE_FILE" "10"</action>
            </button>
            <button>
              <input file icon="redo"></input>
              <action>'$DIR/$SCRIPT' --gtk "ADD_PLAYLIST" "10"</action>
              <action type="refresh">PLAYLIST</action>
            </button>
            <button>
              <input file icon="stop"></input>
              <action>'$DIR/$SCRIPT' --gtk "DELETE_FILE" "10"</action>
            </button>
          </hbox>
          <hbox>
            <text>
              <input>echo "Raffraichir les barres toutes les"</input>
            </text>
            <text>
              <input>grep REFRESH_DELAY= $CONF_DIR/get-canal.cfg | cut -d"=" -f2</input>
              <variable>REFRESH_DELAY</variable>
            </text>
            <text>
              <input>echo "secondes"</input>
            </text>
          </hbox>
          <hbox>
            <button>
              <input file icon="gtk-remove"></input>
              <action>REFRESH_DELAY=$(grep REFRESH_DELAY= $CONF_DIR/get-canal.cfg | cut -d"=" -f2) ; if [ "$REFRESH_DELAY" -gt "1" ] ; then RD=$(($REFRESH_DELAY-1)) ; sed -i "/REFRESH_DELAY=/s/=.*/=$RD/g" $CONF_DIR/get-canal.cfg ; fi</action>
              <action type="refresh">REFRESH_DELAY</action>
            </button>
            <button>
              <input file icon="gtk-add"></input>
              <action>REFRESH_DELAY=$(grep REFRESH_DELAY= $CONF_DIR/get-canal.cfg | cut -d"=" -f2) ; if [ "$REFRESH_DELAY" -lt "5" ] ; then RD=$(($REFRESH_DELAY+1)) ; sed -i "/REFRESH_DELAY=/s/=.*/=$RD/g" $CONF_DIR/get-canal.cfg ; fi</action>
              <action type="refresh">REFRESH_DELAY</action>
            </button>
          </hbox>
        </frame>
        <frame Playlist>
          <tree headers_visible="false">
            <width>200</width><height>250</height>
            <label>Titre</label>
            <input>cat $TEMP_DIR/playlist.info</input>
            <variable>PLAYLIST</variable>
            <action>sed -i "/$PLAYLIST */d" "$TEMP_DIR/playlist.info" ; sed -i "/$PLAYLIST */d" "$TEMP_DIR/playlist.m3u"</action>
            <action type="refresh">PLAYLIST</action>
          </tree>
          <hbox>
            <button>
              <input file icon="player_play"></input>
              <action>if [ "$VIDEO_PLAYER" = "mplayer" ] ; then VIDEO_PLAYER="mplayer -playlist" ; fi ; '$VIDEO_PLAYER' "$TEMP_DIR/playlist.m3u" & echo $!>$TEMP_DIR/video_player.pid</action>
              <action type="enable">STOP</action>
              <action type="disable">PLAY</action>
              <variable>PLAY</variable>
            </button>
            <button sensitive="false">
              <input file icon="player_stop"></input>
              <action>kill -9 $(head -1 "$TEMP_DIR/video_player.pid") & rm -f "$TEMP_DIR/video_player.pid">$TEMP_DIR/video_player.pid</action>
              <action type="enable">PLAY</action>
              <action type="disable">STOP</action>
              <variable>STOP</variable>
            </button>
          </hbox>
        </frame>
      </hbox>
    </notebook>
    <hbox>
      <button>
        <input file icon="exit"></input>
        <label>Quitter</label>
        <action type="exit">OK</action>
      </button>
    </hbox>
  </vbox>
</window>
'
##### Execution du script. #####
# Vérification de l'existance d'un dossier de configuration et lancement éventuel de la fenêtre de configuration.
if [ ! -d "$CONF_DIR" ] ; then
	mkdir "$CONF_DIR"
	echo "REFRESH_DELAY=1" >>$CONF_DIR/get-canal.cfg
	VARIABLES=`gtkdialog --program=MAIN_CONFIG`
	eval $VARIABLES
	if [ "$EXIT" != "OK" ] ; then
		exit 1
	fi
	if grep "DOWNLOAD_DIR=" $CONF_DIR/get-canal.cfg ; then
		config=$(grep -v "DOWNLOAD_DIR=" $CONF_DIR/get-canal.cfg)
		echo -e "$config\nDOWNLOAD_DIR=$FILE_DIRECTORY" >$CONF_DIR/get-canal.cfg
	else
		echo "DOWNLOAD_DIR=$FILE_DIRECTORY" >>$CONF_DIR/get-canal.cfg
	fi
	export DOWNLOAD_DIR="$FILE_DIRECTORY"
	if grep "VIDEO_PLAYER=" $CONF_DIR/get-canal.cfg ; then
		config=$(grep -v "VIDEO_PLAYER=" $CONF_DIR/get-canal.cfg)
		echo -e "$config\nVIDEO_PLAYER=$VIDEO_PLAYER" >$CONF_DIR/get-canal.cfg
	else
		echo "VIDEO_PLAYER=$VIDEO_PLAYER" >>$CONF_DIR/get-canal.cfg
	fi
else
	export DOWNLOAD_DIR="$(grep DOWNLOAD_DIR= $CONF_DIR/get-canal.cfg | cut -d"=" -f2)"
	export VIDEO_PLAYER="$(grep VIDEO_PLAYER= $CONF_DIR/get-canal.cfg | cut -d"=" -f2)"
	if [ "$DOWNLOAD_DIR" = "" ] || [ "$VIDEO_PLAYER" = "" ] ; then
		touch $CONF_DIR/get-canal.cfg
		VARIABLES=`gtkdialog --program=MAIN_CONFIG`
		eval $VARIABLES
		if [ "$EXIT" != "OK" ] ; then
			exit 1
		fi
		if grep "DOWNLOAD_DIR=" $CONF_DIR/get-canal.cfg ; then
			config=$(grep -v "DOWNLOAD_DIR=" $CONF_DIR/get-canal.cfg)
			echo -e "$config\nDOWNLOAD_DIR=$FILE_DIRECTORY" >$CONF_DIR/get-canal.cfg
		else
			echo "DOWNLOAD_DIR=$FILE_DIRECTORY" >>$CONF_DIR/get-canal.cfg
		fi
		export DOWNLOAD_DIR="$FILE_DIRECTORY"
		if grep "VIDEO_PLAYER=" $CONF_DIR/get-canal.cfg ; then
			config=$(grep -v "VIDEO_PLAYER=" $CONF_DIR/get-canal.cfg)
			echo -e "$config\nVIDEO_PLAYER=$VIDEO_PLAYER" >$CONF_DIR/get-canal.cfg
		else
			echo "VIDEO_PLAYER=$VIDEO_PLAYER" >>$CONF_DIR/get-canal.cfg
		fi
	fi
fi
if ! grep REFRESH_DELAY=. $CONF_DIR/get-canal.cfg ; then
	echo "REFRESH_DELAY=1" >>$CONF_DIR/get-canal.cfg
fi
if ! grep EMISSION=.* $CONF_DIR/get-canal.cfg ; then
	echo "EMISSION=\"+ Clair226\"" >>$CONF_DIR/get-canal.cfg
fi

# Préparation du dossier temporaire.
if [ ! -d "$TEMP_DIR" ] ; then
	mkdir -p $TEMP_DIR/videos
else 
	rm -rf $TEMP_DIR/* ; mkdir -p $TEMP_DIR/videos
fi
touch $TEMP_DIR/progress_bar.list
for i in $(seq 1 10) ; do
	echo "0" >$TEMP_DIR/progress_bar$i.log
done

echo "0" >/$TEMP_DIR/playlist.id
# Chargement de la liste de la dernière emission affichée.
SHOW_LIST $(grep EMISSION= $CONF_DIR/get-canal.cfg | cut -d"\"" -f2 | sed -e 's/.*(\(.*\))/\1/g')
echo $(grep EMISSION= $CONF_DIR/get-canal.cfg | cut -d"\"" -f2) >$TEMP_DIR/show_list

# Lancement de la fenêtre principale.
gtkdialog --program=MAIN_PROGRAMM

# Supression du dossier temporaire.
rm -rf "$TEMP_DIR"

# "Kill" des processus résiduels.
killall $(basename $SCRIPT)
for i in $(ps aux | grep "/tmp/get-canal.tmp/" | grep -v grep | tr -s ' ' | cut -d" " -f2) ; do
	kill -9 $i
done
exit 0

Dernière modification par redisded (Le 20/02/2009, à 01:18)

Hors ligne

#66 Le 20/02/2009, à 00:17

AnsuzPeorth

Re : get-canal, le retour...

je viens de testé, j'ai mis un nom quelconque au script ?

~$ '/home/yoanne/dl_canal.sh' 
grep: /home/yoanne/.get-canal.conf/get-canal.cfg: Aucun fichier ou dossier de ce type
grep: /home/yoanne/.get-canal.conf/get-canal.cfg: Aucun fichier ou dossier de ce type
REFRESH_DELAY=1
--23:13:41--  http://www.vosflux.tv/emission/+/rss
           => `-'
Résolution de www.vosflux.tv... 213.186.33.2
Connexion vers www.vosflux.tv|213.186.33.2|:80... connecté.
requête HTTP transmise, en attente de la réponse... 200 OK
Longueur: non spécifié [text/xml]

    [ <=>                                 ] 477           --.--K/s             

23:13:42 (39.34 MB/s) - « - » sauvegardé [477]

/title
/home/yoanne/dl_canal.sh: line 639: 31579 Processus arrêté      gtkdialog --program=POPUP
cat: Clair226: Aucun fichier ou dossier de ce type
cat: /tmp/get-canal.tmp/playlist.info: Aucun fichier ou dossier de ce type
gtkdialog: ../../src/xcb_lock.c :33 : _XCBUnlockDisplay:  L'assertion « xcb_get_request_sent(dpy->xcb->connection) == dpy->request » a échoué.
/home/yoanne/dl_canal.sh: line 641: 31615 Abandon                 gtkdialog --program=MAIN_PROGRAMM
Terminated
Terminated
Terminated
Terminated
Terminated
Terminated
Terminated
Complété

Le dossier dans tmp n'est pas crée ?!!!


Interface graphique pour bash, python ou autre: glade2script
Support Tchat: http://chat.jabberfr.org/muckl_int/inde … ade2script  (Hors ligne)

Hors ligne

#67 Le 20/02/2009, à 00:24

redisded

Re : get-canal, le retour...

Les messages d'erreurs concernant les fichiers temporaires sont normaux; à ce stade, il ne sont pas encore créé.

Par contre, l'erreur gtkdialog m'arrive de temps en temps (comme des erreurs de segmentation), mais dans ces cas la, je relance le script et ca passe; as-tu essayé de le lancer plusieures fois?

Hors ligne

#68 Le 20/02/2009, à 00:28

AnsuzPeorth

Re : get-canal, le retour...

Ca vient bien de là, tu ne crée pas le dossier dans tmp, ca vient de la le bug.

Sinon, ca fait peur...:) le nombre de boucle, essai d'utiliser inotail, tu n'auras pas tout ces process consommateur.

La progressbar fonctionne correctement. (par contre, j'ai du merdais, j'ai pas reussi a lire le fichier via ton interface, j'ai sauvegarde avant de le passé en playlist....)


Interface graphique pour bash, python ou autre: glade2script
Support Tchat: http://chat.jabberfr.org/muckl_int/inde … ade2script  (Hors ligne)

Hors ligne

#69 Le 20/02/2009, à 00:31

AnsuzPeorth

Re : get-canal, le retour...

Une fois le dossier crée dans tmp, plus de souci, j'avais essayé de le lancer deux fois avant de crée ce dossier.


Interface graphique pour bash, python ou autre: glade2script
Support Tchat: http://chat.jabberfr.org/muckl_int/inde … ade2script  (Hors ligne)

Hors ligne

#70 Le 20/02/2009, à 00:41

AnsuzPeorth

Re : get-canal, le retour...

Un truc en passant, ca serait pas mieux d'envoyer direct dans le tree playlist dès la fin du telechargement, et la gestion depuis ce tree (lire,effacer,sauver), ca ferait moins de boutons et j'aurais pas merdais pour lire la vidéo (c'est ma vision de newbie_user...)

Chez moi, au repos, ton soft prends 10% cpu.....


Interface graphique pour bash, python ou autre: glade2script
Support Tchat: http://chat.jabberfr.org/muckl_int/inde … ade2script  (Hors ligne)

Hors ligne

#71 Le 20/02/2009, à 01:23

redisded

Re : get-canal, le retour...

Alors,
Pour le dossier tmp, je ne comprend pas, tu peut verifier par toi-meme à la ligne 620 du script, si le dossier temp n'existe pas, il doit etre créé! je vais fouiller ca. (si tu pouvait poster le retour d'un bash -x ...)

Pour les boucles, ca fait peur et ca bouffe des ressources, c'est clair. Je vient de faire un essai avec inotail sur une barre, ca fonctionne. Je vais généraliser à toutes les barres et voir ce que ca donne niveau ressources. Quoi qu'il en soit, ca ne peut pas être pire et l'utilisation d'inotail me fais économiser en lignes comme en clareté donc c'est quasiment adopté.

Concernant le fait que tu ai "merdé". J'avais essayé de prévoir le coup :
Normalement si tu ajoute la video pas encore sauvegardée à la playlist, elle est référencée avec l'adresse du dossier temporaire; si tu la sauvegarde apres, le script modifie le chemin dans la playlist. C'est bien ce qu'il fait, mais un petit oubli dans mon sed génerait un mauvais nom de dossier. Je viens de modifier ca dans mon post précédant.

Sinon concernant le pb de la playlist envoyé directement dans le tree, ce qui me chifonne c'est que l'user va selectionner ses emissions dans un certain ordre, et que les vidéos se termineront forcément dans un ordre différent.
Bon apres je pourrait contourner le pb en rajoutant une gestion de l'ordre de la playlist mais bon... je vais y réfléchir.

EDIT : 10% de charge cpu économisée grace à inotail, merci à toi AnsuzPeorth wink

RE-EDIT : Je viens d'avoir 5-6 fois de suite le message que tu as eu précédemment. j'ai insisté, au bout d'un moment l'interface c'est enfin lancé. Je doute sincèrement que le souci vienne du dossier temp ; maintenant, j'ai aucune idée d'où ca peut venir sad

Dernière modification par redisded (Le 20/02/2009, à 01:57)

Hors ligne

#72 Le 20/02/2009, à 02:16

AnsuzPeorth

Re : get-canal, le retour...

Chez moi, l'interface se lance correctement maintenant...

Par contre, pas de lecture du flv telecharger. J'ai choisi mplayer comme lecteur par defaut, une fois le fichier fini, je clic sur la fleche orange (diretion droit) qui bascule le fichier dans le tree playlit, je clique sur lecture, fichier selectionné ou non, le lecteur ne se lance po.

01:09:09 (243.89 KB/s) - « /tmp/get-canal.tmp/videos/Pépites_sur_le_net_18-02-09.flv » sauvegardé [28638090/28638090]
/home/yoanne/dl_canal.sh: line 120: notify-send : commande introuvable
cat: /tmp/get-canal.tmp/playlist.m3u: Aucun fichier ou dossier de ce type
MPlayer 1.0rc2-4.2.3 (C) 2000-2007 MPlayer Team
CPU: Intel(R) Pentium(R) 4 CPU 3.00GHz (Family: 15, Model: 4, Stepping: 3)
CPUflags:  MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 1
Compiled with runtime CPU detection.
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.

Playing /tmp/get-canal.tmp/playlist.m3u.
Win32 LoadLibrary failed to load: avisynth.dll, /usr/lib/win32/avisynth.dll, /usr/local/lib/win32/avisynth.dll


Exiting... (End of file)

Si je lance le flash en console avec mplayer, pas de problème, la lecture s'effectue correctement.


edit: le problème vient du m3u, mplayer accepte des listes simples, t'embete pas à faire des m3u smile

voila les message now:

01:22:30 (243.97 KB/s) - « /tmp/get-canal.tmp/videos/Pépites_sur_le_net_11-02-09.flv » sauvegardé [37146434/37146434]
/home/yoanne/dl_canal.sh: line 120: notify-send : commande introuvable
grep: /tmp/get-canal.tmp/playlist.info: Aucun fichier ou dossier de ce type
/home/yoanne/dl_canal.sh: line 140: notify-send : commande introuvable
/home/yoanne/dl_canal.sh: line 140: notify-send : commande introuvable
cat: /tmp/get-canal.tmp/playlist.info: Aucun fichier ou dossier de ce type
cat: /tmp/get-canal.tmp/playlist.m3u: Aucun fichier ou dossier de ce type
MPlayer 1.0rc2-4.2.3 (C) 2000-2007 MPlayer Team

Dernière modification par AnsuzPeorth (Le 20/02/2009, à 02:29)


Interface graphique pour bash, python ou autre: glade2script
Support Tchat: http://chat.jabberfr.org/muckl_int/inde … ade2script  (Hors ligne)

Hors ligne

#73 Le 20/02/2009, à 03:34

redisded

Re : get-canal, le retour...

Arf ben en fait je t'ai filé le script pour des tests mais comme dit plus haut, j'étais en train de peaufiner wink
Le pb ne vient pas des m3u (d'ailleurs les m3u ne contiennent qu'une ligne d'en-tete et le nom des fichiers, dificile de faire plus simple; de plus j'utilise le m3u car mplayer n'est pas le seul lecteur proposé par le script, et tous lisent les m3u.)

J'ai actuellement de plus de plus de mal à lancer le script, de plus, j'ai intégré la solution avec inotail mais j'ai encore quelques bugs sur les barres de progressions ; je verrais donc plus tard pour régler ce pb, en attendant, tu peut modifier manuellement ton fichier de configuration (/home/$USER/.get-canal.conf/get-canal.cfg) et remplacer la ligne :

VIDEO_PLAYER=mplayer

par

VIDEO_PLAYER=mplayer -playlist

Je vient de tester, ca fonctionne.

Le pb vient du fait que mplayer est le seul lecteur qui à besoin qu'on lui passe l'option "-playlist" pour lire la playlsit, si on lui balance comme ca en argument (comme les autres l'acceptent), on obtient le message d'erreur que tu as posté.

Hors ligne

#74 Le 20/02/2009, à 04:18

redisded

Re : get-canal, le retour...

Apres une petite recherche google, j'ai trouvé ce post :

http://www.wxdev.fr/topic367-Probleme_p … Linux.html

Il semble que ca arrive plus souvent quand on lance le script avec bash -x

Je posterais une question sur le sujet dans le forum approprié de ce site demain, on ne sait jamais...

Hors ligne

#75 Le 20/02/2009, à 04:23

AnsuzPeorth

Re : get-canal, le retour...

Faut faire attention, gtkdialog est trés capricieux....doit avoir un truc qui lui plait po, faut trouver koi...! smile


Interface graphique pour bash, python ou autre: glade2script
Support Tchat: http://chat.jabberfr.org/muckl_int/inde … ade2script  (Hors ligne)

Hors ligne