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.

#1 Le 18/05/2013, à 10:47

WeetabiX

boomeranga! pour les amateurs de mangas

Bonjour à tous, et aux amoureux de mangas en particuliers wink
Je vous propose un petit script bash (le code n'est surement pas nickel, j'apprends !) qui vous permet de télécharger les tomes de votre choix depuis le site http://www.lecture-en-ligne.com afin de les lire quand vous le souhaitez avec le confort de comix par exemple.

[edit]
boomeranga! (0.9.8) permet aujourd'hui :
* récupération des chapitres désirés pour les mangas depuis lecture-en-ligne.com, mangafox.me et scan-manga.com
* moteur de recherche multisites
* conversion automatique en .cbz
* possibilité de conversion en .pdf pour liseuses par exemple (grâce à Calibre)
* gestion de listes de suivis
* notification de disponibilité de màj pour le script
* annuaires lecture-en-ligne.com, mangafox.me et scan-manga.com
* avertissement dépendances nécessaires

#!/bin/bash
#weetabix' 2013

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

####description###########################################################################################
# boomeranga! a pour but d'améliorer le confort de lecture des planches de mangas disponibles sur le net #
# en les téléchargeant, puis en les compressant en .cbz (pour comix) et .pdf (si souhaité).				 #
# 																										 #
# Le script crée un dossier .boomeranga dans le home de l'utilisateur et y conserve 2 informations :     #
# 					-le chemin vers le dossier de téléchargement										 #
#					-le changelog																		 #
#																										 #
# N'hésitez pas à participer au projet en postant vos idées, remarques, bugs							 #
#																										 #		
# Info de versions : les versions <1 se concentrent sur le support de sites et les fonctionnalités.		 #
#					 la version 1.0 ne sortira que lorsque celles-ci seront jugées suffisantes.          #
#                       L'interface	graphique sera sa principale évolution.								 #	
##########################################################################################################


####dépendances#####################
# bash, wget, zip, calibre, zenity #
####################################

v=0.9.8
#gestion dépendances
paquet=(bash calibre wget zip)

function télécharger {
#vérif si appel fonction depuis annuaire ou gb
if [[ ${an} != 1 ]]
then
	if [[ ${gb} != 1 ]]
	then
	manga=`zenity --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --entry --cancel-label "Quitter" --text "Nouveau manga - nom du manga ?"` || menu
	fi
fi

mkdir $manga
cd $PWD/$manga/

#vérif page 404
if [[ -z $(grep ${manga} ../.404) ]]
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
if [[ -z $(grep -c 'ERREUR 404' info) ]]
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 1000 "Téléchargement du chapitre $chap"
#récupérer les images
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
[[ ${pdf} = "o" ]] && ebook-convert $chap.cbz $chap.pdf --right2left | zenity --title "boomeranga!" --progress --text "Création de $manga $chap.pdf" --auto-close --auto-kill
#é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! "
#on désactive variable annuaire
an=0 & gb=0
menu
}
function télécharger_poursuite {
cd $manga
wget http://www.lecture-en-ligne.com/$manga/1/0/0/1.html -O infochap
#vérification pour mangas sans n°1
grep "ERREUR 404" infochap
if [ $? = 1 ]
then
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++))

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

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)

#récupérer les images
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
[[ ${pdf} = "o" ]] && ebook-convert $chap.cbz $chap.pdf --right2left | zenity --title "boomeranga!" --progress --text "Création de $manga $chap.pdf" --auto-close --auto-kill
#échec

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

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

fi
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 ?"` || menu
	
	#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 ?") || menu

	#si manga vide
	if [ -z $manga ]
	then zenity --error --title "boomeranga!" --text "Erreur dans le nom - abandon" & exit
	fi
	télécharger_mangafox
fi
}
function poursuite_series_scan-manga() {
zenity --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --question --text "Poursuivre les séries en cours :
<b>$(cat séries.scan-manga)</b> ?"
if [ $? = 0 ]
then
	nb_ligm=$(wc -l séries.scan-manga | cut -d " " -f1)
	((nb_ligm++))
	nb_lig=1
	while [ $nb_lig != $nb_ligm ]
	do
	manga=$(head -n $nb_lig séries.scan-manga | tail -n 1)
	dir=$(echo ${manga} | cut -d "/" -f5 | cut -d "." -f1)
	télécharger_poursuite_scan-manga
	((nb_lig++))
	done
	zenity --info --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --text "Toutes les séries sont à jour"
	menu
fi
}
function poursuite_all() {
#poursuite lecture-en-ligne.com
zenity --progress --pulsate --timeout "1" --no-cancel --auto-close --title "boomeranga" --window-icon "/usr/share/pixmaps/boomeranga.svg" \
--text "Mise à jour des séries :
<b>$(cat séries)</b>"
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

#poursuite mangafox.me
zenity --progress --pulsate --timeout "1" --no-cancel --auto-close --title "boomeranga" --window-icon "/usr/share/pixmaps/boomeranga.svg" \
--text "Mise à jour des séries :
<b>$(cat séries.mfox)</b>"
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

#poursuite scan-manga.com
zenity --progress --pulsate --timeout "1" --no-cancel --auto-close --title "boomeranga" --window-icon "/usr/share/pixmaps/boomeranga.svg" \
--text "Mise à jour des séries :
<b>$(cat séries.scan-manga)</b>"
nb_ligm=$(wc -l séries.scan-manga | cut -d " " -f1)
((nb_ligm++))
nb_lig=1
while [ $nb_lig != $nb_ligm ]
do
manga=$(head -n $nb_lig séries.scan-manga | tail -n 1)
dir=$(echo ${manga} | cut -d "/" -f5 | cut -d "." -f1)
télécharger_poursuite_scan-manga
((nb_lig++))
done

zenity --info --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --text "Toutes les séries sont à jour"
menu
}

