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.

#26 Le 30/05/2013, à 21:09

hishaime

Re : boomeranga! pour les amateurs de mangas

je viens de dl le deb. Toujours du bon taff, c'est super pour le support de scan en anglais.
Parmi les remarques :
1)au début on peut choisir de convertir ou pas en pdf ==> pourrais-tu modifier le bouton d'option en case à cocher. Car si on clique sans le faire exprès sur "convertir en pdf", impossible d'annuler sans relancer le script.
2) En lançant boomeranga, je n'ai pas pu choisir où les scan allait être téléchargé (ce qui était possible dans une version), ça a crée automatiquement un dossier boomeranga dans mon home ==> peut-on revenir à une sélection du dossier (ou le mettre en choix dans le menu)

Voilà ! merci encore pour ton travail wink

Hors ligne

#27 Le 31/05/2013, à 07:36

WeetabiX

Re : boomeranga! pour les amateurs de mangas

Noté,
Les corrections ne devraient pas tarder wink

Hors ligne

#28 Le 31/05/2013, à 10:16

WeetabiX

Re : boomeranga! pour les amateurs de mangas

Voilà la version 0.9.3 qui apporte :

0.9.3
support mangafox :
    * reconnaissance 404
    * poursuite séries
ajout option changement chemin
petites améliorations diverses

#!/bin/bash
#weetabix' 2013 v0.9.3

##################
#  Boomeranga!   #
##################

v=0.9.3

#fonction télécharger()
function télécharger {
mkdir $manga
cd $PWD/$manga/

#connaitre chapitre max d'1 manga
wget http://www.lecture-en-ligne.com/$manga/1/0/0/1.html -O infochap
grep -A 1 'id="chap"' infochap > infochap2
head -2 infochap2 | tail -1 > infochap
cut -d ">" -f2 infochap | cut -d "<" -f1 > infochap2
chap_man=`cat $PWD/infochap2`

#Poursuivre série ?
test -f $PWD/chaplast
if [ $? = 0 ]
then
	chap=`cat $PWD/chaplast`
else
	chap=`zenity --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --entry --cancel-label "Quitter" --text "Commencer à quel chapitre ?"` || exit
fi

im=01
chapn=$(($chap_man-$chap+1)) # définir chapitres restant

`zenity --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --question --text "$manga - Télécharger tous les chapitres disponibles ?   [$chap_man paru(s) / $chapn nouveau(x)]"`
#si sélection perso
if [ $? = 0 ]
then
	chapmax=$chap_man
	let chapmax=chapmax+1
else
	chapmax=`zenity --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --cancel-label "Quitter" --entry --text "Stopper à quel chapitre ?   [vous êtes au n°$chap]"` || exit
	let chapmax=chapmax+1
fi

while [ $chap != $chapmax ]
do

mkdir $chap
cd $PWD/$chap/

#rechercher le nb de pages du chapitre
wget http://www.lecture-en-ligne.com/$manga/$chap/0/0/1.html -O info
grep 'current_total_pages' info > info2
cut -d "'" -f2 info2 > info3
imax=`cat $PWD/info3`

let imaxi=imax+1

#vérif page 404
erreur=`grep -c 'ERREUR 404' info`
if [ $erreur = 1 ]
then zenity --error --title "boomeranga!" --text "Manga/chapitre non trouvé - abandon"
	cd $ch
	mv $PWD/$manga $HOME/.local/share/Trash/files & exit
fi

#info
notify-send -i /usr/share/pixmaps/boomeranga.svg -t 2000 "Téléchargement du chapitre $chap"

#récupérer les images 1 à 7
while [ $im != 08 ]
do 
	wget http://www.lecture-en-ligne.com/images/mangas/$manga/$chap/$im.jpg
	let im=im+1
	im=0$im
done

#récupérer les images 8 & 9 (erreur boucle while pour 08, à corriger plus tard)
im=08
wget http://www.lecture-en-ligne.com/images/mangas/$manga/$chap/$im.jpg
im=09
wget http://www.lecture-en-ligne.com/images/mangas/$manga/$chap/$im.jpg

#récupérer les images suivantes - envisager chapitres courts !
im=10
while [ $im != $imaxi ]
do 
	wget http://www.lecture-en-ligne.com/images/mangas/$manga/$chap/$im.jpg
	let im=im+1
done

#création du .cbz
rm $PWD/info & rm $PWD/info2 & rm $PWD/info3
zip -r $chap.cbz .
mv $chap.cbz ..
cd ..
rm -r $PWD/$chap

#conversion pdf
if [ $pdf = "o" ]
then
	ebook-convert $chap.cbz $chap.pdf --right2left | zenity --title "boomeranga!" --progress --text "Création de $manga $chap.pdf" --auto-close --auto-kill
fi

#changement de chapitre
let chap=chap+1
im=01
done

rm $PWD/infochap
echo $chapmax > $PWD/chaplast

#inscrire manga dans liste 'séries' sauf si déjà présent
cd ..
grep $manga séries
if [ $? != 0 ]
then
	echo $manga >> séries
fi
zenity --info --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --text "Vous trouverez les chapitres téléchargés dans le dossier <b>$ch</b> Bonne lecture! "
menu
}

function poursuite_series {
`zenity --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --question --text "Poursuivre les séries en cours (si liste de suivi non vide) ?"`
if [ $? = 0 ]
then
	nb_ligm=`wc -l séries | cut -d " " -f1`
	let nb_ligm=nb_ligm+1
	nb_lig=1
	while [ $nb_lig != $nb_ligm ]
	do
	manga=`head -n $nb_lig séries | tail -n 1`
	télécharger
	let nb_lig=nb_lig+1
	done
else
	manga=`zenity --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --entry --cancel-label "Quitter" --text "Nouveau manga - nom du manga ?"` || exit

	#si manga vide
	if [ -z $manga ]
	then zenity --error --title "boomeranga!" --text "Erreur dans le nom - abandon" & exit
	fi

	télécharger
fi
}

function poursuite_series_mangafox {
`zenity --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --question --text "Poursuivre les séries en cours (si liste de suivi non vide) ?"`
if [ $? = 0 ]
then
	nb_ligm=`wc -l séries.mfox | cut -d " " -f1`
	let nb_ligm=nb_ligm+1
	nb_lig=1
	while [ $nb_lig != $nb_ligm ]
	do
	manga=`head -n $nb_lig séries.mfox | tail -n 1`
	télécharger_mangafox
	let nb_lig=nb_lig+1
	done
else
	manga=`zenity --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --entry --cancel-label "Quitter" --text "Nouveau manga - nom du manga ?"` || exit

	#si manga vide
	if [ -z $manga ]
	then zenity --error --title "boomeranga!" --text "Erreur dans le nom - abandon" & exit
	fi

	télécharger_mangafox
fi
}

#fonction télécharger_mangafox() / pas info chap. max
#=>vol inutile (oui et non) car redirection auto fct chapitre
function télécharger_mangafox {

mkdir $manga
cd $PWD/$manga/

#Poursuivre série ?
test -f $PWD/chaplast
if [ $? = 0 ]
then
	chap=`cat $PWD/chaplast`
else
	chap=`zenity --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --entry --cancel-label "Quitter" --text "Commencer à quel chapitre ? (forme c001)"` || exit
fi

vol="v01"
chapmax=`zenity --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --entry --cancel-label "Quitter" --text "$manga - Stopper à quel chapitre (forme c001+1)? [vous êtes au n°$chap]"` || exit
im=1

while [ $chap != $chapmax ]
do
mkdir -p $vol$chap
cd $PWD/$vol$chap/

#rechercher le nb de pages du chapitre
wget -U=firefox http://mangafox.me/manga/$manga/$vol/$chap/$im.html -O info
grep 'var total_pages=' info > info2
cut -d "=" -f2 info2 | cut -d ";" -f1 > info3
imax=`cat $PWD/info3`
let imaxi=imax+1

#404
erreur=`cat $PWD/info`
[[ $erreur ]]
if [ $? = 1 ]
then
	zenity --error --title "boomeranga!" --text "Manga/chapitre non trouvé - abandon"
	cd $ch
	mv $PWD/$manga $HOME/.local/share/Trash/files & exit
fi

#info
notify-send -i /usr/share/pixmaps/boomeranga.svg -t 2000 "Téléchargement du chapitre $chap"

#récupérer les images du chapitre
while [ $im != $imaxi ]
do 
	wget -U=firefox http://mangafox.me/manga/$manga/$vol/$chap/$im.html -O infochap
	grep -A 1 'onclick="return enlarge()"><img src=' infochap > infochap2
	head -1 infochap2 > infochap
	cut -d '"' -f6 infochap | cut -d '"' -f1 > infochap2
	chi=`cat $PWD/infochap2`
	wget -U=firefox $chi
	let im=im+1
done

#création du .cbz
mv $PWD/info $HOME/.local/share/Trash/files
mv $PWD/info2 $HOME/.local/share/Trash/files
mv $PWD/info3 $HOME/.local/share/Trash/files
mv $PWD/infochap $HOME/.local/share/Trash/files
mv $PWD/infochap2 $HOME/.local/share/Trash/files

zip -r $vol$chap.cbz .
mv $vol$chap.cbz ..
cd ..
rm -r $PWD/$vol$chap

#conversion pdf
if [ $pdf = "o" ]
then
	ebook-convert $vol$chap.cbz $vol$chap.pdf --right2left | zenity --title "boomeranga!" --progress --text "Création de $manga $vol$chap.pdf" --auto-close --auto-kill
fi

#changement de chapitre / volume
wget -U=firefox http://mangafox.me/manga/$manga/$vol/$chap/$im.html -O infovol
grep '<p><span>Next Chapter:</span>' infovol > infovol2
cut -d "/" -f7 infovol2 > infovol
vol=`cat $PWD/infovol`
cut -d "/" -f8 infovol2 > infovol
chap=`cat $PWD/infovol`
im=1
done

echo $chapmax > $PWD/chaplast

#inscrire manga dans liste 'séries' sauf si déjà présent
cd ..
grep $manga séries.mfox
if [ $? != 0 ]
then
	echo $manga >> séries.mfox
fi

zenity --info --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --text "Vous trouverez les chapitres téléchargés dans le dossier <b>$ch</b> Bonne lecture! "
cd $ch
menu
}

#### intro ####
zenity --info --ok-label "Go!" --timeout "2" --title "boomeranga! v$v" --window-icon "/usr/share/pixmaps/boomeranga.svg" --text "<b>boomeranga!</b> vous permet de télécharger 
des planches de manga depuis :

   * lecture-en-ligne.com (FR)
   * mangafox.me (EN)

Bonne lecture!"

#création chemin boomeranga
test -f $HOME/.boomeranga/ch
if [ $? = 1 ]
then
	mkdir -p $HOME/.boomeranga
	ch_tmp=`zenity --file-selection --window-icon "/usr/share/pixmaps/boomeranga.svg" --title "Choisir le dossier des téléchargements boomeranga!" --directory`
	echo $ch_tmp/boomeranga > $HOME/.boomeranga/ch
fi

#info màj
cd $HOME/.boomeranga/
wget http://goupil.eu/repo/boomeranga_version -O version
v2=`head -n 1 $HOME/.boomeranga/version`
[ $v = $v2 ] || zenity --info --ok-label "Ok" --timeout "2" --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --text "La version $v2 est disponible"

#vérification présence fichiers 'séries' et création si besoin
function séries {
ch=`cat $HOME/.boomeranga/ch`
mkdir -p $ch/
cd $ch
test -f $PWD/séries
if [ $? = 1 ]
then
	> séries
fi
test -f $PWD/séries.mfox
if [ $? = 1 ]
then
	> séries.mfox
fi
}

function ch_maj {
ch_tmp=`zenity --file-selection --window-icon "/usr/share/pixmaps/boomeranga.svg" --title "Choisir le dossier des téléchargements boomeranga!" --directory`
echo $ch_tmp/boomeranga > $HOME/.boomeranga/ch_new
ch=`cat $HOME/.boomeranga/ch`
ch_new=`cat $HOME/.boomeranga/ch_new`
mv $ch $ch_new
mv $HOME/.boomeranga/ch_new $HOME/.boomeranga/ch
zenity --info --ok-label "bye!" --timeout "5" --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --text "Merci de redémarrer boomeranga! pour que les
changements soient effectifs" & exit
}

#option pdf
function convert_pdf {
pdf=`zenity --list --checklist --cancel-label "Quitter" --title "boomeranga!" --text "Convertir en .pdf ?" --column=option --column=description 1 "activer conversion pdf"` || exit
case "${pdf}" in
"") pdf=""
;;
esac

if [[ -z $pdf ]]
then pdf="n"
else pdf="o"
fi
}
séries

#menu général avec `case`
function menu {
option=`zenity --list --window-icon "/usr/share/pixmaps/boomeranga.svg" --width "350" --height "330" --cancel-label "Quitter" --title "boomeranga!" --text "Menu principal" --column=option --column=description 1 "Télécharger mangas (FR)" 2 "Voir/Modifier liste de suivi (FR)" \
3 "Télécharger mangas (EN)" 4 "Voir/Modifier liste de suivi (EN)" 5 "================" 6 "Modifier le chemin de boomeranga!" 7 "Consulter l'aide en ligne" 8 "Demander une fonctionnalité"` || exit
case "${option}" in
1) poursuite_series
;;
2) zenity --text-info --editable --cancel-label "Quitter" --filename "$ch/séries" > $ch/séries_maj &&
mv $PWD/séries $HOME/.local/share/Trash/files && mv $PWD/séries_maj $PWD/séries && menu
;;
3) poursuite_series_mangafox
;;
4) zenity --text-info --editable --cancel-label "Quitter" --filename "$ch/séries.mfox" > $ch/séries.mfox_maj &&
mv $PWD/séries.mfox $HOME/.local/share/Trash/files && mv $PWD/séries.mfox_maj $PWD/séries.mfox && menu
;;
5) echo "y'a rien ici :p" && menu
;;
6) ch_maj && menu
;;
7) xdg-open 'http://blog.goupil.eu/?boomeranga' & menu
;;
8) xdg-open 'http://forum.ubuntu-fr.org/viewtopic.php?id=1282211' & menu
;;
esac
}

convert_pdf
#### lancement boomeranga! ####
menu

big_smile

Hors ligne

#29 Le 31/05/2013, à 11:31

hishaime

Re : boomeranga! pour les amateurs de mangas

Ouah vachement rapide la MàJ !

Petite question, vu que je suis débutant sur Ubuntu, je voudrais savoir la manip a faire pour pouvoir enregistré le dépot, histoire d'automatiser en faisant un apt-get update boomeranga pour activer la mise à jour. C'est possible?

Hors ligne

#30 Le 31/05/2013, à 12:13

Hizoka

Re : boomeranga! pour les amateurs de mangas

Salut, quelques infos de codage :
- Il ne faut plus utiliser `` mais $()
- Il est fortement conseillé d'encadrer les variables de ${} pour eviter des erreurs d'interpretations
- Les `` servent à executer une commande afin de transmettre le resultat à une variable, tu les utilises inutilement regulierement ?!