function télécharger_mangafox {
if [[ ${an} != 1 ]]
then
	if [[ ${gb} != 1 ]]
	then
	manga=`zenity --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --entry --cancel-label "Quitter" --text "Nouveau manga - nom du manga ?"` || menu
	fi
fi

mkdir $manga
cd $PWD/$manga/

#dernier chapitre
chap_man=$(wget -U=firefox -qO - "http://mangafox.me/manga/${manga}/" | grep -A 1 "Chapters</h2><hr/>" | grep "Chapter " | sed "s@.*Chapter@@ ; s@.* - @@ ; s@</span></h3></div><ul class=\"chlist\" style=\"display:block\">@@")

info=$(zenity --forms --title "boomeranga" --text "Choix des chapitres" --cancel-label "Quitter" --add-entry "Chapitre début" --add-entry "Chapitre fin (dernier : ${chap_man})" --window-icon "/usr/share/pixmaps/boomeranga.svg")

#chap=${info%|*}
chap=$(echo $info | cut -d "|" -f 1)
((chap++))
#chapmax=c${info#*|}
chapmax=$(echo $info | cut -d "|" -f 2)
((chapmax++))

#formatage
if test ${#chap} = 1
then chap="c00"$(echo $info | cut -d "|" -f 1)
elif test ${#chap} = 2
then chap="c0"$(echo $info | cut -d "|" -f 1)
else
chap="c"$(echo $info | cut -d "|" -f 1)
fi

#formatage
if test ${#chapmax} = 1
then chapmax="c00"$(echo $info | cut -d "|" -f 2)
elif test ${#chapmax} = 2
then chapmax="c0"$(echo $info | cut -d "|" -f 2)
else
chapmax="c"$(echo $info | cut -d "|" -f 2)
fi

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
if [[ -z $(cat $PWD/info) ]]
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 1000 "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=$(< $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
[[ ${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
#échec

#changement de chapitre / volume
chap=$(echo ${chap} | sed "s@.*c@@")
#incrément
((chap++))
#formatage
if test ${#chap} = 1
then chap="c00"${chap}
elif test ${#chap} = 2
then chap="c0"${chap}
else
chap="c"${chap}
fi

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

an=0 & gb=0

menu
}
function télécharger_poursuite_mfox {
cd $manga
vol="v01"
chap=$(cat $PWD/chaplast)
chapmax=$(wget -U=firefox -qO - "http://mangafox.me/manga/${manga}/" | grep -A 1 "Chapters</h2><hr/>" | grep "Chapter " | sed "s@.*Chapter@@ ; s@.* - @@ ; s@</span></h3></div><ul class=\"chlist\" style=\"display:block\">@@")
((chapmax++))
#compter longueur variable et comparer avec commande test
if test ${#chapmax} = 1
then chapmax="c00"${chapmax}
elif test ${#chapmax} = 2
then chapmax="c0"${chapmax}
else
chapmax="c"${chapmax}
fi

im=1

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

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

#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
[[ ${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
#échec

#changement de chapitre / volume
chap=$(echo ${chap} | sed "s@.*c@@")
#incrément
((chap++))
#formatage
if test ${#chap} = 1
then chap="c00"${chap}
elif test ${#chap} = 2
then chap="c0"${chap}
else
chap="c"${chap}
fi

im=1
done

echo $chapmax > $PWD/chaplast

cd ..
}

function telecharger_scan-manga() {
mkdir $dir
cd $PWD/$dir/

#vérif page 404

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

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++))

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

wget "${manga}" -O titre 
grep -A 3 "Chapitre ${chap} :" titre > titre1
grep "http://www.scan-manga.com/lecture-en-ligne" titre1 > titre
sed -i "s@.*http://www.scan-manga.com/lecture-en-ligne@http://www.scan-manga.com/lecture-en-ligne@" titre
sed -i "s@.html.*@.html@" titre
lienp=$(cat titre)

wget ${lienp} -O info
lien=$(grep "#image_lel').attr('src','http://leI" info | cut -d "'" -f6)
grep "var u = new Array;" info > totim
sed -i "s@\"@\n@g" totim 
sed -i "/^var/d ; /;/d" totim

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

nb_imx=$(wc -l totim | cut -d " " -f1)
((nb_imx++))
nb_im=1
	while [ $nb_im != $nb_imx ]
	do
	im=$(head -n ${nb_im} totim | tail -n 1)
	wget ${lien}${im}
	((nb_im++))
	done

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

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

#changement de chapitre
((chap++))
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.scan-manga
if [ $? != 0 ]
then
	echo ${manga} >> séries.scan-manga
fi
menu
}
function télécharger_poursuite_scan-manga {
cd $dir

#connaitre chapitre max d'1 manga
#sed -n "/^Vol/p" supprime tout ce qui ne commence pas par "Vol"
chapmax=$(grep -A 5 "${manga}" ../.mangas_scan-manga | sed -n "/^Vol/p" | sed "s@.*Ch @@")
((chapmax++))

chap=$(cat $PWD/chaplast)

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

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

wget "${manga}" -O titre 
grep -A 3 "Chapitre ${chap} :" titre > titre1
grep "http://www.scan-manga.com/lecture-en-ligne" titre1 > titre
sed -i "s@.*http://www.scan-manga.com/lecture-en-ligne@http://www.scan-manga.com/lecture-en-ligne@" titre
sed -i "s@.html.*@.html@" titre
lienp=$(cat titre)

wget ${lienp} -O info
lien=$(grep "#image_lel').attr('src','http://leI" info | cut -d "'" -f6)
grep "var u = new Array;" info > totim
sed -i "s@\"@\n@g" totim 
sed -i "/^var/d ; /;/d" totim

nb_imx=$(wc -l totim | cut -d " " -f1)
((nb_imx++))
nb_im=1
	while [ $nb_im != $nb_imx ]
	do
	im=$(head -n ${nb_im} totim | tail -n 1)
	wget ${lien}${im}
	((nb_im++))
	done

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

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

#changement de chapitre
((chap++))
done

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

cd ..
}

### annuaires ###
annuaire() {
test -f $PWD/.mangas2
if [ $? = 1 ]
then
zenity --question --title "boomeranga" --window-icon "/usr/share/pixmaps/boomeranga.svg" --text "Lors du premier lancement 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"
fi
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
#initialisation variable annuaire
an=1
télécharger
}
annuaire_mfox() {
test -f $PWD/.mangas_mfox
if [ $? = 1 ]
then
zenity --question --title "boomeranga" --window-icon "/usr/share/pixmaps/boomeranga.svg" --text "Lors du premier lancement cette option prend environ 5 minutes, l'exécuter ?" || menu
(
nb_page=300 #préciser nb pages par recherche sed
for i in $(seq ${nb_page})
do
  wget -U=firefox -qO - "http://mangafox.me/directory/${i}.htm" | grep -A 4 "<div class=\"manga_text\">" | sed "s@^[[:space:]]*@@ ; /<div class=\"manga_text\">/d ; s@^<a class=\"title\" href=\"http://mangafox.me/manga/@@ ; 
  s@^<p class=\"info\" title=\"@@ ; s@/\" rel=\"[0-9]*\">@\n@ ; s@^.*\"rate\">@@ ; s@<p class=\"info\"><label>@@ ; s@.*</label> @@ ; s@\">.*@@ ; s@</a>@@ ; s@</span>@@ ; s@</p>@@ ; /--/d"
done > .mangas_mfox
#correction erreur sur 1 ligne
sed -i "s@ - &quot.*@@" .mangas_mfox
) | zenity --progress --pulsate --auto-close --no-cancel --title "boomeranga" --window-icon "/usr/share/pixmaps/boomeranga.svg" --text "Récupération des données"
fi
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="Note" --column="Genre" --column="Visites" < $PWD/.mangas_mfox) || menu
#initialisation variable annuaire
an=1
télécharger_mangafox
}
annuaire_scan-manga() {
test -f $PWD/.mangas_scan-manga
if [ $? = 1 ]
then
(
wget -qO - http://www.scan-manga.com/scanlation/liste_des_mangas.html | grep "<div class=\"texte_lettre\">" -A 15 > .mangas_scan-manga
sed -i "/<div class=\"texte_lettre/d ; /<div class=\"texte_manga book_open\">/d ; s@<span class=\"hover_text_manga\"@\n@ 
s@<h3><a class=\"texte_manga\" href=\"@@ ; /<div class=\"texte_note\">/d ; s@<div class=\"texte_genre\"><span>@@ ; s@^>@@ ; s@</span></a></h3>@@ ; 
/<div class='/d ; /^<span/d ; /^\"display/d ; s@.*average\"@@ ; s@^>@@ ; s@</span> <span style=@@ ; s@<div class=\"texte_statut\"><span>@@ ; 
s@.*texte_der_chpt\">@@ ; s@</div>@--@" .mangas_scan-manga
sed -i "s@^ rel=\"[0-9]*\"@@ ; s@</a> le @\n@ ; /<div/d ; s@\">@@ ; s@^>@@ ; s@</span>--@@ ; /--/d" .mangas_scan-manga
#résolution accents
sed -i "s@&#224;@à@ ; s@&#226;@â@ ; s@&#233;@é@ ; s@&#234;@ê@ ; s@&#232;@è@ ; s@&#244;@ô@ ; s@&#235;@ë@ ; s@&#212;@Ô@ ; 
s@&#251;@û@ ; s@&#8217;@'@ ; s@&#239;@ï@ ; s@amp;@@ ; s@&#228;@ä@ ; s@&#201;@E@" .mangas_scan-manga
#màj
sed -i "s@<span class.*@@ ; s@</a> @\n@" .mangas_scan-manga
#correction temp
sed -i "s@Junketsu + Kareshi@Junketsu + Kareshi\n@ ; s@Watashi no + Okusuri@Watashi no + Okusuri\n@" .mangas_scan-manga
) | zenity --progress --pulsate --auto-close --no-cancel --title "boomeranga" --window-icon "/usr/share/pixmaps/boomeranga.svg" --text "Récupération des données"
fi
manga=$(zenity --list --multiple --title "boomeranga" --window-icon "/usr/share/pixmaps/boomeranga.svg" --text "Veuillez choisir une série" --width "1000" --height "400" --hide-column="1" --column="Référence" --column="Nom du manga" --column="Genre" --column="Note" --column="Statut" --column="Dernier chapitre" --column="Dernière màj" < $PWD/.mangas_scan-manga) || menu
dir=$(echo ${manga} | cut -d "/" -f5 | cut -d "." -f1)
telecharger_scan-manga
}
#################

### init ###
dep() {
cd $HOME/.boomeranga/
(for (( i=0 ; i < ${#paquet[*]} ; i++ ))
do
#recherche paquets non installés et les inscrit en supprimant le retour à la ligne
[[ $(aptitude show ${paquet[i]} | grep "État: non installé") ]] && echo "${paquet[i]} " | tr -d "\n" >> dépendances
done) | zenity --progress --pulsate --auto-close --no-cancel --title "boomeranga" --window-icon "/usr/share/pixmaps/boomeranga.svg" --text "Vérification des dépendances"
test -f $PWD/dépendances
if [ $? = 0 ]
then
	zenity --title "boomeranga" --window-icon "/usr/share/pixmaps/boomeranga.svg" --info --text "Les dépendances suivantes sont nécessaires pour le bon 
	fonctionnement de boomeranga! :

	<b>$(cat dépendances)</b>

	Il est conseillé de les installer avant de redémarrer le script."
	exit
else
	zenity --info --ok-label "Go!" --timeout "2" --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --text "Toutes les dépendances
sont satisfaites"
fi
}
function ch() {
ch=$(cat $HOME/.boomeranga/ch)
mkdir -p $ch/
cd $ch
}
#vérification présence fichiers 'séries' et création si besoin
function séries {
test -f $PWD/séries
if [ $? = 1 ]
then
	> séries
fi
test -f $PWD/séries.mfox
if [ $? = 1 ]
then
	> séries.mfox
fi
test -f $PWD/séries.scan-manga
if [ $? = 1 ]
then
	> séries.scan-manga
fi
}
liste_manga() {
#récupération liste manga lel.com pour 404 / _new pour conserver ancien tant que nouveau incomplet
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@Ch.*@@ ; /td class=/d ; /--/d ; /<td>/d ; /<tr onmouseover/d ; /<table class/d"
done > .404_new
mv .404_new .404
}
############

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

if [[ -z $pdf ]]
then pdf="n"
else pdf="o"
fi
}
simple_convert() {
zenity --info --title="Conversion .cbz vers .pdf" --text="1. Choisir fichier source
2. Choisir fichier cible"

fichier1=`zenity --file-selection --title="Sélectionnez un fichier"`
fichier2=`zenity --file-selection --save`

ebook-convert $fichier1 $fichier2 --right2left | zenity --progress --text "Conversion en cours" --auto-close --auto-kill

zenity --info --title="Info" --text="Conversion de <b>$fichier1</b> terminée"
}
#à vérif. pour activ.
échec() {
while [ ${?} -ne 0 ]
do
	zenity --title "boomeranga!" --info --text "Echec de l'opération - retour au menu"
	menu
done
}
#fonctions annuaire général permettant de voir quel site est le plus avancé pour une série
gb_lel() {
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" | grep -A 6 -i "manga/.*${manga}" | sed "s@<td class=\"td\"><a href=\"manga/@@ ; 
s@/\" class=\"infoImages\">@\n@ ; s@</a></td>@@ ; /<tr onmouseover/d ; /<td class/d ; s@.*Ch. @@ ; s@</a>.*@@ ; /<td>/d ; /--/d ; s@^[[:space:]]*@@ ; s@N/A.*@0@"
done > .mangas
#correction temp
sed -i "s@no Aneki@no Aneki\n@" .mangas
imax=$(($(wc -l .mangas | awk '{print$1}') * 2))
for (( i=3 ; i < $imax ; i=i+4 ))
do
sed -i "$i s@\$@\nLEL@" .mangas
done
}
gb_scm() {
wget -qO - http://www.scan-manga.com/scanlation/liste_des_mangas.html | grep -A 12 "\"><span class=\"hover_text_manga"  | grep -A 1 -i ">.*${manga}" > .mangas_scan-manga 
sed -i "/<div class=\"texte_lettre\">/d ; /<div class=\"texte_manga book_close\">/d ; s@<h3><a class=\"texte_manga\" href=\"@@ ; 
s@\"><span class=\"hover_text_manga\" rel=\"[0-9]*\">@\n@ ; s@</span></a></h3>@@ ; /<div class=\"texte_genre/d ; /<div class=\"texte_note/d ; 
/<div class='bl_vote/d ; /<div class='sub/d ; /.*\"display:none/d ; /<div class=\"texte_statut/d ; s@.*class=\"texte_der_chpt\">@@ ; s@</a>.*@@ ; 
/.*div.*/d ; /--/d" .mangas_scan-manga
#résolution accents
sed -i "s@&#224;@à@ ; s@&#226;@â@ ; s@&#233;@é@ ; s@&#234;@ê@ ; s@&#232;@è@ ; s@&#244;@ô@ ; s@&#235;@ë@ ; s@&#212;@Ô@ ; 
s@&#251;@û@ ; s@&#8217;@'@ ; s@&#239;@ï@ ; s@amp;@@ ; s@&#228;@ä@ ; s@&#201;@E@" .mangas_scan-manga
#màj
sed -i "s@<span class.*@@ ; s@</a> @\n@" .mangas_scan-manga
#correction temp
sed -i "s@Junketsu + Kareshi@Junketsu + Kareshi\n@ ; s@Watashi no + Okusuri@Watashi no + Okusuri\n@" .mangas_scan-manga
sed -i "s@Hô&#244; @@" .mangas_scan-manga
#suppression lignes
sed -i "1549d" .mangas_scan-manga
sed -i "3733d" .mangas_scan-manga
#formatage
sed -i "s@Vol [0-9]* @@" .mangas_scan-manga
sed -i "s@^Ch @@" .mangas_scan-manga
imax=$(($(wc -l .mangas_scan-manga | awk '{print$1}') * 2))
for (( i=3 ; i < $imax ; i=i+4 ))
do
sed -i "$i s@\$@\nSCM@" .mangas_scan-manga
done
}
gb_mfx() {
nb_page=300 #préciser nb pages par recherche sed
for i in $(seq ${nb_page})
do
wget -U=firefox -qO - "http://mangafox.me/directory/${i}.htm" | grep -A 4 "<div class=\"manga_text\">" | grep -A 2 -i "${manga}" | sed "s@^[[:space:]]*@@ ; /<div class=\"manga_text\">/d ; 
s@^<a class=\"title\" href=\"http://mangafox.me/manga/@@ ; s@/\" rel=\"[0-9]*\">@\n@ ; s@</a>@@ ; /.*class.*/d ; /--/d"
done > .mangas_mfox
#correction erreur sur 1 ligne
sed -i "s@ - &quot.*@@" .mangas_mfox
#ajouter nb chap.
imax=$(($(wc -l .mangas_mfox | awk '{print$1}') * 2))
for (( i=1 ; i < $imax ; i=i+3 ))
do
manga=$(head -n $i .mangas_mfox | tail -n 1)
chap_man=$(wget -U=firefox -qO - "http://mangafox.me/manga/${manga}/" | grep -A 1 "Chapters</h2><hr/>" | grep "Chapter " | sed "s@.*Chapter@@ ; s@.* - @@ ; s@</span></h3></div><ul class=\"chlist\" style=\"display:block\">@@")
((i++))
sed -i "$i s@\$@\n$chap_man@" .mangas_mfox
((i--))
done
#formatage
for (( i=3 ; i < $imax ; i=i+4 ))
do
sed -i "$i s@\$@\nMFX@" .mangas_mfox
done
sed -i "s@^[[:space:]]*@@" .mangas_mfox
}
gb() {
manga=`zenity --title "boomeranga" --window-icon "/usr/share/pixmaps/boomeranga.svg" --entry --cancel-label "Quitter" --text "Le titre du manga contient :"` || menu
(gb_lel
gb_scm
gb_mfx
cp .mangas .gb
cat .mangas_scan-manga >> .gb
cat .mangas_mfox >> .gb
) | zenity --progress --pulsate --auto-close --no-cancel --title "boomeranga" --window-icon "/usr/share/pixmaps/boomeranga.svg" --text "Recherche en cours"
choix=$(zenity --list --multiple --title "boomeranga" --window-icon "/usr/share/pixmaps/boomeranga.svg" --text "Double-clic sur une série" --width "600" --height "400" --hide-column="1" --print-column="1,4" --column="Référence" --column="Nom du manga" --column="Dernier paru" --column="Site" < $PWD/.gb)
manga=$(echo ${choix} | cut -d "|" -f 1)
site=$(echo ${choix} | cut -d "|" -f 2)
#nettoyage
nettoyage_annuaires
gb=1
if [[ ${site} = "LEL" ]]
then télécharger
elif [[ ${site} = "MFX" ]]
then télécharger_mangafox
elif [[ ${site} = "SCM" ]]
then 
	dir=$(echo ${manga} | cut -d "/" -f5 | cut -d "." -f1)
	telecharger_scan-manga
fi
}
###############

### stop ###
nettoyage_annuaires() {
[[ -f $PWD/.mangas ]] && mv -f $PWD/.mangas $HOME/.local/share/Trash/files
[[ -f $PWD/.mangas2 ]] && mv -f $PWD/.mangas2 $HOME/.local/share/Trash/files
[[ -f $PWD/.mangas_mfox ]] && mv -f $PWD/.mangas_mfox $HOME/.local/share/Trash/files
[[ -f $PWD/.mangas_scan-manga ]] && mv -f $PWD/.mangas_scan-manga $HOME/.local/share/Trash/files
}
bye() {
cd ${ch}
nettoyage_annuaires
mv $PWD/wget* $HOME/.local/share/Trash/files
exit
}
############

### menus ###
function menu {
option=$(zenity --list --window-icon "/usr/share/pixmaps/boomeranga.svg" --width "350" --height "450" --cancel-label "Quitter" --title "boomeranga!" --text "Menu principal" --column=option --column=description 0 "Rechercher un manga" 0 "Poursuivre toutes les séries" 1 "===== Menus dédiés =====" \
2 "lecture-en-ligne.com" 3 "mangafox.me" 4 "scan-manga.com" 5 "======= Options ========" 6 "Modifier le chemin de boomeranga!" 7 "Modifier préférences de conversion" 8 "======== Extra =========" 9 "Convertir .cbz en .pdf" 10 "Demander une fonctionnalité" 11 "Site du projet") || bye
case "${option}" in
0) gb
;;
0) poursuite_all
;;
1) echo "y'a rien ici :p" && menu
;;
2) menu_lecture-en-ligne.com
;;
3) menu_mangafox.me
;;
4) menu_scan-manga.com
;;
5) echo "y'a rien ici :p" && menu
;;
6) ch_maj && menu
;;
7) convert_pdf
;;
8) echo "y'a rien ici :p" && menu
;;
9) simple_convert && menu
;;
10) xdg-open 'http://forum.ubuntu-fr.org/viewtopic.php?id=1282211' & menu
;;
11) xdg-open 'http://blog.goupil.eu/?boomeranga' & menu
;;
esac
}
function menu_lecture-en-ligne.com() {
option=$(zenity --list --window-icon "/usr/share/pixmaps/boomeranga.svg" --width "350" --height "225" --cancel-label "Retour" --title "boomeranga!" --text "Menu lecture-en-ligne.com" --column=option --column=description 1 "Télécharger mangas" 2 "Voir/Modifier liste de suivi" \
3 "Annuaire mangas") || menu
case "${option}" in
1) télécharger
;;
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_lecture-en-ligne.com || menu
;;
3) annuaire
;;
esac
}
function menu_mangafox.me() {
option=$(zenity --list --window-icon "/usr/share/pixmaps/boomeranga.svg" --width "350" --height "225" --cancel-label "Retour" --title "boomeranga!" --text "Menu mangafox.me" --column=option --column=description 1 "Télécharger mangas" 2 "Voir/Modifier liste de suivi" \
3 "Annuaire mangas") || menu
case "${option}" in
1) télécharger_mangafox
;;
2) zenity --text-info --editable --cancel-label "Retour" --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_mangafox.me || menu_mangafox.me
;;
3) annuaire_mfox
;;
esac
}
function menu_scan-manga.com() {
option=$(zenity --list --window-icon "/usr/share/pixmaps/boomeranga.svg" --width "350" --height "200" --cancel-label "Retour" --title "boomeranga!" --text "Menu scan-manga.com" --column=option --column=description 1 "Annuaire mangas" \
2 "Voir/Modifier liste de suivi") || menu
case "${option}" in
1) annuaire_scan-manga
;;
2) zenity --text-info --width "500" --height "300" --editable --cancel-label "Retour" --filename "$ch/séries.scan-manga" > $ch/séries.scan-manga_maj &&
mv $PWD/séries.scan-manga $HOME/.local/share/Trash/files && mv $PWD/séries.scan-manga_maj $PWD/séries.scan-manga && menu_scan-manga.com || menu_scan-manga.com
;;
esac
}
#############

#### lancement boomeranga! ####

zenity --progress --pulsate --timeout "8" --no-cancel --auto-close --title "boomeranga" --window-icon "/usr/share/pixmaps/boomeranga.svg" --text "Chargement informations" &
nb=$(wget -qO - http://www.lecture-en-ligne.com/ | grep -A 1 "<td class=\"count1\">Mangas :</td>" | sed "/Mangas/d ; s@<td class=\"count3\">@@ ; s@</td>@@")
nb_mfox=$(wget -U=firefox -qO - "http://mangafox.me/manga/#idx_#" | grep "<li><a href=\"http://mangafox.me/manga/" | wc -l)
nb_scanman=$(wget -qO - http://www.scan-manga.com/ | grep "Nombre de mangas :" | sed "s@.* : @@ ; s@<br>@@")

#### intro ####
zenity --info --ok-label "Go!" --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 : <b>${nb} titres</b>
   * mangafox.me : 					        <b>${nb_mfox} titres</b>
   * scan-manga.com :                                                      <b>${nb_scanman} titres</b>

Bonne lecture!"

#vérif au premier lancement : création chemin boomeranga + dépendances
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
	dep
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"

#
ch
liste_manga &
séries
menu

Dernière modification par WeetabiX (Le 23/06/2013, à 15:59)

Hors ligne

#2 Le 19/05/2013, à 12:21

hishaime

Re : boomeranga! pour les amateurs de mangas

C'est juste excellent pour les amateurs de manga. Merci beaucoup !
Je vais essayer de suivre la manip tout a l'heure et je te ferais un retour wink

Hors ligne

#3 Le 21/05/2013, à 21:01

hishaime

Re : boomeranga! pour les amateurs de mangas

je viens de tester, c'est juste excellent !

Pour l'améliorer, on pourrait pas prévoir un système où a chaque fois qu'on lance le script (ou avec un autre script), on puisse être averti d'un nouvelle épisode.
Je ne sais pas si c'est possible en bash, mais si c'est le cas, cela devrait pouvoir se faire ainsi (je pense) :
1) récupération du nom du dossier du manga
2) récupération du numero le plus élévé  des chapitres .cbz présents dans le dossier
3) prendre ce numéro +1
4) faire un ping avec manga/chapitres.html => si oui ça télécharge le volume, sinon message d'erreur.