`zenity --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --question --text "$manga - Télécharger tous les chapitres disponibles ?   [$chap_man paru(s) / $chapn nouveau(x)]"`

`zenity --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --question --text "Poursuivre les séries en cours (si liste de suivi non vide) ?"`

Propositions de simplification :

let chapmax=chapmax+1
=>
((chapmax++))
wget http://www.lecture-en-ligne.com/$manga/1/0/0/1.html -O infochap
grep -A 1 'id="chap"' infochap > infochap2
head -2 infochap2 | tail -1 > infochap
cut -d ">" -f2 infochap | cut -d "<" -f1 > infochap2
chap_man=`cat $PWD/infochap2`

en

chap_man=$(wget -qO - http://www.lecture-en-ligne.com/${manga}/1/0/0/1.html | sed -n "/http:\/\/www.lecture-en-ligne.com\/${manga}\/6\/0\/0\/1.html/ s@[^>]*>\([0-9]*\).*@\1@p")

Pourquoi ne pas regrouper des fenetres :

`zenity --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --question --text "$manga - Télécharger tous les chapitres disponibles ?   [$chap_man paru(s) / $chapn nouveau(x)]"`
+
chapmax=`zenity --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --cancel-label "Quitter" --entry --text "Stopper à quel chapitre ?   [vous êtes au n°$chap]"` || exit

=>

zenity --forms --title "boomeranga" --cancel-label "Quitter" --add-entry "Chapitre minimum" --add-entry "Chapitre maximum" --window-icon "/usr/share/pixmaps/boomeranga.svg"
wget http://www.lecture-en-ligne.com/$manga/$chap/0/0/1.html -O info
grep 'current_total_pages' info > info2
cut -d "'" -f2 info2 > info3
imax=`cat $PWD/info3`

=>

imax=$(wget -qO - http://www.lecture-en-ligne.com/${manga}/${chap}/0/0/1.html | sed -n "/current_total_pages/ s/.*'\([0-9]*\)'.*/\1/p")

Pour la verif 404, il te suffit de verifier que la variable imax est vide et au pire retester avec :

if [[ $(wget -qO - http://www.lecture-en-ligne.com/${manga}/${chap}/0/0/1.html | grep -c 'ERREUR 404') ]]

ouha pourquoi faire simple quand on peut faire ca tongue

#récupérer les images 1 à 7
while [ $im != 08 ]
do 
	wget http://www.lecture-en-ligne.com/images/mangas/$manga/$chap/$im.jpg
	let im=im+1
	im=0$im
done

#récupérer les images 8 & 9 (erreur boucle while pour 08, à corriger plus tard)
im=08
wget http://www.lecture-en-ligne.com/images/mangas/$manga/$chap/$im.jpg
im=09
wget http://www.lecture-en-ligne.com/images/mangas/$manga/$chap/$im.jpg

#récupérer les images suivantes - envisager chapitres courts !
im=10
while [ $im != $imaxi ]
do 
	wget http://www.lecture-en-ligne.com/images/mangas/$manga/$chap/$im.jpg
	let im=im+1
done

=>

for im in $(seq -w ${imaxi})
do
  wget http://www.lecture-en-ligne.com/images/mangas/$manga/$chap/$im.jpg
done

Qui marche pour des nombres de 1 chiffres, 2,3,4... (marche uniquement si petits chapitres n'a pas de 0 devant leur numero, mais toujours possible de faire tres simple)

grep $manga séries
if [ $? != 0 ]
then
	echo $manga >> séries
fi

=>

[[ $(grep "${manga}" séries) ]] && echo $manga >> séries

j'ai pas suivit d'ou vient exactement nb_ligm, mais une boucle for sera surement plus adaptée

	while [ $nb_lig != $nb_ligm ]
	do
	manga=`head -n $nb_lig séries | tail -n 1`
	télécharger
	let nb_lig=nb_lig+1
	done

Je m’arrête la (la version fr), à toi de tester mes propositions, de les comprendre, de poser des questions si besoin...

Sinon l'idée est pas mal smile
J'aime l'idée de piquer des mangas à des mecs qui piquent des mangas à d'autres mecs tongue

PS : je viens de tester le manga toriko, et il me dit erreur 404 car il n'y a pas de chapitre dispo, il faudrait ajoute rune verification afin de dire que le manga existe mais qu'il n'y a plus de chapitre dispo.

Si besoin look ma signature, mon generateur de fenetre zenity permet normalement d'utiliser toutes les options dispo de zenity.

Tu devrais mettre à jour le code du message 1 car si les gens s'arretent en le voyant, ils n'auront pas le bon.

Dernière modification par Hizoka (Le 31/05/2013, à 12:33)


KDE Neon 64bits
Tous mes softs (MKVExtractorQt, HizoSelect, HizoProgress, Qtesseract, Keneric, Services menus...) sont sur github

Hors ligne

#31 Le 31/05/2013, à 13:12

WeetabiX

Re : boomeranga! pour les amateurs de mangas

Merci Hizoka pour tes conseils, je vais améliorer le code en conséquence wink

hishaime, pour ajouter mon dépôt, il faut ajouter la ligne :

deb http://www.goupil.eu/repo stable main

à ton fichier /etc/apt/sources.list

et pour ajouter la clef (qui authentifie les màj), copie-colle dans un terminal en root (ou sudo) :

gpg --keyserver pgp.mit.edu --recv-keys 2502831E
gpg --export 2502831E | apt-key add -

La première ligne récupère la clef et la seconde l'ajoute au trousseau apt

Hors ligne

#32 Le 31/05/2013, à 13:54

hishaime

Re : boomeranga! pour les amateurs de mangas

ok merci WeetabiX

Hors ligne

#33 Le 01/06/2013, à 11:13

WeetabiX

Re : boomeranga! pour les amateurs de mangas

La version 0.9.3-1 nettoie le code en partie (je vais me pencher un peu plus sur 'sed' avant de le mettre en pratique).

Hizoka a écrit :

ouha pourquoi faire simple quand on peut faire ca tongue

roll Heuuu... c'est vrai, pourquoi big_smile La commande 'seq -w' est vraiment pratique et résout même le problème du 0 (à condition qu'il y ait au moins 10 pages par chapitre, cas général).

Cette nouvelle version rétablit également un fonctionnement normal des listes de suivi.

#!/bin/bash
#weetabix' 2013 v0.9.3-1

##################
#  Boomeranga!   #
##################

v=0.9.3-1

#fonction télécharger()
function télécharger {
mkdir $manga
cd $PWD/$manga/

#connaitre chapitre max d'1 manga
wget http://www.lecture-en-ligne.com/$manga/1/0/0/1.html -O infochap
grep -A 1 'id="chap"' infochap > infochap2
head -2 infochap2 | tail -1 > infochap
cut -d ">" -f2 infochap | cut -d "<" -f1 > infochap2
chap_man=$(cat $PWD/infochap2)

chap=$(zenity --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --entry --cancel-label "Quitter" --text "Commencer à quel chapitre ?") || exit

im=01
chapn=$(($chap_man-$chap+1)) # définir chapitres restant

zenity --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --question --text "$manga - Télécharger tous les chapitres disponibles ?   [$chap_man paru(s) / $chapn nouveau(x)]"
if [ $? = 0 ]
then
	chapmax=$chap_man
	((chapmax++))
else
	chapmax=$(zenity --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --cancel-label "Quitter" --entry --text "Stopper à quel chapitre ?   [vous êtes au n°$chap]") || exit
	((chapmax++))
fi

while [ $chap != $chapmax ]
do
mkdir $chap
cd $PWD/$chap/

#rechercher le nb de pages du chapitre
wget http://www.lecture-en-ligne.com/$manga/$chap/0/0/1.html -O info
grep 'current_total_pages' info > info2
cut -d "'" -f2 info2 > info3
imax=`cat $PWD/info3`

#vérif page 404
erreur=$(grep -c 'ERREUR 404' info)
if [ $erreur = 1 ]
then zenity --error --title "boomeranga!" --text "Manga/chapitre non trouvé - abandon"
	cd $ch
	mv $PWD/$manga $HOME/.local/share/Trash/files & exit
fi

#info
notify-send -i /usr/share/pixmaps/boomeranga.svg -t 2000 "Téléchargement du chapitre $chap"

#récupérer les images
im=01
for im in $(seq -w ${imax})
do
  wget http://www.lecture-en-ligne.com/images/mangas/$manga/$chap/$im.jpg
done

#création du .cbz
rm $PWD/info & rm $PWD/info2 & rm $PWD/info3
zip -r $chap.cbz .
mv $chap.cbz ..
cd ..
rm -r $PWD/$chap

#conversion pdf
if [ $pdf = "o" ] ; then ebook-convert $chap.cbz $chap.pdf --right2left | zenity --title "boomeranga!" --progress --text "Création de $manga $chap.pdf" --auto-close --auto-kill ; fi

#changement de chapitre
((chap++))
im=01
done

rm $PWD/infochap
echo $chapmax > $PWD/chaplast

#inscrire manga dans liste 'séries' sauf si déjà présent
cd ..
grep $manga séries
if [ $? != 0 ]
then
	echo $manga >> séries
fi
zenity --info --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --text "Vous trouverez les chapitres téléchargés dans le dossier <b>$ch</b> Bonne lecture! "
menu
}

function télécharger_poursuite {
cd $manga
wget http://www.lecture-en-ligne.com/$manga/1/0/0/1.html -O infochap
grep -A 1 'id="chap"' infochap > infochap2
head -2 infochap2 | tail -1 > infochap
cut -d ">" -f2 infochap | cut -d "<" -f1 > infochap2
chap_man=$(cat $PWD/infochap2)

chap=$(cat $PWD/chaplast)

im=01
chapn=$(($chap_man-$chap+1)) # définir chapitres restant

chapmax=$chap_man
((chapmax++))

while [ $chap != $chapmax ]
do

mkdir $chap
cd $PWD/$chap/

#rechercher le nb de pages du chapitre
wget http://www.lecture-en-ligne.com/$manga/$chap/0/0/1.html -O info
grep 'current_total_pages' info > info2
cut -d "'" -f2 info2 > info3
imax=$(cat $PWD/info3)

#info
notify-send -i /usr/share/pixmaps/boomeranga.svg -t 2000 "Téléchargement de la suite de $manga"

#récupérer les images
im=01
for im in $(seq -w ${imax})
do
  wget http://www.lecture-en-ligne.com/images/mangas/$manga/$chap/$im.jpg
done

#création du .cbz
rm $PWD/info & rm $PWD/info2 & rm $PWD/info3
zip -r $chap.cbz .
mv $chap.cbz ..
cd ..
rm -r $PWD/$chap

#conversion pdf
if [ $pdf = "o" ] ; then ebook-convert $chap.cbz $chap.pdf --right2left | zenity --title "boomeranga!" --progress --text "Création de $manga $chap.pdf" --auto-close --auto-kill ; fi

#changement de chapitre
((chap++))
im=01
done

rm $PWD/infochap
echo $chapmax > $PWD/chaplast

zenity --info --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --text "Vous trouverez les chapitres téléchargés dans le dossier <b>$ch</b> Bonne lecture! "
cd ..
}

function poursuite_series {
zenity --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --question --text "Poursuivre les séries en cours :
<b>$(cat séries)</b> ?"
if [ $? = 0 ]
then
	nb_ligm=$(wc -l séries | cut -d " " -f1)
	((nb_ligm++))
	nb_lig=1
	while [ $nb_lig != $nb_ligm ]
	do
	manga=$(head -n $nb_lig séries | tail -n 1)
	télécharger_poursuite
	((nb_lig++))
	done
	menu
else
	manga=`zenity --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --entry --cancel-label "Quitter" --text "Nouveau manga - nom du manga ?"` || exit

	#si manga vide
	if [ -z $manga ]
	then zenity --error --title "boomeranga!" --text "Erreur dans le nom - abandon" & exit
	fi
	télécharger
fi
}

function poursuite_series_mangafox {
zenity --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --question --text "Poursuivre les séries en cours : 
<b>$(cat séries.mfox)</b> ?"
if [ $? = 0 ]
then
	nb_ligm=$(wc -l séries.mfox | cut -d " " -f1)
	((nb_ligm++))
	nb_lig=1
	while [ $nb_lig != $nb_ligm ]
	do
	manga=$(head -n $nb_lig séries.mfox | tail -n 1)
	télécharger_poursuite_mfox
	((nb_lig++))
	done
	menu
else
	manga=$(zenity --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --entry --cancel-label "Quitter" --text "Nouveau manga - nom du manga ?") || exit

	#si manga vide
	if [ -z $manga ]
	then zenity --error --title "boomeranga!" --text "Erreur dans le nom - abandon" & exit
	fi
	télécharger_mangafox
fi
}

#fonction télécharger_mangafox() / pas info chap. max / vol inutile (oui et non) car redirection auto fct chapitre
function télécharger_mangafox {

mkdir $manga
cd $PWD/$manga/

info=$(zenity --forms --title "boomeranga!" --cancel-label "Quitter" --add-entry "Chapitre début (forme 001)" --add-entry "Chapitre fin (forme 001+1)" --window-icon "/usr/share/pixmaps/boomeranga.svg")
chap="c"$(echo $info | cut -d "|" -f 1)
chapmax="c"$(echo $info | cut -d "|" -f 2)

vol="v01"
im=1

while [ $chap != $chapmax ]
do
mkdir -p $vol$chap
cd $PWD/$vol$chap/

#rechercher le nb de pages du chapitre
wget -U=firefox http://mangafox.me/manga/$manga/$vol/$chap/$im.html -O info
grep 'var total_pages=' info > info2
cut -d "=" -f2 info2 | cut -d ";" -f1 > info3
imax=$(cat $PWD/info3)
let imaxi=imax+1

#404
erreur=$(cat $PWD/info)
[[ $erreur ]]
if [ $? = 1 ]
then
	zenity --error --title "boomeranga!" --text "Manga/chapitre non trouvé - abandon"
	cd $ch
	mv $PWD/$manga $HOME/.local/share/Trash/files & exit
fi

#info
notify-send -i /usr/share/pixmaps/boomeranga.svg -t 2000 "Téléchargement du chapitre $chap"

#récupérer les images du chapitre
while [ $im != $imaxi ]
do 
	wget -U=firefox http://mangafox.me/manga/$manga/$vol/$chap/$im.html -O infochap
	grep -A 1 'onclick="return enlarge()"><img src=' infochap > infochap2
	head -1 infochap2 > infochap
	cut -d '"' -f6 infochap | cut -d '"' -f1 > infochap2
	chi=$(cat $PWD/infochap2)
	wget -U=firefox $chi
	((im++))
done

#création du .cbz
mv $PWD/info $HOME/.local/share/Trash/files ; mv $PWD/info2 $HOME/.local/share/Trash/files ; mv $PWD/info3 $HOME/.local/share/Trash/files
mv $PWD/infochap $HOME/.local/share/Trash/files ; mv $PWD/infochap2 $HOME/.local/share/Trash/files

zip -r $vol$chap.cbz .
mv $vol$chap.cbz ..
cd ..
rm -r $PWD/$vol$chap

#conversion pdf
if [ $pdf = "o" ] ; then ebook-convert $vol$chap.cbz $vol$chap.pdf --right2left | zenity --title "boomeranga!" --progress --text "Création de $manga $vol$chap.pdf" --auto-close --auto-kill ; fi

#changement de chapitre / volume
wget -U=firefox http://mangafox.me/manga/$manga/$vol/$chap/$im.html -O infovol
grep '<p><span>Next Chapter:</span>' infovol > infovol2
cut -d "/" -f7 infovol2 > infovol
vol=`cat $PWD/infovol`
cut -d "/" -f8 infovol2 > infovol
chap=$(cat $PWD/infovol)
im=1

mv $PWD/infovol $HOME/.local/share/Trash/files ; mv $PWD/infovol2 $HOME/.local/share/Trash/files
done

echo $chapmax > $PWD/chaplast

#inscrire manga dans liste 'séries' sauf si déjà présent
cd ..
grep $manga séries.mfox
if [ $? != 0 ]
then
	echo $manga >> séries.mfox
fi

zenity --info --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --text "Vous trouverez les chapitres téléchargés dans le dossier <b>$ch</b> Bonne lecture! "
cd $ch
menu
}

function télécharger_poursuite_mfox {
cd $manga
vol="v01"
chap=$(cat $PWD/chaplast)
chapmax="c"$(zenity --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --entry --cancel-label "Quitter" --text "$manga - Stopper à quel chapitre (forme 001+1)? [vous êtes au n°$chap]") || exit
im=1

while [ $chap != $chapmax ]
do
mkdir -p $vol$chap
cd $PWD/$vol$chap/

wget -U=firefox http://mangafox.me/manga/$manga/$vol/$chap/$im.html -O info
grep 'var total_pages=' info > info2
cut -d "=" -f2 info2 | cut -d ";" -f1 > info3
imax=$(cat $PWD/info3)
let imaxi=imax+1

#info
notify-send -i /usr/share/pixmaps/boomeranga.svg -t 2000 "Téléchargement de la suite de $manga"

#récupérer les images du chapitre
while [ $im != $imaxi ]
do 
	wget -U=firefox http://mangafox.me/manga/$manga/$vol/$chap/$im.html -O infochap
	grep -A 1 'onclick="return enlarge()"><img src=' infochap > infochap2
	head -1 infochap2 > infochap
	cut -d '"' -f6 infochap | cut -d '"' -f1 > infochap2
	chi=$(cat $PWD/infochap2)
	wget -U=firefox $chi
	((im++))
done

#création du .cbz
mv $PWD/info $HOME/.local/share/Trash/files ; mv $PWD/info2 $HOME/.local/share/Trash/files ; mv $PWD/info3 $HOME/.local/share/Trash/files
mv $PWD/infochap $HOME/.local/share/Trash/files ; mv $PWD/infochap2 $HOME/.local/share/Trash/files

zip -r $vol$chap.cbz .
mv $vol$chap.cbz ..
cd ..
rm -r $PWD/$vol$chap

#conversion pdf
if [ $pdf = "o" ] ; then ebook-convert $vol$chap.cbz $vol$chap.pdf --right2left | zenity --title "boomeranga!" --progress --text "Création de $manga $vol$chap.pdf" --auto-close --auto-kill ; fi

#changement de chapitre / volume
wget -U=firefox http://mangafox.me/manga/$manga/$vol/$chap/$im.html -O infovol
grep '<p><span>Next Chapter:</span>' infovol > infovol2
cut -d "/" -f7 infovol2 > infovol
vol=$(cat $PWD/infovol)
cut -d "/" -f8 infovol2 > infovol
chap=$(cat $PWD/infovol)
im=1
done

echo $chapmax > $PWD/chaplast

mv $PWD/infovol $HOME/.local/share/Trash/files ; mv $PWD/infovol2 $HOME/.local/share/Trash/files

zenity --info --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --text "Vous trouverez les chapitres téléchargés dans le dossier <b>$ch</b> Bonne lecture! "
cd ..
}

#### intro ####
zenity --info --ok-label "Go!" --timeout "2" --title "boomeranga! v$v" --window-icon "/usr/share/pixmaps/boomeranga.svg" --text "<b>boomeranga!</b> vous permet de télécharger 
des planches de manga depuis :

   * lecture-en-ligne.com (FR)
   * mangafox.me (EN)

Bonne lecture!"

#création chemin boomeranga
test -f $HOME/.boomeranga/ch
if [ $? = 1 ]
then
	mkdir -p $HOME/.boomeranga
	ch_tmp=$(zenity --file-selection --window-icon "/usr/share/pixmaps/boomeranga.svg" --title "Choisir le dossier des téléchargements boomeranga!" --directory)
	echo $ch_tmp/boomeranga > $HOME/.boomeranga/ch
fi

#info màj
cd $HOME/.boomeranga/
wget http://goupil.eu/repo/boomeranga_version -O version
v2=$(head -n 1 $HOME/.boomeranga/version)
[ $v = $v2 ] || zenity --info --ok-label "Ok" --timeout "2" --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --text "La version $v2 est disponible"

#vérification présence fichiers 'séries' et création si besoin
function séries {
ch=$(cat $HOME/.boomeranga/ch)
mkdir -p $ch/
cd $ch
test -f $PWD/séries
if [ $? = 1 ]
then
	> séries
fi
test -f $PWD/séries.mfox
if [ $? = 1 ]
then
	> séries.mfox
fi
}

function ch_maj {
ch_tmp=$(zenity --file-selection --window-icon "/usr/share/pixmaps/boomeranga.svg" --title "Choisir le dossier des téléchargements boomeranga!" --directory)
echo $ch_tmp/boomeranga > $HOME/.boomeranga/ch_new
ch=$(cat $HOME/.boomeranga/ch)
ch_new=$(cat $HOME/.boomeranga/ch_new)
mv $ch $ch_new
mv $HOME/.boomeranga/ch_new $HOME/.boomeranga/ch
zenity --info --ok-label "bye!" --timeout "5" --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --text "Merci de redémarrer boomeranga! pour que les
changements soient effectifs" & exit
}

#option pdf
function convert_pdf {
pdf=$(zenity --list --checklist --cancel-label "Quitter" --title "boomeranga!" --text "Convertir en .pdf ?" --column=option --column=description 1 "activer conversion pdf") || exit
case "${pdf}" in
"") pdf=""
;;
esac

if [[ -z $pdf ]]
then pdf="n"
else pdf="o"
fi
}
séries

#menu général avec `case`
function menu {
option=$(zenity --list --window-icon "/usr/share/pixmaps/boomeranga.svg" --width "350" --height "330" --cancel-label "Quitter" --title "boomeranga!" --text "Menu principal" --column=option --column=description 1 "Télécharger mangas (FR)" 2 "Voir/Modifier liste de suivi (FR)" \
3 "Télécharger mangas (EN)" 4 "Voir/Modifier liste de suivi (EN)" 5 "================" 6 "Modifier le chemin de boomeranga!" 7 "Consulter l'aide en ligne" 8 "Demander une fonctionnalité") || exit
case "${option}" in
1) poursuite_series
;;
2) zenity --text-info --editable --cancel-label "Quitter" --filename "$ch/séries" > $ch/séries_maj &&
mv $PWD/séries $HOME/.local/share/Trash/files && mv $PWD/séries_maj $PWD/séries && menu
;;
3) poursuite_series_mangafox
;;
4) zenity --text-info --editable --cancel-label "Quitter" --filename "$ch/séries.mfox" > $ch/séries.mfox_maj &&
mv $PWD/séries.mfox $HOME/.local/share/Trash/files && mv $PWD/séries.mfox_maj $PWD/séries.mfox && menu
;;
5) echo "y'a rien ici :p" && menu
;;
6) ch_maj && menu
;;
7) xdg-open 'http://blog.goupil.eu/?boomeranga' & menu
;;
8) xdg-open 'http://forum.ubuntu-fr.org/viewtopic.php?id=1282211' & menu
;;
esac
}