Par contre, je voudrais te faire un petit retour :
-Pour télécharger le dernier épisode du manga que l'on suit vient de sortir, on est obligé de mettre le numéro du chapitre +1.
EX: le dernier épisode qui est sorti est le 100. Dans la 1ere fenetre on doit mettre le 100 et terminer le DL au 101.
-on est obliger de connaitre le numero du dernier épisode

voilà voilà smile

Hors ligne

#4 Le 22/05/2013, à 08:17

WeetabiX

Re : boomeranga! pour les amateurs de mangas

Ok, je note tes commentaires pour l'améliorer wink

Voilà une nouvelle version qui règle le problème des chapites > 100 pages pour commencer !

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

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

#ne fonctionne que pour http://www.lecture-en-ligne.com pour le moment - à étendre si besoin


manga=`zenity --title "boomeranga!" --entry --text "Nom du manga ?"` 

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

mkdir -p $HOME/téléchargements/boomeranga/
cd $HOME/téléchargements/boomeranga/

mkdir $manga
cd $PWD/$manga/

chap=`zenity --title "boomeranga!" --entry --text "Commencer à quel chapitre ?"`

im=01

chapmax=`zenity --title "boomeranga!" --entry --text "Stopper à quel chapitre ? (dernier non inclus)"` #chap +1 pour le moment
pdf=`zenity --title "boomeranga!" --entry --text "Convertir également en .pdf (pour liseuse par ex.) (o/n)"` 

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"
rm $PWD/info & rm $PWD/info2 & 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
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