convert_pdf
#### lancement boomeranga! ####
menu

Hors ligne

#34 Le 01/06/2013, à 12:00

Hizoka

Re : boomeranga! pour les amateurs de mangas

(je vais me pencher un peu plus sur 'sed' avant de le mettre en pratique).

hesite pas a poser des questions wink

La commande 'seq -w' est vraiment pratique et résout même le problème du 0 (à condition qu'il y ait au moins 10 pages par chapitre, cas général).

Normalement ca passe dans les tous les cas si les chapitres de moins de 10 pages n'ont pas un nom commençant par 0 (ex 01 => 06)

je look pour recuperer la liste des mangas
EDIT : j'ai reussi mais ca prend du temps 30-45secondes pour tout afficher...

Dernière modification par Hizoka (Le 01/06/2013, à 12:16)


KDE Neon 64bits
Tous mes softs (MKVExtractorQt, HizoSelect, HizoProgress, Qtesseract, Keneric, Services menus...) sont sur github

Hors ligne

#35 Le 01/06/2013, à 13:02

Hizoka

Re : boomeranga! pour les amateurs de mangas

Hé hé hé tongue

while read
do
  if [[ ${REPLY} == "==="* ]]
  then
    type=${REPLY//=}
  else
    echo "${type}"
    echo "${REPLY}"
  fi
done < <(wget -qO - "http://www.lecture-en-ligne.com/index.php?page=liste&ordre=titre&p=1" | sed "/<optgroup/! d ; s@</option>\|</optgroup>@@g ; s@<option value[^>]*>@\n@g ; s@.*[[:space:]]*<optgroup label=\"\(.*\)\">@=====\1=====@ ; s@&amp;@\&@g ; s@&quot;@\"@g")| zenity --list --column "Etat" --column "Nom de la serie"

Ca met 40-50 secondes à charger mais ca affiche tous les mangas sous forme de liste :
Etat du manga | Nom du manga


nb_page=$(wget -qO - "http://www.lecture-en-ligne.com/index.php?page=liste&ordre=titre&p=1" | sed -n "/pagination/ s@.*>\([0-9]*\)</a>  ).*@\1@p")

for i in $(seq ${nb_page})
do
  wget -qO - "http://www.lecture-en-ligne.com/index.php?page=liste&ordre=titre&p=${i}" | grep -A 7 "tr onmouseover" | sed "s@^[[:space:]]*@@ ; s@</a>.*@@ ; s@</td>@@ ; s@ fois@@ ; /<tr\|<\/tr\|<td>/d ; s@.*>@@ ; /--/d"
done | zenity --list --column "Nom du manga" --column "Type de manga" --column "nb de dl" --column "Note" --column "nb de chap" --column "Dernier chap"

et la encore plus fort, il met 1m30-2m mais il affiche tout sous la forme :
Titre    | Genres |    Vues | Note | Nombre de chapitres | Dernier chapitre


a toi de voir ce que tu veux en faire tongue


KDE Neon 64bits
Tous mes softs (MKVExtractorQt, HizoSelect, HizoProgress, Qtesseract, Keneric, Services menus...) sont sur github

Hors ligne

#36 Le 01/06/2013, à 13:39

Hizoka

Re : boomeranga! pour les amateurs de mangas

je regardais un peu ton code :

chap="c"$(echo $info | cut -d "|" -f 1)
chapmax="c"$(echo $info | cut -d "|" -f 2)

=>

chap="c${info%|*}"
chapmax="c${info#*|}"

ca evite des commandes inutiles, bash permet de modifier ses facilement et tres rapidement ses variables


chi=$(cat $PWD/infochap2)

=>

chi=$(< $PWD/infochap2)

plus rapide


trop compliqué :

#récupérer les images du chapitre
while [ $im != $imaxi ]
do 
	wget -U=firefox http://mangafox.me/manga/$manga/$vol/$chap/$im.html -O infochap
	grep -A 1 'onclick="return enlarge()"><img src=' infochap > infochap2
	head -1 infochap2 > infochap
	cut -d '"' -f6 infochap | cut -d '"' -f1 > infochap2
	chi=$(cat $PWD/infochap2)
	wget -U=firefox $chi
	((im++))
done

=>

for ((i=1 ; i<$imaxi ; i++))
do
  wget -U=firefox "$(wget -U=firefox -qO - http://mangafox.me/manga/$manga/$vol/${chap}/${im}.html | sed -n '/onclick="return enlarge()"><img src=/ s@.*img src=.\([^"]*\).*@\1@p')"
done
mv $PWD/info $HOME/.local/share/Trash/files ; mv $PWD/info2 $HOME/.local/share/Trash/files ; mv $PWD/info3 $HOME/.local/share/Trash/files
mv $PWD/infochap $HOME/.local/share/Trash/files ; mv $PWD/infochap2 $HOME/.local/share/Trash/files

pour quoi des mv et non des rm ?
et pourquoi pas tout en une seule commande ?


if [ $pdf = "o" ] ; then ebook-convert $vol$chap.cbz $vol$chap.pdf --right2left | zenity --title "boomeranga!" --progress --text "Création de $manga $vol$chap.pdf" --auto-close --auto-kill ; fi

=>

[[ ${pdf} = "o" ] ] && ebook-convert $vol$chap.cbz $vol$chap.pdf --right2left | zenity --title "boomeranga!" --progress --text "Création de $manga $vol$chap.pdf" --auto-close --auto-kill

si tu veux tout mettre sur une ligne autant simplifier le if


wget -U=firefox http://mangafox.me/manga/$manga/$vol/$chap/$im.html -O infovol
grep '<p><span>Next Chapter:</span>' infovol > infovol2
cut -d "/" -f7 infovol2 > infovol
vol=`cat $PWD/infovol`
cut -d "/" -f8 infovol2 > infovol
chap=$(cat $PWD/infovol)

tu peux simplifier ca avec mes differents exemples wink


KDE Neon 64bits
Tous mes softs (MKVExtractorQt, HizoSelect, HizoProgress, Qtesseract, Keneric, Services menus...) sont sur github

Hors ligne

#37 Le 04/06/2013, à 14:21

WeetabiX

Re : boomeranga! pour les amateurs de mangas

Merci pour tes propositions et conseils, je vais m'en inspirer pour la prochaine version wink

Pourrais-tu m'expliquer le fonctionnement de sed ici ?

sed "s@^[[:space:]]*@@ ; s@</a>.*@@ ; s@</td>@@ ; s@ fois@@ ; /<tr\|<\/tr\|<td>/d ; s@.*>@@ ; /--/d"

Merci d'avance !

Dernière modification par WeetabiX (Le 04/06/2013, à 14:55)

Hors ligne

#38 Le 04/06/2013, à 17:00

Hizoka

Re : boomeranga! pour les amateurs de mangas

j'utilise @ et non / dans sed comme habituellement car le texte peut contenir des / et donc planter sed.
Pour les recherches, il est obligatoire d'utiliser des /.
L'ordres apparition des commandes est importantes

echo "aa bb cc dd ee" | sed "s/a/e/g ; s/e/@/g"
echo "aa bb cc dd ee" | sed "s/e/@/g ; s/a/e/g"

s@^[[:space:]]*@@ : remplace tous les espaces de début de lignes (espace, tab...) par rien du tout (donc efface).
^ : debut de ligne
[[:space:]] : espace, tab...
* : toute répétition du caractère/de l’élément précédant