zenity --info --title "boomeranga!" --text "Vous trouverez les chapitres téléchargés dans le dossier <b>$HOME/téléchargements/boomeranga/</b> Bonne lecture! "

Hors ligne

#5 Le 22/05/2013, à 14:08

WeetabiX

Re : boomeranga! pour les amateurs de mangas

Voilà la version 0.8 !

Elle corrige les chapitres de fin (à +1), renseigne sur le nombre de chapitres sortis pour une série en cours et permet de poursuivre ses téléchargements sans préciser tomes de début et de fin lors des nouvelles sorties.

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

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

#ne fonctionne que pour http://www.lecture-en-ligne.com pour le moment - à étendre si besoin


manga=`zenity --title "boomeranga!" --entry --text "Nom du manga ?"` 

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

mkdir -p $HOME/téléchargements/boomeranga/
cd $HOME/téléchargements/boomeranga/

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
	`zenity --title "boomeranga!" --info --timeout "1" --text "Poursuite de la série déjà commencée"`
	chap=`cat $PWD/chaplast`
else
	chap=`zenity --title "boomeranga!" --entry --text "Commencer à quel chapitre ?"`
fi

im=01

`zenity --title "boomeranga!" --question --text "Télécharger tous les chapitres disponibles ?   ($chap_man)"`