s@</a>.*@@ : efface (remplace par rien) tout a partir de </a> (les infos pratiques se trouvant avant, tout ce qui se trouve après, n'est pas intéressant

s@</td>@@ : efface (remplace par rien) </td>

s@ fois@@ : efface (remplace par rien) " fois" (pour le nombre de dl, le nombre suffit)

/<tr\|<\/tr\|<td>/d : efface les lignes contenant <tr ou </tr ou <td> (évite de le faire en trois commandes différentes)

s@.*>@@ : efface (remplace par rien) tout ce qu'il y a jusqu'au dernier signe ">"

/--/d : efface les lignes contenant -- (lignes créées par grep)

Ameliorations possibles :
/<tr\|<\/tr\|<td>/d  + /--/d = /<tr\|<\/tr\|<td>\|--/d
s@</td>@@ + s@ fois@@ + s@</a>.*@@ = sed 's@</td>\| fois\|</a>.*@@g'

Mais ce n'est pas forcement plus lisible ni plus raide (je viens de tester pour 250 essaies, la durée est la meme, donc autant faire la version plus lisible, ca depend du codeur smile )


KDE Neon 64bits
Tous mes softs (MKVExtractorQt, HizoSelect, HizoProgress, Qtesseract, Keneric, Services menus...) sont sur github

Hors ligne

#39 Le 06/06/2013, à 11:56

milkshake

Re : boomeranga! pour les amateurs de mangas

Je viens de tester ton script v0.9.3-1, j'ai regardé un peu ton code et c'est pas mal du tout.
Je te propose quelques améliorations, mais moins pointues que celles proposées par Hizoka :

Il manque selon moi, quelques contrôles assez facile à réaliser,
- Par exemple s'assurer que l'adresse existe bien et correspond à quelque chose quand on rentre le nom d'un nouveau manga, la j'ai vu une vérification sur le chapitre mais pas sur le nom du manga en lui même.
Donc j'éviterai d'écrire dans le fichier série si le manga n'existe pas.

- Vérifier que si il faut récupèrer xx images, tu as bien xx images dans le dossier avant de les convertir en cbz
- Vérifier ensuite que la compression s'est bien passée.

( ca c'est important pour s'assurer que tu as bien tout et que la compression est correcte )
Il suffit de regarder si le code de retour est égal à 0, avec un bout de code dans le genre après la commande :

#création du .cbz
rm $PWD/info & rm $PWD/info2 & rm $PWD/info3
zip -r $chap.cbz .

while [ ${?} -ne 0 ]
do
	echo "echec adapter selon ce qu'on veut"
done

mv $chap.cbz ..
cd ..
rm -r $PWD/$chap

Et aussi je trouve cette partie "assez agressive" :

for im in $(seq -w ${imax})
do
  wget http://www.lecture-en-ligne.com/images/mangas/$manga/$chap/$im.jpg
done

On ne peut pas vraiment utiliser les options de randomisation pour wget dans la boucle, mais je rajouterai un petit délai ou quelques lignes avec un delay aléatoire entre les téléchargements, surtout pour les manga qui ont vraiment "trop" de chapitres.

L'idéal c'est quand même de trouver un bon compromis pour éviter la détection du script et éviter aussi qu'il soit vu trop négativement par le webmaster.
Il vaut mieux qu'il laisse couler car c'est négligeable que de l'obliger à prendre des mesures et au final devoir refaire un script qui va bien.

D'ailleurs pourquoi tu n'utilises pas le même switch que pour mangafox ?

-U=firefox 

J'ajouterai aussi un -T 5 ( pour eviter le timeout de 900 secondes en cas de timeout sur leur serveur. )
Et peut être augmenter le nombre de retry au cas ou le modem ou la connection lacherai pendant l'opération.

Après ça fait vraiment longtemps que j'ai plus fait de bash,
sois indulgent avec ce commentaire tout n'est peut être pas pertinent smile
Mais sinon c'est une bonne idée, j’espère que tu comptes maintenir ce projet.

Dernière modification par milkshake (Le 06/06/2013, à 12:03)

Hors ligne

#40 Le 06/06/2013, à 19:32

WeetabiX

Re : boomeranga! pour les amateurs de mangas

Merci pour les encouragements big_smile

milkshake a écrit :

Par exemple s'assurer que l'adresse existe bien et correspond à quelque chose quand on rentre le nom d'un nouveau manga, la j'ai vu une vérification sur le chapitre mais pas sur le nom du manga en lui même.
Donc j'éviterai d'écrire dans le fichier série si le manga n'existe pas.

Oui, le contrôle au niveau du titre est plus logique mais heureusement le script n'inscrit déjà rien dans le fichier série s'il ne trouve aucun chapitre (donc aucun manga).

milkshake a écrit :

L'idéal c'est quand même de trouver un bon compromis pour éviter la détection du script et éviter aussi qu'il soit vu trop négativement par le webmaster.
Il vaut mieux qu'il laisse couler car c'est négligeable que de l'obliger à prendre des mesures et au final devoir refaire un script qui va bien.

Je suis d'accord avec toi, d'ailleurs je lui avais demandé son avis avant publication du script mais il n'a jamais répondu. Peut-être devrais-je le relancer.

Encore merci pour tes idées, c'est vraiment utile d'avoir l'avis des autres pour améliorer le script !
Oui, je compte le maintenir et l'améliorer même si en ce moment j'ai un peu moins de temps à y consacrer wink

Hors ligne

#41 Le 06/06/2013, à 20:48

Hizoka

Re : boomeranga! pour les amateurs de mangas

Vu son trafic ca devrait pas changer grand chose...

surtout que ce qu'il propose n'est pour la tres tres grande majorité pas son travail...

SI on utilise mon systeme de liste de manga, plus besoin de verifier si le manga existe tongue


KDE Neon 64bits
Tous mes softs (MKVExtractorQt, HizoSelect, HizoProgress, Qtesseract, Keneric, Services menus...) sont sur github

Hors ligne

#42 Le 07/06/2013, à 01:13

milkshake

Re : boomeranga! pour les amateurs de mangas

WeetabiX a écrit :

Oui, le contrôle au niveau du titre est plus logique mais heureusement le script n'inscrit déjà rien dans le fichier série s'il ne trouve aucun chapitre (donc aucun manga).

Il me semble que si on tape n'importe quoi comme titre, le script écrit quand même.

Hizoka a écrit :

...

Je suis d'accord avec toi, mais ce n'est pas vraiment pour le webmaster que je disais ça.
J'avais plutôt en tête la longévité du script.

Hors ligne

#43 Le 07/06/2013, à 09:55

WeetabiX

Re : boomeranga! pour les amateurs de mangas

milkshake a écrit :

Il me semble que si on tape n'importe quoi comme titre, le script écrit quand même.

Argh, tu as raison en fonction du choix que l'on fait : télécharger toute la série ou s'arrêter à un chapitre donné, l'écriture dans 'séries' est variable. Je vais me charger de la correction.

Voilà la version 0.9.4 qui ajoute un contrôle erreur sur les conversions .cbz/.pdf et qui met en place l'annuaire proposé par Hizoka !

#!/bin/bash
#weetabix' 2013 v0.9.4

##################
#  Boomeranga!   #
##################

v=0.9.4

#fonction télécharger()
function télécharger {
mkdir $manga
cd $PWD/$manga/

#connaitre chapitre max d'1 manga
wget http://www.lecture-en-ligne.com/$manga/1/0/0/1.html -O infochap
grep -A 1 'id="chap"' infochap > infochap2
head -2 infochap2 | tail -1 > infochap
cut -d ">" -f2 infochap | cut -d "<" -f1 > infochap2
chap_man=$(cat $PWD/infochap2)

chap=$(zenity --title "boomeranga" --window-icon "/usr/share/pixmaps/boomeranga.svg" --entry --cancel-label "Quitter" --text "Commencer à quel chapitre ?") || exit

im=01
chapn=$(($chap_man-$chap+1)) # définir chapitres restant

zenity --title "boomeranga" --window-icon "/usr/share/pixmaps/boomeranga.svg" --question --text "$manga - Télécharger tous les chapitres disponibles ?   [$chap_man paru(s) / $chapn nouveau(x)]"
if [ $? = 0 ]
then
	chapmax=$chap_man
	((chapmax++))
else
	chapmax=$(zenity --title "boomeranga" --window-icon "/usr/share/pixmaps/boomeranga.svg" --cancel-label "Quitter" --entry --text "Stopper à quel chapitre ?   [vous êtes au n°$chap]") || exit
	((chapmax++))
fi

while [ $chap != $chapmax ]
do
mkdir $chap
cd $PWD/$chap/

#rechercher le nb de pages du chapitre
wget http://www.lecture-en-ligne.com/$manga/$chap/0/0/1.html -O info
grep 'current_total_pages' info > info2
cut -d "'" -f2 info2 > info3
imax=`cat $PWD/info3`

#vérif page 404
erreur=$(grep -c 'ERREUR 404' info)
if [ $erreur = 1 ]
then zenity --error --title "boomeranga!" --text "Manga/chapitre non trouvé - abandon"
	cd $ch
	mv $PWD/$manga $HOME/.local/share/Trash/files & exit
fi

#info
notify-send -i /usr/share/pixmaps/boomeranga.svg -t 2000 "Téléchargement du chapitre $chap"

#récupérer les images
im=01
for im in $(seq -w ${imax})
do
  wget http://www.lecture-en-ligne.com/images/mangas/$manga/$chap/$im.jpg
done

#création du .cbz
rm $PWD/info & rm $PWD/info2 & rm $PWD/info3
zip -r $chap.cbz .
mv $chap.cbz ..
cd ..
rm -r $PWD/$chap
échec

#conversion pdf
if [ $pdf = "o" ] ; then ebook-convert $chap.cbz $chap.pdf --right2left | zenity --title "boomeranga!" --progress --text "Création de $manga $chap.pdf" --auto-close --auto-kill ; fi
échec

#changement de chapitre
((chap++))
im=01
done

rm $PWD/infochap
echo $chapmax > $PWD/chaplast

#inscrire manga dans liste 'séries' sauf si déjà présent
cd ..
grep $manga séries
if [ $? != 0 ]
then
	echo $manga >> séries
fi
zenity --info --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --text "Vous trouverez les chapitres téléchargés dans le dossier <b>$ch</b> Bonne lecture! "
menu
}

function télécharger_poursuite {
cd $manga
wget http://www.lecture-en-ligne.com/$manga/1/0/0/1.html -O infochap
grep -A 1 'id="chap"' infochap > infochap2
head -2 infochap2 | tail -1 > infochap
cut -d ">" -f2 infochap | cut -d "<" -f1 > infochap2
chap_man=$(cat $PWD/infochap2)

chap=$(cat $PWD/chaplast)

im=01
chapn=$(($chap_man-$chap+1)) # définir chapitres restant

chapmax=$chap_man
((chapmax++))

while [ $chap != $chapmax ]
do

mkdir $chap
cd $PWD/$chap/

#rechercher le nb de pages du chapitre
wget http://www.lecture-en-ligne.com/$manga/$chap/0/0/1.html -O info
grep 'current_total_pages' info > info2
cut -d "'" -f2 info2 > info3
imax=$(cat $PWD/info3)

#info
notify-send -i /usr/share/pixmaps/boomeranga.svg -t 2000 "Téléchargement de la suite de $manga"

#récupérer les images
im=01
for im in $(seq -w ${imax})
do
  wget http://www.lecture-en-ligne.com/images/mangas/$manga/$chap/$im.jpg
done

#création du .cbz
rm $PWD/info & rm $PWD/info2 & rm $PWD/info3
zip -r $chap.cbz .
mv $chap.cbz ..
cd ..
rm -r $PWD/$chap
échec

#conversion pdf
if [ $pdf = "o" ] ; then ebook-convert $chap.cbz $chap.pdf --right2left | zenity --title "boomeranga!" --progress --text "Création de $manga $chap.pdf" --auto-close --auto-kill ; fi
échec

#changement de chapitre
((chap++))
im=01
done

rm $PWD/infochap
echo $chapmax > $PWD/chaplast

zenity --info --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --text "Vous trouverez les chapitres téléchargés dans le dossier <b>$ch</b> Bonne lecture! "
cd ..
}

function poursuite_series {
zenity --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --question --text "Poursuivre les séries en cours :
<b>$(cat séries)</b> ?"
if [ $? = 0 ]
then
	nb_ligm=$(wc -l séries | cut -d " " -f1)
	((nb_ligm++))
	nb_lig=1
	while [ $nb_lig != $nb_ligm ]
	do
	manga=$(head -n $nb_lig séries | tail -n 1)
	télécharger_poursuite
	((nb_lig++))
	done
	menu
else
	manga=`zenity --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --entry --cancel-label "Quitter" --text "Nouveau manga - nom du manga ?"` || exit

	#si manga vide
	if [ -z $manga ]
	then zenity --error --title "boomeranga!" --text "Erreur dans le nom - abandon" & exit
	fi
	télécharger
fi
}

function poursuite_series_mangafox {
zenity --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --question --text "Poursuivre les séries en cours : 
<b>$(cat séries.mfox)</b> ?"
if [ $? = 0 ]
then
	nb_ligm=$(wc -l séries.mfox | cut -d " " -f1)
	((nb_ligm++))
	nb_lig=1
	while [ $nb_lig != $nb_ligm ]
	do
	manga=$(head -n $nb_lig séries.mfox | tail -n 1)
	télécharger_poursuite_mfox
	((nb_lig++))
	done
	menu
else
	manga=$(zenity --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --entry --cancel-label "Quitter" --text "Nouveau manga - nom du manga ?") || exit

	#si manga vide
	if [ -z $manga ]
	then zenity --error --title "boomeranga!" --text "Erreur dans le nom - abandon" & exit
	fi
	télécharger_mangafox
fi
}

#fonction télécharger_mangafox() / pas info chap. max / vol inutile (oui et non) car redirection auto fct chapitre
function télécharger_mangafox {

mkdir $manga
cd $PWD/$manga/

info=$(zenity --forms --title "boomeranga!" --cancel-label "Quitter" --add-entry "Chapitre début (forme 001)" --add-entry "Chapitre fin (forme 001+1)" --window-icon "/usr/share/pixmaps/boomeranga.svg")
chap="c"$(echo $info | cut -d "|" -f 1)
chapmax="c"$(echo $info | cut -d "|" -f 2)

vol="v01"
im=1

while [ $chap != $chapmax ]
do
mkdir -p $vol$chap
cd $PWD/$vol$chap/

#rechercher le nb de pages du chapitre
wget -U=firefox http://mangafox.me/manga/$manga/$vol/$chap/$im.html -O info
grep 'var total_pages=' info > info2
cut -d "=" -f2 info2 | cut -d ";" -f1 > info3
imax=$(cat $PWD/info3)
let imaxi=imax+1

#404
erreur=$(cat $PWD/info)
[[ $erreur ]]
if [ $? = 1 ]
then
	zenity --error --title "boomeranga!" --text "Manga/chapitre non trouvé - abandon"
	cd $ch
	mv $PWD/$manga $HOME/.local/share/Trash/files & exit
fi

#info
notify-send -i /usr/share/pixmaps/boomeranga.svg -t 2000 "Téléchargement du chapitre $chap"

#récupérer les images du chapitre
while [ $im != $imaxi ]
do 
	wget -U=firefox http://mangafox.me/manga/$manga/$vol/$chap/$im.html -O infochap
	grep -A 1 'onclick="return enlarge()"><img src=' infochap > infochap2
	head -1 infochap2 > infochap
	cut -d '"' -f6 infochap | cut -d '"' -f1 > infochap2
	chi=$(cat $PWD/infochap2)
	wget -U=firefox $chi
	((im++))
done

#création du .cbz
mv $PWD/info $HOME/.local/share/Trash/files ; mv $PWD/info2 $HOME/.local/share/Trash/files ; mv $PWD/info3 $HOME/.local/share/Trash/files
mv $PWD/infochap $HOME/.local/share/Trash/files ; mv $PWD/infochap2 $HOME/.local/share/Trash/files

zip -r $vol$chap.cbz .
mv $vol$chap.cbz ..
cd ..
rm -r $PWD/$vol$chap
échec

#conversion pdf
if [ $pdf = "o" ] ; then ebook-convert $vol$chap.cbz $vol$chap.pdf --right2left | zenity --title "boomeranga!" --progress --text "Création de $manga $vol$chap.pdf" --auto-close --auto-kill ; fi
échec

#changement de chapitre / volume
wget -U=firefox http://mangafox.me/manga/$manga/$vol/$chap/$im.html -O infovol
grep '<p><span>Next Chapter:</span>' infovol > infovol2
cut -d "/" -f7 infovol2 > infovol
vol=`cat $PWD/infovol`
cut -d "/" -f8 infovol2 > infovol
chap=$(cat $PWD/infovol)
im=1

mv $PWD/infovol $HOME/.local/share/Trash/files ; mv $PWD/infovol2 $HOME/.local/share/Trash/files
done

echo $chapmax > $PWD/chaplast

#inscrire manga dans liste 'séries' sauf si déjà présent
cd ..
grep $manga séries.mfox
if [ $? != 0 ]
then
	echo $manga >> séries.mfox
fi

zenity --info --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --text "Vous trouverez les chapitres téléchargés dans le dossier <b>$ch</b> Bonne lecture! "
cd $ch
menu
}

function télécharger_poursuite_mfox {
cd $manga
vol="v01"
chap=$(cat $PWD/chaplast)
chapmax="c"$(zenity --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --entry --cancel-label "Quitter" --text "$manga - Stopper à quel chapitre (forme 001+1)? [vous êtes au n°$chap]") || exit
im=1

while [ $chap != $chapmax ]
do
mkdir -p $vol$chap
cd $PWD/$vol$chap/

wget -U=firefox http://mangafox.me/manga/$manga/$vol/$chap/$im.html -O info
grep 'var total_pages=' info > info2
cut -d "=" -f2 info2 | cut -d ";" -f1 > info3
imax=$(cat $PWD/info3)
let imaxi=imax+1

#info
notify-send -i /usr/share/pixmaps/boomeranga.svg -t 2000 "Téléchargement de la suite de $manga"

#récupérer les images du chapitre
while [ $im != $imaxi ]
do 
	wget -U=firefox http://mangafox.me/manga/$manga/$vol/$chap/$im.html -O infochap
	grep -A 1 'onclick="return enlarge()"><img src=' infochap > infochap2
	head -1 infochap2 > infochap
	cut -d '"' -f6 infochap | cut -d '"' -f1 > infochap2
	chi=$(cat $PWD/infochap2)
	wget -U=firefox $chi
	((im++))
done

#nettoyage
mv $PWD/info $HOME/.local/share/Trash/files ; mv $PWD/info2 $HOME/.local/share/Trash/files ; mv $PWD/info3 $HOME/.local/share/Trash/files
mv $PWD/infochap $HOME/.local/share/Trash/files ; mv $PWD/infochap2 $HOME/.local/share/Trash/files

#création du .cbz
zip -r $vol$chap.cbz .
mv $vol$chap.cbz ..
cd ..
rm -r $PWD/$vol$chap
#vérif opération précédente
échec

#conversion pdf
if [ $pdf = "o" ] ; then ebook-convert $vol$chap.cbz $vol$chap.pdf --right2left | zenity --title "boomeranga!" --progress --text "Création de $manga $vol$chap.pdf" --auto-close --auto-kill ; fi
échec

#changement de chapitre / volume
wget -U=firefox http://mangafox.me/manga/$manga/$vol/$chap/$im.html -O infovol
grep '<p><span>Next Chapter:</span>' infovol > infovol2
cut -d "/" -f7 infovol2 > infovol
vol=$(cat $PWD/infovol)
cut -d "/" -f8 infovol2 > infovol
chap=$(cat $PWD/infovol)
im=1
done

echo $chapmax > $PWD/chaplast

mv $PWD/infovol $HOME/.local/share/Trash/files ; mv $PWD/infovol2 $HOME/.local/share/Trash/files

zenity --info --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --text "Vous trouverez les chapitres téléchargés dans le dossier <b>$ch</b> Bonne lecture! "
cd ..
}

annuaire() {
zenity --question --title "boomeranga" --window-icon "/usr/share/pixmaps/boomeranga.svg" --text "Cette option prend 2-3 minutes, l'exécuter ?" || menu
nb_page=$(wget -qO - "http://www.lecture-en-ligne.com/index.php?page=liste&ordre=titre&p=1" | sed -n "/pagination/ s@.*>\([0-9]*\)</a>  ).*@\1@p")
for i in $(seq ${nb_page})
do
  wget -qO - "http://www.lecture-en-ligne.com/index.php?page=liste&ordre=titre&p=${i}" | grep -A 7 "tr onmouseover" | sed "s@^[[:space:]]*@@ ; s@</a>.*@@ ; s@<td class=\"td\">@@ ; s@</td>@@ ; /tr onmouseover\|<table class\|<td>\|--/d ; s@>@\n@ ; s@<a href=\"manga/@@ ; s@/\" class=\"infoImages\"@@"
done > .mangas
cat .mangas | sed "s@<a href=@--@ ; /--/d ; /fois/d" > .mangas2
imax=$(cat .mangas2 | wc -l | awk '{print $1}') ; ((imax++)) # détermine nb lignes
j=4
for (( i=1 ; i < $imax ; i=i+2 ))
do
# awk -v permet d'ajouter variable, print $NF = dernier mot
type=$(cat .mangas2 | grep "(" | awk -v i=$i 'NR == i {print;}' | awk '{print $NF}')
# insère le $type à la ligne j
sed -i "${j}i$type" .mangas2
let j=j+7
done
manga=$(cat $PWD/.mangas2 | zenity --list --multiple --title "boomeranga" --window-icon "/usr/share/pixmaps/boomeranga.svg" --text "Veuillez choisir une série" --width "1200" --height "400" --hide-column="1" --column="Référence" --column="Nom du manga" --column="Genre" --column="Type" --column="Note" --column="Nb chap." --column="Dernier paru") || menu
mv $PWD/.mangas $HOME/.local/share/Trash/files && mv $PWD/.mangas2 $HOME/.local/share/Trash/files
télécharger
}

échec() {
while [ ${?} -ne 0 ]
do
	zenity --title "boomeranga!" --info --text "Echec de l'opération - retour au menu"
	menu
done
}

#### intro ####
zenity --info --ok-label "Go!" --timeout "2" --title "boomeranga! v$v" --window-icon "/usr/share/pixmaps/boomeranga.svg" --text "<b>boomeranga!</b> vous permet de télécharger 
des planches de manga depuis :

   * lecture-en-ligne.com (FR)
   * mangafox.me (EN)

Bonne lecture!"

#création chemin boomeranga
test -f $HOME/.boomeranga/ch
if [ $? = 1 ]
then
	mkdir -p $HOME/.boomeranga
	ch_tmp=$(zenity --file-selection --window-icon "/usr/share/pixmaps/boomeranga.svg" --title "Choisir le dossier des téléchargements boomeranga!" --directory)
	echo $ch_tmp/boomeranga > $HOME/.boomeranga/ch
fi

#info màj
cd $HOME/.boomeranga/
wget http://goupil.eu/repo/boomeranga_version -O version
v2=$(head -n 1 $HOME/.boomeranga/version)
[ $v = $v2 ] || zenity --info --ok-label "Ok" --timeout "2" --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --text "La version $v2 est disponible"

#vérification présence fichiers 'séries' et création si besoin
function séries {
ch=$(cat $HOME/.boomeranga/ch)
mkdir -p $ch/
cd $ch
test -f $PWD/séries
if [ $? = 1 ]
then
	> séries
fi
test -f $PWD/séries.mfox
if [ $? = 1 ]
then
	> séries.mfox
fi
}

function ch_maj {
ch_tmp=$(zenity --file-selection --window-icon "/usr/share/pixmaps/boomeranga.svg" --title "Choisir le dossier des téléchargements boomeranga!" --directory)
echo $ch_tmp/boomeranga > $HOME/.boomeranga/ch_new
ch=$(cat $HOME/.boomeranga/ch)
ch_new=$(cat $HOME/.boomeranga/ch_new)
mv $ch $ch_new
mv $HOME/.boomeranga/ch_new $HOME/.boomeranga/ch
zenity --info --ok-label "bye!" --timeout "5" --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --text "Merci de redémarrer boomeranga! pour que les
changements soient effectifs" & exit
}

#option pdf
function convert_pdf {
pdf=$(zenity --list --checklist --cancel-label "Quitter" --title "boomeranga!" --text "Convertir en .pdf ?" --column=option --column=description 1 "activer conversion pdf") || exit
case "${pdf}" in
"") pdf=""
;;
esac

if [[ -z $pdf ]]
then pdf="n"
else pdf="o"
fi
}
séries