#si sélection perso
if [ $? = 0 ]
then
	chapmax=$chap_man
	let chapmax=chapmax+1
else
	chapmax=`zenity --title "boomeranga!" --entry --text "Stopper à quel chapitre ?"`
	let chapmax=chapmax+1
fi

pdf=`zenity --title "boomeranga!" --entry --text "Convertir également en .pdf (pour liseuse par ex.) (o/n)"` 

while [ $chap != $chapmax ]
do

#insérer test si chapitre présent chap+1 dans boucle while?

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"
rm $PWD/info & rm $PWD/info2 & rm $PWD/info3 & 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

zenity --info --title "boomeranga!" --text "Vous trouverez les chapitres téléchargés dans le dossier <b>$HOME/téléchargements/boomeranga/</b> Bonne lecture! "

Le .deb est disponible ici : deb http://www.goupil.eu/repo stable main

Dernière modification par WeetabiX (Le 22/05/2013, à 14:09)

Hors ligne

#6 Le 22/05/2013, à 22:56

hishaime

Re : boomeranga! pour les amateurs de mangas

C'est juste une grosse tuerie ton script !
Réelement ! Moi qui avais la flemme de lire sur le site (le serveur est parfois long à envoyer les images, trop de pub etc..) là c'est un réel plaisir.

Je te refais un feedback :

ça serait peut-être mieux de modifier le message suivant(voir ci-dessous), pour que le lecteur puisse savoir combien il y a de chapitres de disponible, c'est utile pour ceux qui aiment lire 4 ou 5 chapitres pour savoir si ça vaut le coup de ce lancer dans le téléchargement intégral d'un manga:
  "Commencer à quel chapitre ?" ===> en ===> "Commencer à quel chapitre ? Sachez qu'il  y en a ($chap_man) de disponible "

Petite question, comment ça se passe pour la suivie d'un manga, le script télécharge la suite automatiquement (si y'en a une de dispo) ou il faut remettre le nom du manga? dans la première fenêtre?

Hors ligne

#7 Le 23/05/2013, à 07:40

WeetabiX

Re : boomeranga! pour les amateurs de mangas

Pour les màj, il faut - pour le moment - entrer de nouveau le nom du manga et le script te proposera automatiquement de reprendre le téléchargement de la série (grâce aux fichiers infochap2 et chaplast présents dans le dossier du manga).

Je vais voir pour que le téléchargement soit automatique et silencieux wink

Hors ligne

#8 Le 23/05/2013, à 09:25

hishaime

Re : boomeranga! pour les amateurs de mangas

ok effectivement je viens de voir ces 2 fichiers, je comprends smile
Si jamais tu peux faire le téléchargement automatique c'est top, par contre, je pense que ça serait plus intéressant qu'il ne soit pas totalement silencieux mais qu'au contraire l'utilisateur soit averti soit que le nouveau chapitre de sa série a été téléchargé automatiquement, soit en l'avertissant qu'un nouveau chapitre est téléchargeable ...

En tout cas tu fais un excellent travail, je ne savais pas que le bash permettait ce genre de chose (je suis encore tout nouveau sur linux). Tu devrais faire un lien de ton script dans les commentaires de Comix (tout ceux qui l'utilisent DL des mangas) wink

Hors ligne

#9 Le 23/05/2013, à 14:04

WeetabiX

Re : boomeranga! pour les amateurs de mangas

Merci pour tes encouragements smile

Voilà donc la dernière version, plus propre qui :
* établit une liste de suivis des séries (la suppression est manuelle pour l'instant)
* permet le téléchargement des derniers tomes suivis sans renseigner de nouveau le titre.

Les fichiers de conf sont toujours visibles dans les dossiers.

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

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

#ne fonctionne que pour http://www.lecture-en-ligne.com pour le moment - à étendre si besoin
#ajouter suppression série

ch=$HOME/téléchargements/boomeranga/

mkdir -p $ch/ #option choix répertoire ?
cd $ch
test -f $PWD/séries
if [ $? = 1 ]
then
> séries
fi

#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!" --entry --text "Commencer à quel chapitre ?"`
fi

im=01

`zenity --title "boomeranga!" --question --text "$manga - Télécharger tous les chapitres disponibles ?   ($chap_man)"`

#si sélection perso
if [ $? = 0 ]
then
	chapmax=$chap_man
	let chapmax=chapmax+1
else
	chapmax=`zenity --title "boomeranga!" --entry --text "Stopper à quel chapitre ?"`
	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
}

#intro
zenity --info --timeout "5" --title "boomeranga!" --text "<b>boomeranga!</b> vous permet de télécharger des planches de manga
depuis le site lecture-en-ligne.com

Fonctions actuelles :
* récupération de chapitres/mangas
* liste de suivi automatique (suppression manuelle depuis fichier 'séries')
* réalisation du .cbz pour lecture sous <i>comix</i>
* possibilité de conversion en .pdf grace à <i>calibre</i>

Bonne lecture"

#pdf ?
pdf=`zenity --title "boomeranga!" --entry --text "Convertir les chapitres téléchargés en .pdf (pour liseuse par ex.) (o/n)"`

#menu1 - poursuivre séries en cours ? ajouter option pas de série en cours
`zenity --title "boomeranga!" --question --text "Poursuivre les séries en cours ?"`
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!" --entry --text "Nouveau manga - nom du manga ?"`

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

télécharger
fi

zenity --info --title "boomeranga!" --text "Vous trouverez les chapitres téléchargés dans le dossier <b>$ch</b> Bonne lecture! "

Pour la pub auprès de la communauté comix, je compte sur toi big_smile

Hors ligne

#10 Le 23/05/2013, à 20:46

hishaime

Re : boomeranga! pour les amateurs de mangas

Merci je vais tester ça et je te ferais un retour en début de semaine prochaine wink
Compte sur moi pour la pub, ton script le mérite vraiment !

Hors ligne

#11 Le 23/05/2013, à 22:29

hishaime

Re : boomeranga! pour les amateurs de mangas

au faite petit détail, ce n'est pas gênant dans ton script si le T de Téléchargement soit en minuscule?

ch=$HOME/téléchargements/boomeranga/

Je demande ça au cas où, je ne connais pas l'effet vu que j'ai modifier le chemin du dossier, mais si je me trompe pas dans la console la différence entre la majuscule et la minuscule est important, donc je me disais que c'était peut-être aussi le cas pour le bash... smile

ps: la pub sur comix c'est fait, j'espère que ça t'apportera du monde smile

Hors ligne

#12 Le 24/05/2013, à 08:45

WeetabiX

Re : boomeranga! pour les amateurs de mangas

Sympa pour la pub wink

Pour le chemin, ça a son importance mais je n'utilise pas les dossiers gnome par défaut donc hmm
Sinon, voilà la dernière *micro*version (pas de modif des fonctions, uniquement la page de lancement qui indique un lien vers une peite aide en ligne) :

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

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

#ne fonctionne que pour http://www.lecture-en-ligne.com pour le moment - à étendre si besoin

ch=$HOME/téléchargements/boomeranga/

mkdir -p $ch/ #option choix répertoire ?
cd $ch
test -f $PWD/séries
if [ $? = 1 ]
then
> séries
fi

#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!" --entry --text "Commencer à quel chapitre ?"`
fi

im=01

`zenity --title "boomeranga!" --question --text "$manga - Télécharger tous les chapitres disponibles ?   ($chap_man)"`

#si sélection perso
if [ $? = 0 ]
then
	chapmax=$chap_man
	let chapmax=chapmax+1
else
	chapmax=`zenity --title "boomeranga!" --entry --text "Stopper à quel chapitre ?"`
	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
}