#menu général avec `case`
function menu {
option=$(zenity --list --window-icon "/usr/share/pixmaps/boomeranga.svg" --width "350" --height "350" --cancel-label "Quitter" --title "boomeranga!" --text "Menu principal" --column=option --column=description 1 "Télécharger mangas (FR)" 2 ">> Voir/Modifier liste de suivi (FR)" \
3 "Annuaire mangas (FR)" 4 "Télécharger mangas (EN)" 5 ">> Voir/Modifier liste de suivi (EN)" 6 "================" 7 "Modifier le chemin de boomeranga!" 8 "Consulter l'aide en ligne" 9 "Demander une fonctionnalité") || exit
case "${option}" in
1) poursuite_series
;;
2) zenity --text-info --editable --cancel-label "Quitter" --filename "$ch/séries" > $ch/séries_maj &&
mv $PWD/séries $HOME/.local/share/Trash/files && mv $PWD/séries_maj $PWD/séries && menu
;;
3) annuaire
;;
4) poursuite_series_mangafox
;;
5) zenity --text-info --editable --cancel-label "Quitter" --filename "$ch/séries.mfox" > $ch/séries.mfox_maj &&
mv $PWD/séries.mfox $HOME/.local/share/Trash/files && mv $PWD/séries.mfox_maj $PWD/séries.mfox && menu
;;
6) echo "y'a rien ici :p" && menu
;;
7) ch_maj && menu
;;
8) xdg-open 'http://blog.goupil.eu/?boomeranga' & menu
;;
9) xdg-open 'http://forum.ubuntu-fr.org/viewtopic.php?id=1282211' & menu
;;
esac
}

convert_pdf
#### lancement boomeranga! ####
menu

@Hizoka : je n'ai pas encore nettoyé le code selon tous tes conseils, ça va venir, j'avais hâte de tester l'annuaire wink

Hors ligne

#44 Le 07/06/2013, à 12:11

Hizoka

Re : boomeranga! pour les amateurs de mangas

cat .mangas | sed "s@<a href=@--@ ; /--/d ; /fois/d" > .mangas2
cat .mangas2 | wc -l | awk '{print $1}'
cat $PWD/.mangas2 | zenity --list --multiple --title "boomeranga" --window-icon "/usr/share/pixmaps/boomeranga.svg" --text "Veuillez choisir une série" --width "1200" --height "400" --hide-column="1" --column="Référence" --column="Nom du manga" --column="Genre" --column="Type" --column="Note" --column="Nb chap." --column="Dernier paru"
...

les cat sont inutiles

sed "s@<a href=@--@ ; /--/d ; /fois/d" .mangas > .mangas2
wc -l .mangas2 | awk '{print $1}'
zenity --list --multiple --title "boomeranga" --window-icon "/usr/share/pixmaps/boomeranga.svg" --text "Veuillez choisir une série" --width "1200" --height "400" --hide-column="1" --column="Référence" --column="Nom du manga" --column="Genre" --column="Type" --column="Note" --column="Nb chap." --column="Dernier paru" < $PWD/.mangas2
...

Vu que le scan des mangas prend du temps, pourquoi ne pas utiliser une fenetre zenity de pulsation ? pour montrer que ca travaille.

j'ai un probleme avec le sed de la boucle done :

sed: -e expression n°1, caractère 6: \ attendu après `a', `c' ou `i'
sed: -e expression n°1, caractère 6: \ attendu après `a', `c' ou `i'
....

=>

sed -i "${j}i\$type" .mangas2

Et un truc si tu sépares le type et le genre, supprime le type de la ligne du genre et vire les parenthèses.


KDE Neon 64bits
Tous mes softs (MKVExtractorQt, HizoSelect, HizoProgress, Qtesseract, Keneric, Services menus...) sont sur github

Hors ligne

#45 Le 07/06/2013, à 15:02

WeetabiX

Re : boomeranga! pour les amateurs de mangas

Hizoka a écrit :

les cat sont inutiles

et

Hizoka a écrit :

Et un truc si tu sépares le type et le genre, supprime le type de la ligne du genre et vire les parenthèses.

ok :

annuaire() {
zenity --question --title "boomeranga" --window-icon "/usr/share/pixmaps/boomeranga.svg" --text "Cette option prend 2-3 minutes, l'exécuter ?" || menu
nb_page=$(wget -qO - "http://www.lecture-en-ligne.com/index.php?page=liste&ordre=titre&p=1" | sed -n "/pagination/ s@.*>\([0-9]*\)</a>  ).*@\1@p")
for i in $(seq ${nb_page})
do
  wget -qO - "http://www.lecture-en-ligne.com/index.php?page=liste&ordre=titre&p=${i}" | grep -A 7 "tr onmouseover" | sed "s@^[[:space:]]*@@ ; s@</a>.*@@ ; s@<td class=\"td\">@@ ; s@</td>@@ ; /tr onmouseover\|<table class\|<td>\|--/d ; s@>@\n@ ; s@<a href=\"manga/@@ ; s@/\" class=\"infoImages\"@@"
done > .mangas
sed "s@<a href=@--@ ; /--/d ; /fois/d" .mangas > .mangas2
imax=$(wc -l .mangas2 | awk '{print $1}') ; ((imax++)) # détermine nb lignes
j=4
for (( i=1 ; i < $imax ; i=i+2 ))
do
# awk -v permet d'ajouter variable, print $NF = dernier mot
type=$(cat .mangas2 | grep "(" | awk -v i=$i 'NR == i {print;}' | awk '{print $NF}')
# insère le $type à la ligne j
sed -i "${j}i$type" .mangas2
let j=j+7
done
#supprime ( en début de ligne, ) en fin et (...
sed -i "s@^(@@ ; s@)\$@@ ; s@(.*@@" .mangas2
manga=$(zenity --list --multiple --title "boomeranga" --window-icon "/usr/share/pixmaps/boomeranga.svg" --text "Veuillez choisir une série" --width "1200" --height "400" --hide-column="1" --column="Référence" --column="Nom du manga" --column="Genre" --column="Type" --column="Note" --column="Nb chap." --column="Dernier paru" < $PWD/.mangas2) || menu
mv $PWD/.mangas $HOME/.local/share/Trash/files && mv $PWD/.mangas2 $HOME/.local/share/Trash/files
télécharger
}