#intro
zenity --info --ok-label "Go!" --timeout "10" --title "boomeranga!" --text "<b>boomeranga!</b> vous permet de télécharger 
des planches de manga depuis lecture-en-ligne.com


Bonne lecture

Manuel disponible à l'adresse :
<b>blog.goupil.eu/?boomeranga</b>"

#pdf ?
pdf=`zenity --title "boomeranga!" --entry --text "Convertir les chapitres téléchargés en .pdf (pour liseuse par ex.) (o/n)"`

#menu1 - poursuivre séries en cours ? ajouter option pas de série en cours
`zenity --title "boomeranga!" --question --text "Poursuivre les séries en cours ?"`
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!" --entry --text "Nouveau manga - nom du manga ?"`

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

télécharger
fi

zenity --info --title "boomeranga!" --text "Vous trouverez les chapitres téléchargés dans le dossier <b>$ch</b> Bonne lecture! "

Si tu as d'autres idées d'améliorations, n'hésite pas !

Hors ligne

#13 Le 24/05/2013, à 10:25

hishaime

Re : boomeranga! pour les amateurs de mangas

Ok c'est noté smile

Par contre, pense a modifier la ligne 10, en remplaçant :

ch=$HOME/téléchargements/boomeranga/

par

ch=$HOME/Téléchargements/boomeranga/

Sinon ça crée un second dossier téléchargement dans le home (en plus de celui utilisé par défaut sur Ubuntu, qui s'écrit lui avec un T majuscule).

Hors ligne

#14 Le 24/05/2013, à 19:48

WeetabiX

Re : boomeranga! pour les amateurs de mangas

La version 0.8.2 règle ce détail en permettant à chacun de choisir son répertoire boomeranga! au premier lancement wink

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

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

#ne fonctionne que pour http://www.lecture-en-ligne.com pour le moment - à étendre si besoin

#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!" --entry --text "Commencer à quel chapitre ?"`
fi

im=01

`zenity --title "boomeranga!" --question --text "$manga - Télécharger tous les chapitres disponibles ?   ($chap_man)"`

#si sélection perso
if [ $? = 0 ]
then
	chapmax=$chap_man
	let chapmax=chapmax+1
else
	chapmax=`zenity --title "boomeranga!" --entry --text "Stopper à quel chapitre ?"`
	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
}

#intro
zenity --info --ok-label "Go!" --timeout "10" --title "boomeranga!" --text "<b>boomeranga!</b> vous permet de télécharger 
des planches de manga depuis lecture-en-ligne.com


Bonne lecture

Manuel disponible à l'adresse :
<b>blog.goupil.eu/?boomeranga</b>"

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

ch=`cat $HOME/.boomeranga/ch`
mkdir -p $ch/
cd $ch
test -f $PWD/séries
if [ $? = 1 ]
then
	> séries
fi

#pdf ?
pdf=`zenity --title "boomeranga!" --entry --text "Convertir les chapitres téléchargés en .pdf (pour liseuse par ex.) (o/n)"`

#menu1 - poursuivre séries en cours ? ajouter option pas de série en cours
`zenity --title "boomeranga!" --question --text "Poursuivre les séries en cours ?"`
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!" --entry --text "Nouveau manga - nom du manga ?"`

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

	télécharger
fi

zenity --info --title "boomeranga!" --text "Vous trouverez les chapitres téléchargés dans le dossier <b>$ch</b> Bonne lecture! "

Les .deb tout chauds sont dispos tongue

Hors ligne

#15 Le 24/05/2013, à 19:56

ljere

Re : boomeranga! pour les amateurs de mangas

je vais tester ce petit bijou


ancien PC Toshiba satellite_c670d-11 / Linux Mint 21 Vanessa
Nouveau PC ASUS TUF GAMING A17 GPU RTX 4070 CPU AMD Ryzen 9 7940HS w/ Radeon 780M Graphics / Linux Mint 21.2 Victoria / Kernel: 6.4.8-1-liquorix / Desktop: Cinnamon

Hors ligne

#16 Le 24/05/2013, à 20:05

ljere

Re : boomeranga! pour les amateurs de mangas

premier souci les espaces ne sont pas pris en compte j'ai choisi mon dossier à ranger
résultat il a créé un dossie à


ancien PC Toshiba satellite_c670d-11 / Linux Mint 21 Vanessa
Nouveau PC ASUS TUF GAMING A17 GPU RTX 4070 CPU AMD Ryzen 9 7940HS w/ Radeon 780M Graphics / Linux Mint 21.2 Victoria / Kernel: 6.4.8-1-liquorix / Desktop: Cinnamon

Hors ligne

#17 Le 24/05/2013, à 22:16

WeetabiX

Re : boomeranga! pour les amateurs de mangas

Argh yikes

Effectivement, il y a un souci avec les espaces, je vais regarder.

[edit] Si on pointe vers un dossier 1 2, il crée trois dossiers : 1, 2, et 1 2. Je conseille d'éviter cette configuration pour l'instant : supprime le dossier $home/.boomeranga et relance le script pour réinitialiser sa conf.

Dernière modification par WeetabiX (Le 24/05/2013, à 22:30)

Hors ligne

#18 Le 25/05/2013, à 12:31

WeetabiX

Re : boomeranga! pour les amateurs de mangas

La version 0.8.3 apporte une petite amélioration : affichage du nombre de nouveaux chapitres pour les séries suivies.

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

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

#ne fonctionne que pour http://www.lecture-en-ligne.com pour le moment - à étendre si besoin

#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!" --entry --text "Commencer à quel chapitre ?"`
fi

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

`zenity --title "boomeranga!" --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!" --entry --text "Stopper à quel chapitre ?"`
	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
}