Néanmoins je n'arrive pas à placer zenity --progress --pulsate correctement pour que cela fonctionne neutral Quant à la boucle en erreur, je regarde.

Hors ligne

#46 Le 07/06/2013, à 17:13

Hizoka

Re : boomeranga! pour les amateurs de mangas

Quant à la boucle en erreur, je regarde.

je t'ai donné la réponse, il manquait un \ apres le i

(
nb_page=$(wget -qO - "http://www.lecture-en-ligne.com/index.php?page=liste&ordre=titre&p=1" | sed -n "/pagination/ s@.*>\([0-9]*\)</a>  ).*@\1@p")
for i in $(seq ${nb_page})
do
  wget -qO - "http://www.lecture-en-ligne.com/index.php?page=liste&ordre=titre&p=${i}" | grep -A 7 "tr onmouseover" | sed "s@^[[:space:]]*@@ ; s@</a>.*@@ ; s@<td class=\"td\">@@ ; s@</td>@@ ; /tr onmouseover\|<table class\|<td>\|--/d ; s@>@\n@ ; s@<a href=\"manga/@@ ; s@/\" class=\"infoImages\"@@"
done > .mangas
sed "s@<a href=@--@ ; /--/d ; /fois/d" .mangas > .mangas2
imax=$(wc -l .mangas2 | awk '{print $1}') ; ((imax++)) # détermine nb lignes
j=4
for (( i=1 ; i < $imax ; i=i+2 ))
do
# awk -v permet d'ajouter variable, print $NF = dernier mot
type=$(cat .mangas2 | grep "(" | awk -v i=$i 'NR == i {print;}' | awk '{print $NF}')
# insère le $type à la ligne j
sed -i "${j}i\$type" .mangas2
let j=j+7
done
#supprime ( en début de ligne, ) en fin et (...
sed -i "s@^(@@ ; s@)\$@@ ; s@(.*@@" .mangas2
) | zenity --progress --no-cancel --pulsate --title "Récupération des données" --text "La récupération des données sur les mangas est en cours..."

mais le bouton cancel ne fonctionne pas, toujours galere ca...


KDE Neon 64bits
Tous mes softs (MKVExtractorQt, HizoSelect, HizoProgress, Qtesseract, Keneric, Services menus...) sont sur github

Hors ligne

#47 Le 07/06/2013, à 19:15

WeetabiX

Re : boomeranga! pour les amateurs de mangas

Voilà qui est mieux :

#!/bin/bash
#weetabix' 2013 v0.9.4-1

##################
#  Boomeranga!   #
##################

v=0.9.4-1

#fonction télécharger()
function télécharger {
mkdir $manga
cd $PWD/$manga/

#connaitre chapitre max d'1 manga
wget http://www.lecture-en-ligne.com/$manga/1/0/0/1.html -O infochap
grep -A 1 'id="chap"' infochap > infochap2
head -2 infochap2 | tail -1 > infochap
cut -d ">" -f2 infochap | cut -d "<" -f1 > infochap2
chap_man=$(cat $PWD/infochap2)

chap=$(zenity --title "boomeranga" --window-icon "/usr/share/pixmaps/boomeranga.svg" --entry --cancel-label "Quitter" --text "Commencer à quel chapitre ?") || exit

im=01
chapn=$(($chap_man-$chap+1)) # définir chapitres restant

zenity --title "boomeranga" --window-icon "/usr/share/pixmaps/boomeranga.svg" --question --text "$manga - Télécharger tous les chapitres disponibles ?   [$chap_man paru(s) / $chapn nouveau(x)]"
if [ $? = 0 ]
then
	chapmax=$chap_man
	((chapmax++))
else
	chapmax=$(zenity --title "boomeranga" --window-icon "/usr/share/pixmaps/boomeranga.svg" --cancel-label "Quitter" --entry --text "Stopper à quel chapitre ?   [vous êtes au n°$chap]") || exit
	((chapmax++))
fi

while [ $chap != $chapmax ]
do
mkdir $chap
cd $PWD/$chap/

#rechercher le nb de pages du chapitre
wget http://www.lecture-en-ligne.com/$manga/$chap/0/0/1.html -O info
grep 'current_total_pages' info > info2
cut -d "'" -f2 info2 > info3
imax=`cat $PWD/info3`

#vérif page 404
erreur=$(grep -c 'ERREUR 404' info)
if [ $erreur = 1 ]
then zenity --error --title "boomeranga!" --text "Manga/chapitre non trouvé - abandon"
	cd $ch
	mv $PWD/$manga $HOME/.local/share/Trash/files & exit
fi

#info
notify-send -i /usr/share/pixmaps/boomeranga.svg -t 2000 "Téléchargement du chapitre $chap"

#récupérer les images
im=01
for im in $(seq -w ${imax})
do
  wget http://www.lecture-en-ligne.com/images/mangas/$manga/$chap/$im.jpg
done

#création du .cbz
rm $PWD/info & rm $PWD/info2 & rm $PWD/info3
zip -r $chap.cbz .
mv $chap.cbz ..
cd ..
rm -r $PWD/$chap
échec

#conversion pdf
if [ $pdf = "o" ] ; then ebook-convert $chap.cbz $chap.pdf --right2left | zenity --title "boomeranga!" --progress --text "Création de $manga $chap.pdf" --auto-close --auto-kill ; fi
échec

#changement de chapitre
((chap++))
im=01
done

rm $PWD/infochap
echo $chapmax > $PWD/chaplast

#inscrire manga dans liste 'séries' sauf si déjà présent
cd ..
grep $manga séries
if [ $? != 0 ]
then
	echo $manga >> séries
fi
zenity --info --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --text "Vous trouverez les chapitres téléchargés dans le dossier <b>$ch</b> Bonne lecture! "
menu
}

function télécharger_poursuite {
cd $manga
wget http://www.lecture-en-ligne.com/$manga/1/0/0/1.html -O infochap
grep -A 1 'id="chap"' infochap > infochap2
head -2 infochap2 | tail -1 > infochap
cut -d ">" -f2 infochap | cut -d "<" -f1 > infochap2
chap_man=$(cat $PWD/infochap2)

chap=$(cat $PWD/chaplast)

im=01
chapn=$(($chap_man-$chap+1)) # définir chapitres restant

chapmax=$chap_man
((chapmax++))

while [ $chap != $chapmax ]
do

mkdir $chap
cd $PWD/$chap/

#rechercher le nb de pages du chapitre
wget http://www.lecture-en-ligne.com/$manga/$chap/0/0/1.html -O info
grep 'current_total_pages' info > info2
cut -d "'" -f2 info2 > info3
imax=$(cat $PWD/info3)

#info
notify-send -i /usr/share/pixmaps/boomeranga.svg -t 2000 "Téléchargement de la suite de $manga"

#récupérer les images
im=01
for im in $(seq -w ${imax})
do
  wget http://www.lecture-en-ligne.com/images/mangas/$manga/$chap/$im.jpg
done

#création du .cbz
rm $PWD/info & rm $PWD/info2 & rm $PWD/info3
zip -r $chap.cbz .
mv $chap.cbz ..
cd ..
rm -r $PWD/$chap
échec

#conversion pdf
if [ $pdf = "o" ] ; then ebook-convert $chap.cbz $chap.pdf --right2left | zenity --title "boomeranga!" --progress --text "Création de $manga $chap.pdf" --auto-close --auto-kill ; fi
échec

#changement de chapitre
((chap++))
im=01
done

rm $PWD/infochap
echo $chapmax > $PWD/chaplast

zenity --info --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --text "Vous trouverez les chapitres téléchargés dans le dossier <b>$ch</b> Bonne lecture! "
cd ..
}

function poursuite_series {
zenity --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --question --text "Poursuivre les séries en cours :
<b>$(cat séries)</b> ?"
if [ $? = 0 ]
then
	nb_ligm=$(wc -l séries | cut -d " " -f1)
	((nb_ligm++))
	nb_lig=1
	while [ $nb_lig != $nb_ligm ]
	do
	manga=$(head -n $nb_lig séries | tail -n 1)
	télécharger_poursuite
	((nb_lig++))
	done
	menu
else
	manga=`zenity --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --entry --cancel-label "Quitter" --text "Nouveau manga - nom du manga ?"` || exit

	#si manga vide
	if [ -z $manga ]
	then zenity --error --title "boomeranga!" --text "Erreur dans le nom - abandon" & exit
	fi
	télécharger
fi
}

function poursuite_series_mangafox {
zenity --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --question --text "Poursuivre les séries en cours : 
<b>$(cat séries.mfox)</b> ?"
if [ $? = 0 ]
then
	nb_ligm=$(wc -l séries.mfox | cut -d " " -f1)
	((nb_ligm++))
	nb_lig=1
	while [ $nb_lig != $nb_ligm ]
	do
	manga=$(head -n $nb_lig séries.mfox | tail -n 1)
	télécharger_poursuite_mfox
	((nb_lig++))
	done
	menu
else
	manga=$(zenity --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --entry --cancel-label "Quitter" --text "Nouveau manga - nom du manga ?") || exit

	#si manga vide
	if [ -z $manga ]
	then zenity --error --title "boomeranga!" --text "Erreur dans le nom - abandon" & exit
	fi
	télécharger_mangafox
fi
}

#fonction télécharger_mangafox() / pas info chap. max / vol inutile (oui et non) car redirection auto fct chapitre
function télécharger_mangafox {

mkdir $manga
cd $PWD/$manga/

info=$(zenity --forms --title "boomeranga!" --cancel-label "Quitter" --add-entry "Chapitre début (forme 001)" --add-entry "Chapitre fin (forme 001+1)" --window-icon "/usr/share/pixmaps/boomeranga.svg")
chap="c"$(echo $info | cut -d "|" -f 1)
chapmax="c"$(echo $info | cut -d "|" -f 2)

vol="v01"
im=1

while [ $chap != $chapmax ]
do
mkdir -p $vol$chap
cd $PWD/$vol$chap/

#rechercher le nb de pages du chapitre
wget -U=firefox http://mangafox.me/manga/$manga/$vol/$chap/$im.html -O info
grep 'var total_pages=' info > info2
cut -d "=" -f2 info2 | cut -d ";" -f1 > info3
imax=$(cat $PWD/info3)
let imaxi=imax+1

#404
erreur=$(cat $PWD/info)
[[ $erreur ]]
if [ $? = 1 ]
then
	zenity --error --title "boomeranga!" --text "Manga/chapitre non trouvé - abandon"
	cd $ch
	mv $PWD/$manga $HOME/.local/share/Trash/files & exit
fi

#info
notify-send -i /usr/share/pixmaps/boomeranga.svg -t 2000 "Téléchargement du chapitre $chap"

#récupérer les images du chapitre
while [ $im != $imaxi ]
do 
	wget -U=firefox http://mangafox.me/manga/$manga/$vol/$chap/$im.html -O infochap
	grep -A 1 'onclick="return enlarge()"><img src=' infochap > infochap2
	head -1 infochap2 > infochap
	cut -d '"' -f6 infochap | cut -d '"' -f1 > infochap2
	chi=$(cat $PWD/infochap2)
	wget -U=firefox $chi
	((im++))
done

#création du .cbz
mv $PWD/info $HOME/.local/share/Trash/files ; mv $PWD/info2 $HOME/.local/share/Trash/files ; mv $PWD/info3 $HOME/.local/share/Trash/files
mv $PWD/infochap $HOME/.local/share/Trash/files ; mv $PWD/infochap2 $HOME/.local/share/Trash/files

zip -r $vol$chap.cbz .
mv $vol$chap.cbz ..
cd ..
rm -r $PWD/$vol$chap
échec

#conversion pdf
if [ $pdf = "o" ] ; then ebook-convert $vol$chap.cbz $vol$chap.pdf --right2left | zenity --title "boomeranga!" --progress --text "Création de $manga $vol$chap.pdf" --auto-close --auto-kill ; fi
échec

#changement de chapitre / volume
wget -U=firefox http://mangafox.me/manga/$manga/$vol/$chap/$im.html -O infovol
grep '<p><span>Next Chapter:</span>' infovol > infovol2
cut -d "/" -f7 infovol2 > infovol
vol=`cat $PWD/infovol`
cut -d "/" -f8 infovol2 > infovol
chap=$(cat $PWD/infovol)
im=1

mv $PWD/infovol $HOME/.local/share/Trash/files ; mv $PWD/infovol2 $HOME/.local/share/Trash/files
done

echo $chapmax > $PWD/chaplast

#inscrire manga dans liste 'séries' sauf si déjà présent
cd ..
grep $manga séries.mfox
if [ $? != 0 ]
then
	echo $manga >> séries.mfox
fi

zenity --info --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --text "Vous trouverez les chapitres téléchargés dans le dossier <b>$ch</b> Bonne lecture! "
cd $ch
menu
}

function télécharger_poursuite_mfox {
cd $manga
vol="v01"
chap=$(cat $PWD/chaplast)
chapmax="c"$(zenity --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --entry --cancel-label "Quitter" --text "$manga - Stopper à quel chapitre (forme 001+1)? [vous êtes au n°$chap]") || exit
im=1

while [ $chap != $chapmax ]
do
mkdir -p $vol$chap
cd $PWD/$vol$chap/

wget -U=firefox http://mangafox.me/manga/$manga/$vol/$chap/$im.html -O info
grep 'var total_pages=' info > info2
cut -d "=" -f2 info2 | cut -d ";" -f1 > info3
imax=$(cat $PWD/info3)
let imaxi=imax+1

#info
notify-send -i /usr/share/pixmaps/boomeranga.svg -t 2000 "Téléchargement de la suite de $manga"

#récupérer les images du chapitre
while [ $im != $imaxi ]
do 
	wget -U=firefox http://mangafox.me/manga/$manga/$vol/$chap/$im.html -O infochap
	grep -A 1 'onclick="return enlarge()"><img src=' infochap > infochap2
	head -1 infochap2 > infochap
	cut -d '"' -f6 infochap | cut -d '"' -f1 > infochap2
	chi=$(cat $PWD/infochap2)
	wget -U=firefox $chi
	((im++))
done

#nettoyage
mv $PWD/info $HOME/.local/share/Trash/files ; mv $PWD/info2 $HOME/.local/share/Trash/files ; mv $PWD/info3 $HOME/.local/share/Trash/files
mv $PWD/infochap $HOME/.local/share/Trash/files ; mv $PWD/infochap2 $HOME/.local/share/Trash/files

#création du .cbz
zip -r $vol$chap.cbz .
mv $vol$chap.cbz ..
cd ..
rm -r $PWD/$vol$chap
#vérif opération précédente
échec

#conversion pdf
if [ $pdf = "o" ] ; then ebook-convert $vol$chap.cbz $vol$chap.pdf --right2left | zenity --title "boomeranga!" --progress --text "Création de $manga $vol$chap.pdf" --auto-close --auto-kill ; fi
échec

#changement de chapitre / volume
wget -U=firefox http://mangafox.me/manga/$manga/$vol/$chap/$im.html -O infovol
grep '<p><span>Next Chapter:</span>' infovol > infovol2
cut -d "/" -f7 infovol2 > infovol
vol=$(cat $PWD/infovol)
cut -d "/" -f8 infovol2 > infovol
chap=$(cat $PWD/infovol)
im=1
done

echo $chapmax > $PWD/chaplast

mv $PWD/infovol $HOME/.local/share/Trash/files ; mv $PWD/infovol2 $HOME/.local/share/Trash/files

zenity --info --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --text "Vous trouverez les chapitres téléchargés dans le dossier <b>$ch</b> Bonne lecture! "
cd ..
}