#intro
zenity --info --ok-label "Go!" --timeout "10" --title "boomeranga!" --text "<b>boomeranga!</b> vous permet de télécharger 
des planches de manga depuis lecture-en-ligne.com


Bonne lecture

Manuel disponible à l'adresse :
<b>blog.goupil.eu/?boomeranga</b>"

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

ch=`cat $HOME/.boomeranga/ch`
mkdir -p $ch/
cd $ch
test -f $PWD/séries
if [ $? = 1 ]
then
	> séries
fi

#pdf ?
pdf=`zenity --title "boomeranga!" --entry --text "Convertir les chapitres téléchargés en .pdf (pour liseuse par ex.) (o/n)"`

#menu1 - poursuivre séries en cours ? ajouter option pas de série en cours
`zenity --title "boomeranga!" --question --text "Poursuivre les séries en cours ?"`
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!" --entry --text "Nouveau manga - nom du manga ?"`

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

	télécharger
fi

zenity --info --title "boomeranga!" --text "Vous trouverez les chapitres téléchargés dans le dossier <b>$ch</b> Bonne lecture! "

Hors ligne

#19 Le 26/05/2013, à 23:19

hishaime

Re : boomeranga! pour les amateurs de mangas

Merci je vais la tester wink

Hors ligne

#20 Le 27/05/2013, à 08:16

WeetabiX

Re : boomeranga! pour les amateurs de mangas

Passe directement à la version 0.9, cela reste une version mineure mais cela prend forme (merci bash lol) :
* ajout d'un menu
* modification de la liste de suivi depuis boomeranga!
* petites améliorations du code (interruptions du programme, ...)

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

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

#ne fonctionne que pour http://www.lecture-en-ligne.com pour le moment - à étendre si besoin

#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
}

#### intro ####
zenity --info --ok-label "Go!" --timeout "2" --title "boomeranga!" --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


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

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

#option pdf
function convert_pdf {
pdf=`zenity --list --radiolist --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
}

#menu général avec `case`
function menu {
option=`zenity --list --window-icon "/usr/share/pixmaps/boomeranga.svg" --width "300" --height "250" --cancel-label "Quitter" --title "boomeranga!" --text "Menu principal" --column=option --column=description 1 "Télécharger mangas" 2 "Voir/Modifier liste de suivi" \
3 "================" 4 "Consulter l'aide en ligne" 5 "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) echo "y'a rien ici :p" && menu
;;
4) xdg-open 'http://blog.goupil.eu/?boomeranga' & menu
;;
5) xdg-open 'http://forum.ubuntu-fr.org/viewtopic.php?id=1282211' & menu
;;
esac
}

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

Pour bénéficier de l'icône, il faut installer le .deb ou copier/coller l'image depuis le .deb vers /usr/share/pixmaps/

Hors ligne

#21 Le 27/05/2013, à 10:44

hishaime

Re : boomeranga! pour les amateurs de mangas

Excellent ! smile J'aime beaucoup la MàJ !
Merci

Hors ligne

#22 Le 29/05/2013, à 16:29

WeetabiX

Re : boomeranga! pour les amateurs de mangas

Nouvelle version (0.9.2) qui pose les bases des évolutions futures :
* indicateur de version : le script cherche si une version plus récente est publiée sur le dépôt et en informe l'utilisateur,
* support partiel de mangafox.me ! (pas encore de liste de suivi)

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

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

v=0.9.2

#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
}

#fonction télécharger_mangafox()
function télécharger_mangafox {
manga=`zenity --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --entry --cancel-label "Quitter" --text "Nouveau manga - nom du manga ?"` || exit
vol=`zenity --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --entry --cancel-label "Quitter" --text "Commencer à quel volume (forme v01) ?"` || exit
chap=`zenity --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --entry --cancel-label "Quitter" --text "Commencer à quel chapitre (forme c001)?"` || exit

chapmax=`zenity --title "boomeranga!" --window-icon "/usr/share/pixmaps/boomeranga.svg" --entry --cancel-label "Quitter" --text "Stopper à quel chapitre (forme c001+1)?"` || exit

im=1

#`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)]"`
###sélection perso
mkdir $manga
cd $PWD/$manga/

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`
#if [[ $erreur ]]
#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

#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
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
}

#### intro ####
zenity --info --ok-label "Go!" --timeout "2" --title "boomeranga!" --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


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 fichier 'séries' et création si besoin
ch=`cat $HOME/.boomeranga/ch`
mkdir -p $ch/
cd $ch
test -f $PWD/séries
if [ $? = 1 ]
then
	> séries
fi

#option pdf
function convert_pdf {
pdf=`zenity --list --radiolist --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
}

#menu général avec `case`
function menu {
option=`zenity --list --window-icon "/usr/share/pixmaps/boomeranga.svg" --width "300" --height "275" --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 "================" 5 "Consulter l'aide en ligne" 6 "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) télécharger_mangafox
;;
4) echo "y'a rien ici :p" && menu
;;
5) xdg-open 'http://blog.goupil.eu/?boomeranga' & menu
;;
6) xdg-open 'http://forum.ubuntu-fr.org/viewtopic.php?id=1282211' & menu
;;
esac
}

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

Hors ligne

#23 Le 30/05/2013, à 07:56

ljere

Re : boomeranga! pour les amateurs de mangas

bonjour,
j'ai une erreur

~/script en cours/boomeranga.sh: ligne 265 : [: trop d'arguments

la ligne en question est

if [ -z $pdf ]

je me demande si il ne faut pas changer en

if [ -z pdf ]

ancien PC Toshiba satellite_c670d-11 / Linux Mint 21 Vanessa
Nouveau PC ASUS TUF GAMING A17 GPU RTX 4070 CPU AMD Ryzen 9 7940HS w/ Radeon 780M Graphics / Linux Mint 21.2 Victoria / Kernel: 6.4.8-1-liquorix / Desktop: Cinnamon

Hors ligne

#24 Le 30/05/2013, à 08:28

WeetabiX

Re : boomeranga! pour les amateurs de mangas

bash me renvoie également cette erreur mais ne bronche pas plus que ça, il prend bien en compte la réponse de l'utilisateur.
Est-ce le cas chez toi ?

Hors ligne

#25 Le 30/05/2013, à 12:50

ljere

Re : boomeranga! pour les amateurs de mangas

oui , j'ai testé avec la modif ça marche aussi et plus d'erreur d'affiché


ancien PC Toshiba satellite_c670d-11 / Linux Mint 21 Vanessa
Nouveau PC ASUS TUF GAMING A17 GPU RTX 4070 CPU AMD Ryzen 9 7940HS w/ Radeon 780M Graphics / Linux Mint 21.2 Victoria / Kernel: 6.4.8-1-liquorix / Desktop: Cinnamon

Hors ligne