annuaire() {
zenity --question --title "boomeranga" --window-icon "/usr/share/pixmaps/boomeranga.svg" --text "Cette option prend 2-3 minutes, l'exécuter ?" || menu
(nb_page=$(wget -qO - "http://www.lecture-en-ligne.com/index.php?page=liste&ordre=titre&p=1" | sed -n "/pagination/ s@.*>\([0-9]*\)</a>  ).*@\1@p")
for i in $(seq ${nb_page})
do
  wget -qO - "http://www.lecture-en-ligne.com/index.php?page=liste&ordre=titre&p=${i}" | grep -A 7 "tr onmouseover" | sed "s@^[[:space:]]*@@ ; s@</a>.*@@ ; s@<td class=\"td\">@@ ; s@</td>@@ ; /tr onmouseover\|<table class\|<td>\|--/d ; s@>@\n@ ; s@<a href=\"manga/@@ ; s@/\" class=\"infoImages\"@@"
done > .mangas
sed "s@<a href=@--@ ; /--/d ; /fois/d" .mangas > .mangas2
imax=$(wc -l .mangas2 | awk '{print $1}') ; let imax=imax/3 # détermine nb lignes
j=4
for (( i=1 ; i < $imax ; i=i+2 ))
do
# awk -v permet d'ajouter variable, print $NF = dernier mot
type=$(cat .mangas2 | grep "(" | awk -v i=$i 'NR == i {print;}' | awk '{print $NF}')
# insère le $type à la ligne j
sed -i "${j}i$type" .mangas2
let j=j+7
done
#supprime ( en début de ligne, ) en fin et (...
sed -i "s@^(@@ ; s@)\$@@ ; s@(.*@@" .mangas2
) | zenity --progress --pulsate --auto-close --no-cancel --title "boomeranga" --window-icon "/usr/share/pixmaps/boomeranga.svg" --text "Récupération des données"
manga=$(zenity --list --multiple --title "boomeranga" --window-icon "/usr/share/pixmaps/boomeranga.svg" --text "Veuillez choisir une série" --width "1200" --height "400" --hide-column="1" --column="Référence" --column="Nom du manga" --column="Genre" --column="Type" --column="Note" --column="Nb chap." --column="Dernier paru" < $PWD/.mangas2) || menu
mv $PWD/.mangas $HOME/.local/share/Trash/files && mv $PWD/.mangas2 $HOME/.local/share/Trash/files
télécharger
}

échec() {
while [ ${?} -ne 0 ]
do
	zenity --title "boomeranga!" --info --text "Echec de l'opération - retour au menu"
	menu
done
}

#### intro ####
zenity --info --ok-label "Go!" --timeout "2" --title "boomeranga! v$v" --window-icon "/usr/share/pixmaps/boomeranga.svg" --text "<b>boomeranga!</b> vous permet de télécharger 
des planches de manga depuis :

   * lecture-en-ligne.com (FR)
   * mangafox.me (EN)

Bonne lecture!"

#création chemin boomeranga
test -f $HOME/.boomeranga/ch
if [ $? = 1 ]
then
	mkdir -p $HOME/.boomeranga
	ch_tmp=$(zenity --file-selection --window-icon "/usr/share/pixmaps/boomeranga.svg" --title "Choisir le dossier des téléchargements boomeranga!" --directory)
	echo $ch_tmp/boomeranga > $HOME/.boomeranga/ch
fi

#info màj
cd $HOME/.boomeranga/
wget http://goupil.eu/repo/boomeranga_version -O version
v2=$(head -n 1 $HOME/.boomeranga/version)
[ $v = $v2 ] || zenity --info --ok-label "Ok" --timeout "2" --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --text "La version $v2 est disponible"

#vérification présence fichiers 'séries' et création si besoin
function séries {
ch=$(cat $HOME/.boomeranga/ch)
mkdir -p $ch/
cd $ch
test -f $PWD/séries
if [ $? = 1 ]
then
	> séries
fi
test -f $PWD/séries.mfox
if [ $? = 1 ]
then
	> séries.mfox
fi
}

function ch_maj {
ch_tmp=$(zenity --file-selection --window-icon "/usr/share/pixmaps/boomeranga.svg" --title "Choisir le dossier des téléchargements boomeranga!" --directory)
echo $ch_tmp/boomeranga > $HOME/.boomeranga/ch_new
ch=$(cat $HOME/.boomeranga/ch)
ch_new=$(cat $HOME/.boomeranga/ch_new)
mv $ch $ch_new
mv $HOME/.boomeranga/ch_new $HOME/.boomeranga/ch
zenity --info --ok-label "bye!" --timeout "5" --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --text "Merci de redémarrer boomeranga! pour que les
changements soient effectifs" & exit
}

#option pdf
function convert_pdf {
pdf=$(zenity --list --checklist --cancel-label "Quitter" --title "boomeranga!" --text "Convertir en .pdf ?" --column=option --column=description 1 "activer conversion pdf") || exit
case "${pdf}" in
"") pdf=""
;;
esac

if [[ -z $pdf ]]
then pdf="n"
else pdf="o"
fi
}
séries

#menu général avec `case`
function menu {
option=$(zenity --list --window-icon "/usr/share/pixmaps/boomeranga.svg" --width "350" --height "350" --cancel-label "Quitter" --title "boomeranga!" --text "Menu principal" --column=option --column=description 1 "Télécharger mangas (FR)" 2 ">> Voir/Modifier liste de suivi (FR)" \
3 "Annuaire mangas (FR)" 4 "Télécharger mangas (EN)" 5 ">> Voir/Modifier liste de suivi (EN)" 6 "================" 7 "Modifier le chemin de boomeranga!" 8 "Consulter l'aide en ligne" 9 "Demander une fonctionnalité") || exit
case "${option}" in
1) poursuite_series
;;
2) zenity --text-info --editable --cancel-label "Quitter" --filename "$ch/séries" > $ch/séries_maj &&
mv $PWD/séries $HOME/.local/share/Trash/files && mv $PWD/séries_maj $PWD/séries && menu
;;
3) annuaire
;;
4) poursuite_series_mangafox
;;
5) zenity --text-info --editable --cancel-label "Quitter" --filename "$ch/séries.mfox" > $ch/séries.mfox_maj &&
mv $PWD/séries.mfox $HOME/.local/share/Trash/files && mv $PWD/séries.mfox_maj $PWD/séries.mfox && menu
;;
6) echo "y'a rien ici :p" && menu
;;
7) ch_maj && menu
;;
8) xdg-open 'http://blog.goupil.eu/?boomeranga' & menu
;;
9) xdg-open 'http://forum.ubuntu-fr.org/viewtopic.php?id=1282211' & menu
;;
esac
}

convert_pdf
#### lancement boomeranga! ####
menu

Hors ligne

#48 Le 09/06/2013, à 01:02

milkshake

Re : boomeranga! pour les amateurs de mangas

Et bien ça avance !

J'ai deux petites remarques :

1 ) Petit "soucis", quand on essaie de poursuivre les séries en cours :
Si on suit par exemple 10 mangas, on a 10 fois la fenêtre qui s'affiche + 10 clics :
"" Vous trouverez les chapitres téléchargés dans le dossier /home/xxxx/Bureau/manga/boomeranga Bonne lecture! ""

Et ce qu'il y aie un nouveau chapitre ou pas.

####

2 ) Il faudrait changer :

#récupérer les images
im=01
for im in $(seq -w ${imax})
do
  wget http://www.lecture-en-ligne.com/images/mangas/$manga/$chap/$im.jpg
done

en

#récupérer les images
im=01
for im in $(seq -w ${imax})
do
  wget -T 10 -t 50 http://www.lecture-en-ligne.com/images/mangas/$manga/$chap/$im.jpg
done

Ça évite les freeze de 900 secondes dans le script, si une requête échoue.
( ca fait un freeze d'un quart d'heure sad )

"-T 10" passe le délai de 900 secondes en cas de timeout à 10 secondes.
"-t 50" augmente les essais en cas d'échec de 20 à 50.

Dernière modification par milkshake (Le 09/06/2013, à 01:33)

Hors ligne

#49 Le 09/06/2013, à 14:54

chachatte

Re : boomeranga! pour les amateurs de mangas

Excellent merci beaucoup!

Edit: Fonctionne bizarrement chez moi si je prend tous les chapitres il m'efface les chapitres en les téléchargeant ,du coup je me retrouve avec un seul chapitre le dernier.

Dernière modification par chachatte (Le 09/06/2013, à 15:30)

Hors ligne

#50 Le 09/06/2013, à 16:43

WeetabiX

Re : boomeranga! pour les amateurs de mangas

Voilà la nouvelle version qui :
* ajoute la vérification 404 sur le titre du manga
* modifie le timeout de wget
* corrige la fenêtre d'information de màj des séries

#!/bin/bash
#weetabix' 2013 v0.9.4-3

##################
#  Boomeranga!   #
##################

v=0.9.4-3

#fonction télécharger()
function télécharger {
mkdir $manga
cd $PWD/$manga/

#vérif page 404
erreur=$(wget -qO - http://www.lecture-en-ligne.com/$manga/1/0/0/1.html | grep -c 'ERREUR 404')
if [ $erreur = 1 ]
then zenity --error --title "boomeranga!" --text "manga non trouvé - abandon"
	cd $ch
	mv $PWD/$manga $HOME/.local/share/Trash/files & menu
fi

#connaitre chapitre max d'1 manga
wget http://www.lecture-en-ligne.com/$manga/1/0/0/1.html -O infochap
grep -A 1 'id="chap"' infochap > infochap2
head -2 infochap2 | tail -1 > infochap
cut -d ">" -f2 infochap | cut -d "<" -f1 > infochap2
chap_man=$(cat $PWD/infochap2)

chap=$(zenity --title "boomeranga" --window-icon "/usr/share/pixmaps/boomeranga.svg" --entry --cancel-label "Quitter" --text "Commencer à quel chapitre ?") || exit

im=01
chapn=$(($chap_man-$chap+1)) # définir chapitres restant

zenity --title "boomeranga" --window-icon "/usr/share/pixmaps/boomeranga.svg" --question --text "$manga - Télécharger tous les chapitres disponibles ?   [$chap_man paru(s) / $chapn nouveau(x)]"
if [ $? = 0 ]
then
	chapmax=$chap_man
	((chapmax++))
else
	chapmax=$(zenity --title "boomeranga" --window-icon "/usr/share/pixmaps/boomeranga.svg" --cancel-label "Quitter" --entry --text "Stopper à quel chapitre ?   [vous êtes au n°$chap]") || exit
	((chapmax++))
fi

while [ $chap != $chapmax ]
do
mkdir $chap
cd $PWD/$chap/

#rechercher le nb de pages du chapitre
wget http://www.lecture-en-ligne.com/$manga/$chap/0/0/1.html -O info
grep 'current_total_pages' info > info2
cut -d "'" -f2 info2 > info3
imax=`cat $PWD/info3`

#vérif page 404 - chapitre
erreur=$(grep -c 'ERREUR 404' info)
if [ $erreur = 1 ]
then zenity --error --title "boomeranga!" --text "chapitre non trouvé - abandon"
	cd $ch
	mv $PWD/$manga $HOME/.local/share/Trash/files & menu
fi

#info
notify-send -i /usr/share/pixmaps/boomeranga.svg -t 2000 "Téléchargement du chapitre $chap"

#récupérer les images
im=01
for im in $(seq -w ${imax})
do
  wget -T 15 http://www.lecture-en-ligne.com/images/mangas/$manga/$chap/$im.jpg
done

#création du .cbz
rm $PWD/info & rm $PWD/info2 & rm $PWD/info3
zip -r $chap.cbz .
mv $chap.cbz ..
cd ..
rm -r $PWD/$chap
échec

#conversion pdf
if [ $pdf = "o" ] ; then ebook-convert $chap.cbz $chap.pdf --right2left | zenity --title "boomeranga!" --progress --text "Création de $manga $chap.pdf" --auto-close --auto-kill ; fi
échec

#changement de chapitre
((chap++))
im=01
done

rm $PWD/infochap
echo $chapmax > $PWD/chaplast

#inscrire manga dans liste 'séries' sauf si déjà présent
cd ..
grep $manga séries
if [ $? != 0 ]
then
	echo $manga >> séries
fi
zenity --info --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --text "Vous trouverez les chapitres téléchargés dans le dossier <b>$ch</b> Bonne lecture! "
menu
}

function télécharger_poursuite {
cd $manga
wget http://www.lecture-en-ligne.com/$manga/1/0/0/1.html -O infochap
grep -A 1 'id="chap"' infochap > infochap2
head -2 infochap2 | tail -1 > infochap
cut -d ">" -f2 infochap | cut -d "<" -f1 > infochap2
chap_man=$(cat $PWD/infochap2)

chap=$(cat $PWD/chaplast)

im=01
chapn=$(($chap_man-$chap+1)) # définir chapitres restant

chapmax=$chap_man
((chapmax++))

while [ $chap != $chapmax ]
do

mkdir $chap
cd $PWD/$chap/

#rechercher le nb de pages du chapitre
wget http://www.lecture-en-ligne.com/$manga/$chap/0/0/1.html -O info
grep 'current_total_pages' info > info2
cut -d "'" -f2 info2 > info3
imax=$(cat $PWD/info3)

#info
notify-send -i /usr/share/pixmaps/boomeranga.svg -t 2000 "Téléchargement de la suite de $manga"

#récupérer les images
im=01
for im in $(seq -w ${imax})
do
  wget -T 15 http://www.lecture-en-ligne.com/images/mangas/$manga/$chap/$im.jpg
done

#création du .cbz
rm $PWD/info & rm $PWD/info2 & rm $PWD/info3
zip -r $chap.cbz .
mv $chap.cbz ..
cd ..
rm -r $PWD/$chap
échec

#conversion pdf
if [ $pdf = "o" ] ; then ebook-convert $chap.cbz $chap.pdf --right2left | zenity --title "boomeranga!" --progress --text "Création de $manga $chap.pdf" --auto-close --auto-kill ; fi
échec

#changement de chapitre
((chap++))
im=01
done

rm $PWD/infochap
echo $chapmax > $PWD/chaplast

cd ..
}

function poursuite_series {
zenity --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --question --text "Poursuivre les séries en cours :
<b>$(cat séries)</b> ?"
if [ $? = 0 ]
then
	nb_ligm=$(wc -l séries | cut -d " " -f1)
	((nb_ligm++))
	nb_lig=1
	while [ $nb_lig != $nb_ligm ]
	do
	manga=$(head -n $nb_lig séries | tail -n 1)
	télécharger_poursuite
	((nb_lig++))
	done
	zenity --info --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --text "Toutes les séries sont à jour"
	menu
else
	manga=`zenity --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --entry --cancel-label "Quitter" --text "Nouveau manga - nom du manga ?"` || exit

	#si manga vide
	if [ -z $manga ]
	then zenity --error --title "boomeranga!" --text "Erreur dans le nom - abandon" & exit
	fi
	télécharger
fi
}

function poursuite_series_mangafox {
zenity --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --question --text "Poursuivre les séries en cours : 
<b>$(cat séries.mfox)</b> ?"
if [ $? = 0 ]
then
	nb_ligm=$(wc -l séries.mfox | cut -d " " -f1)
	((nb_ligm++))
	nb_lig=1
	while [ $nb_lig != $nb_ligm ]
	do
	manga=$(head -n $nb_lig séries.mfox | tail -n 1)
	télécharger_poursuite_mfox
	((nb_lig++))
	done
	zenity --info --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --text "Toutes les séries sont à jour"
	menu
else
	manga=$(zenity --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --entry --cancel-label "Quitter" --text "Nouveau manga - nom du manga ?") || exit

	#si manga vide
	if [ -z $manga ]
	then zenity --error --title "boomeranga!" --text "Erreur dans le nom - abandon" & exit
	fi
	télécharger_mangafox
fi
}

#fonction télécharger_mangafox() / pas info chap. max / vol inutile (oui et non) car redirection auto fct chapitre
function télécharger_mangafox {

mkdir $manga
cd $PWD/$manga/

info=$(zenity --forms --title "boomeranga!" --cancel-label "Quitter" --add-entry "Chapitre début (forme 001)" --add-entry "Chapitre fin (forme 001+1)" --window-icon "/usr/share/pixmaps/boomeranga.svg")
chap="c"$(echo $info | cut -d "|" -f 1)
chapmax="c"$(echo $info | cut -d "|" -f 2)

vol="v01"
im=1

while [ $chap != $chapmax ]
do
mkdir -p $vol$chap
cd $PWD/$vol$chap/

#rechercher le nb de pages du chapitre
wget -U=firefox http://mangafox.me/manga/$manga/$vol/$chap/$im.html -O info
grep 'var total_pages=' info > info2
cut -d "=" -f2 info2 | cut -d ";" -f1 > info3
imax=$(cat $PWD/info3)
let imaxi=imax+1

#404
erreur=$(cat $PWD/info)
[[ $erreur ]]
if [ $? = 1 ]
then
	zenity --error --title "boomeranga!" --text "Manga/chapitre non trouvé - abandon"
	cd $ch
	mv $PWD/$manga $HOME/.local/share/Trash/files & exit
fi

#info
notify-send -i /usr/share/pixmaps/boomeranga.svg -t 2000 "Téléchargement du chapitre $chap"

#récupérer les images du chapitre
while [ $im != $imaxi ]
do 
	wget -U=firefox http://mangafox.me/manga/$manga/$vol/$chap/$im.html -O infochap
	grep -A 1 'onclick="return enlarge()"><img src=' infochap > infochap2
	head -1 infochap2 > infochap
	cut -d '"' -f6 infochap | cut -d '"' -f1 > infochap2
	chi=$(cat $PWD/infochap2)
	wget -U=firefox $chi
	((im++))
done

#création du .cbz
mv $PWD/info $HOME/.local/share/Trash/files ; mv $PWD/info2 $HOME/.local/share/Trash/files ; mv $PWD/info3 $HOME/.local/share/Trash/files
mv $PWD/infochap $HOME/.local/share/Trash/files ; mv $PWD/infochap2 $HOME/.local/share/Trash/files

zip -r $vol$chap.cbz .
mv $vol$chap.cbz ..
cd ..
rm -r $PWD/$vol$chap
échec

#conversion pdf
if [ $pdf = "o" ] ; then ebook-convert $vol$chap.cbz $vol$chap.pdf --right2left | zenity --title "boomeranga!" --progress --text "Création de $manga $vol$chap.pdf" --auto-close --auto-kill ; fi
échec

#changement de chapitre / volume
wget -U=firefox http://mangafox.me/manga/$manga/$vol/$chap/$im.html -O infovol
grep '<p><span>Next Chapter:</span>' infovol > infovol2
cut -d "/" -f7 infovol2 > infovol
vol=`cat $PWD/infovol`
cut -d "/" -f8 infovol2 > infovol
chap=$(cat $PWD/infovol)
im=1

mv $PWD/infovol $HOME/.local/share/Trash/files ; mv $PWD/infovol2 $HOME/.local/share/Trash/files
done

echo $chapmax > $PWD/chaplast

#inscrire manga dans liste 'séries' sauf si déjà présent
cd ..
grep $manga séries.mfox
if [ $? != 0 ]
then
	echo $manga >> séries.mfox
fi

zenity --info --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --text "Vous trouverez les chapitres téléchargés dans le dossier <b>$ch</b> Bonne lecture! "
cd $ch
menu
}

function télécharger_poursuite_mfox {
cd $manga
vol="v01"
chap=$(cat $PWD/chaplast)
chapmax="c"$(zenity --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --entry --cancel-label "Quitter" --text "$manga - Stopper à quel chapitre (forme 001+1)? [vous êtes au n°$chap]") || exit
im=1

while [ $chap != $chapmax ]
do
mkdir -p $vol$chap
cd $PWD/$vol$chap/

wget -U=firefox http://mangafox.me/manga/$manga/$vol/$chap/$im.html -O info
grep 'var total_pages=' info > info2
cut -d "=" -f2 info2 | cut -d ";" -f1 > info3
imax=$(cat $PWD/info3)
let imaxi=imax+1

#info
notify-send -i /usr/share/pixmaps/boomeranga.svg -t 2000 "Téléchargement de la suite de $manga"

#récupérer les images du chapitre
while [ $im != $imaxi ]
do 
	wget -U=firefox http://mangafox.me/manga/$manga/$vol/$chap/$im.html -O infochap
	grep -A 1 'onclick="return enlarge()"><img src=' infochap > infochap2
	head -1 infochap2 > infochap
	cut -d '"' -f6 infochap | cut -d '"' -f1 > infochap2
	chi=$(cat $PWD/infochap2)
	wget -U=firefox $chi
	((im++))
done

#nettoyage
mv $PWD/info $HOME/.local/share/Trash/files ; mv $PWD/info2 $HOME/.local/share/Trash/files ; mv $PWD/info3 $HOME/.local/share/Trash/files
mv $PWD/infochap $HOME/.local/share/Trash/files ; mv $PWD/infochap2 $HOME/.local/share/Trash/files

#création du .cbz
zip -r $vol$chap.cbz .
mv $vol$chap.cbz ..
cd ..
rm -r $PWD/$vol$chap
#vérif opération précédente
échec

#conversion pdf
if [ $pdf = "o" ] ; then ebook-convert $vol$chap.cbz $vol$chap.pdf --right2left | zenity --title "boomeranga!" --progress --text "Création de $manga $vol$chap.pdf" --auto-close --auto-kill ; fi
échec

#changement de chapitre / volume
wget -U=firefox http://mangafox.me/manga/$manga/$vol/$chap/$im.html -O infovol
grep '<p><span>Next Chapter:</span>' infovol > infovol2
cut -d "/" -f7 infovol2 > infovol
vol=$(cat $PWD/infovol)
cut -d "/" -f8 infovol2 > infovol
chap=$(cat $PWD/infovol)
im=1
done

echo $chapmax > $PWD/chaplast

mv $PWD/infovol $HOME/.local/share/Trash/files ; mv $PWD/infovol2 $HOME/.local/share/Trash/files

cd ..
}

annuaire() {
zenity --question --title "boomeranga" --window-icon "/usr/share/pixmaps/boomeranga.svg" --text "Cette option prend 2-3 minutes, l'exécuter ?" || menu
(nb_page=$(wget -qO - "http://www.lecture-en-ligne.com/index.php?page=liste&ordre=titre&p=1" | sed -n "/pagination/ s@.*>\([0-9]*\)</a>  ).*@\1@p")
for i in $(seq ${nb_page})
do
  wget -qO - "http://www.lecture-en-ligne.com/index.php?page=liste&ordre=titre&p=${i}" | grep -A 7 "tr onmouseover" | sed "s@^[[:space:]]*@@ ; s@</a>.*@@ ; s@<td class=\"td\">@@ ; s@</td>@@ ; /tr onmouseover\|<table class\|<td>\|--/d ; s@>@\n@ ; s@<a href=\"manga/@@ ; s@/\" class=\"infoImages\"@@"
done > .mangas
sed "s@<a href=@--@ ; /--/d ; /fois/d" .mangas > .mangas2
imax=$(wc -l .mangas2 | awk '{print $1}') ; let imax=imax/3 # détermine nb lignes
j=4
for (( i=1 ; i < $imax ; i=i+2 ))
do
# awk -v permet d'ajouter variable, print $NF = dernier mot
type=$(cat .mangas2 | grep "(" | awk -v i=$i 'NR == i {print;}' | awk '{print $NF}')
# insère le $type à la ligne j
sed -i "${j}i$type" .mangas2
let j=j+7
done
#supprime ( en début de ligne, ) en fin et (...
sed -i "s@^(@@ ; s@)\$@@ ; s@(.*@@" .mangas2
) | zenity --progress --pulsate --auto-close --no-cancel --title "boomeranga" --window-icon "/usr/share/pixmaps/boomeranga.svg" --text "Récupération des données"
manga=$(zenity --list --multiple --title "boomeranga" --window-icon "/usr/share/pixmaps/boomeranga.svg" --text "Veuillez choisir une série" --width "1200" --height "400" --hide-column="1" --column="Référence" --column="Nom du manga" --column="Genre" --column="Type" --column="Note" --column="Nb chap." --column="Dernier paru" < $PWD/.mangas2) || menu
#mv $PWD/.mangas $HOME/.local/share/Trash/files && mv $PWD/.mangas2 $HOME/.local/share/Trash/files
télécharger
}

échec() {
while [ ${?} -ne 0 ]
do
	zenity --title "boomeranga!" --info --text "Echec de l'opération - retour au menu"
	menu
done
}

#### intro ####
zenity --info --ok-label "Go!" --timeout "2" --title "boomeranga! v$v" --window-icon "/usr/share/pixmaps/boomeranga.svg" --text "<b>boomeranga!</b> vous permet de télécharger 
des planches de manga depuis :

   * lecture-en-ligne.com (FR)
   * mangafox.me (EN)

Bonne lecture!"

#création chemin boomeranga
test -f $HOME/.boomeranga/ch
if [ $? = 1 ]
then
	mkdir -p $HOME/.boomeranga
	ch_tmp=$(zenity --file-selection --window-icon "/usr/share/pixmaps/boomeranga.svg" --title "Choisir le dossier des téléchargements boomeranga!" --directory)
	echo $ch_tmp/boomeranga > $HOME/.boomeranga/ch
fi

#info màj
cd $HOME/.boomeranga/
wget http://goupil.eu/repo/boomeranga_version -O version
v2=$(head -n 1 $HOME/.boomeranga/version)
[ $v = $v2 ] || zenity --info --ok-label "Ok" --timeout "2" --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --text "La version $v2 est disponible"

#vérification présence fichiers 'séries' et création si besoin
function séries {
ch=$(cat $HOME/.boomeranga/ch)
mkdir -p $ch/
cd $ch
test -f $PWD/séries
if [ $? = 1 ]
then
	> séries
fi
test -f $PWD/séries.mfox
if [ $? = 1 ]
then
	> séries.mfox
fi
}

function ch_maj {
ch_tmp=$(zenity --file-selection --window-icon "/usr/share/pixmaps/boomeranga.svg" --title "Choisir le dossier des téléchargements boomeranga!" --directory)
echo $ch_tmp/boomeranga > $HOME/.boomeranga/ch_new
ch=$(cat $HOME/.boomeranga/ch)
ch_new=$(cat $HOME/.boomeranga/ch_new)
mv $ch $ch_new
mv $HOME/.boomeranga/ch_new $HOME/.boomeranga/ch
zenity --info --ok-label "bye!" --timeout "5" --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --text "Merci de redémarrer boomeranga! pour que les
changements soient effectifs" & exit
}

#option pdf
function convert_pdf {
pdf=$(zenity --list --checklist --cancel-label "Quitter" --title "boomeranga!" --text "Convertir en .pdf ?" --column=option --column=description 1 "activer conversion pdf") || exit
case "${pdf}" in
"") pdf=""
;;
esac

if [[ -z $pdf ]]
then pdf="n"
else pdf="o"
fi
}
séries

#menu général avec `case`
function menu {
option=$(zenity --list --window-icon "/usr/share/pixmaps/boomeranga.svg" --width "350" --height "350" --cancel-label "Quitter" --title "boomeranga!" --text "Menu principal" --column=option --column=description 1 "Télécharger mangas (FR)" 2 ">> Voir/Modifier liste de suivi (FR)" \
3 "Annuaire mangas (FR)" 4 "Télécharger mangas (EN)" 5 ">> Voir/Modifier liste de suivi (EN)" 6 "================" 7 "Modifier le chemin de boomeranga!" 8 "Consulter l'aide en ligne" 9 "Demander une fonctionnalité") || exit
case "${option}" in
1) poursuite_series
;;
2) zenity --text-info --editable --cancel-label "Quitter" --filename "$ch/séries" > $ch/séries_maj &&
mv $PWD/séries $HOME/.local/share/Trash/files && mv $PWD/séries_maj $PWD/séries && menu
;;
3) annuaire
;;
4) poursuite_series_mangafox
;;
5) zenity --text-info --editable --cancel-label "Quitter" --filename "$ch/séries.mfox" > $ch/séries.mfox_maj &&
mv $PWD/séries.mfox $HOME/.local/share/Trash/files && mv $PWD/séries.mfox_maj $PWD/séries.mfox && menu
;;
6) echo "y'a rien ici :p" && menu
;;
7) ch_maj && menu
;;
8) xdg-open 'http://blog.goupil.eu/?boomeranga' & menu
;;
9) xdg-open 'http://forum.ubuntu-fr.org/viewtopic.php?id=1282211' & menu
;;
esac
}

convert_pdf
#### lancement boomeranga! ####
menu

Hors ligne