« Utilisateur:Crochet.david.bot/Scripts » : différence entre les versions

Contenu supprimé Contenu ajouté
m Robot : Remplacement de texte automatisé (-numero +numéro)
→‎Script : scripts en cours
Ligne 4 :
<source lang="bash">
#!/bin/bash
python interwiki.py -lang:"ar" -recentchanges -async -cleanup
VERT="\\033[1;32m"
python interwiki.py -lang:"cs" -recentchanges -async -cleanup
NORMAL="\\033[0;39m"
python interwiki.py -lang:"de" -recentchanges -async -cleanup
ROUGE="\\033[1;31m"
python interwiki.py -lang:"el" -recentchanges -async -cleanup
ROSE="\\033[1;35m"
python interwiki.py -lang:"en" -recentchanges -async -cleanup
BLEU="\\033[1;34m"
python interwiki.py -lang:"es" -recentchanges -async -cleanup
BLANC="\\033[0;02m"
python interwiki.py -lang:"fi" -recentchanges -async -cleanup
BLANCLAIR="\\033[1;08m"
python interwiki.py -lang:"fr" -recentchanges -async -cleanup
JAUNE="\\033[1;33m"
python interwiki.py -lang:"it" -recentchanges -async -cleanup
CYAN="\\033[1;36m"
python interwiki.py -lang:"ja" -recentchanges -async -cleanup
 
python interwiki.py -lang:"pt" -recentchanges -async -cleanup
function charge_et_decompresse {
python interwiki.py -lang:"ru" -recentchanges -async -cleanup
wget --progress=dot:binary http://download.wikimedia.org/${1}wikiversity/latest/${1}wikiversity-latest-pages-articles.xml.bz2
python interwiki.py -lang:"sv" -recentchanges -async -cleanup
mv -v ${1}wikiversity-latest-pages-articles.xml.bz2 ${1}-wikiversity-latest-pages-articles.xml.bz2
python interwiki.py -lang:"beta" -localonly -recentchanges -async -cleanup
echo -e $JAUNE "Mise à jour de la langue $1" $NORAML
python cosmetic_changes.py -lang:"beta" -recentchanges
echo -e $JAUNE "décompression de l'archive de la langue $1" $NORMAL
python cosmetic_changes.py -lang:"fr" -recentchanges
bunzip2 -v $1-wikiversity-latest-pages-articles.xml.bz2
python replace.py -lang:"fr" -recentchanges -fix:"encodage"
}
python replace.py -lang:"beta" -recentchanges -fix:"encodage"
 
python replace.py -lang:"fr" -recentchanges -fix:"wikilien"
function decharge {
echo -e $VERT "suppression de l'xml de la langue $1" $NORMAL
rm -v $1-wikiversity-latest-pages-articles.xml
}
 
function automatique {
fairelangue
for isolang in $existlang ; do
for namespace in user category template help wikiversity ; do
python interwiki.py -start:"${namespace}:" -lang:$isolang -skipfile:"file.skip"
done
done
}
 
function chapitre {
isolang='fr'
charge_et_decompresse $isolang
echo -e $ROUGE "execution de remplace.py pour la langue $isolang" $NORMAL
python replace.py -fix:syntaxechapitre -lang:$isolang -xml:$isolang-wikiversity-latest-pages-articles.xml
decharge $isolang
}
 
function lecon {
isolang='fr'
charge_et_decompresse $isolang
echo -e $ROUGE "execution de remplace.py pour la langue $isolang" $NORMAL
python replace.py -fix:syntaxelecon -lang:$isolang -xml:$isolang-wikiversity-latest-pages-articles.xml
decharge $isolang
}
 
function cosmetic {
fairelangue
for isolang in $existlang ; do
echo "execution de cosmetic_change.py pour la langue $isolang"
python cosmetic_changes.py -lang:$isolang -start:!
done
}
 
function encodage {
fairelangue
for isolang in $existlang ; do
charge_et_decompresse $isolang
echo -e $ROUGE "execution de remplace.py pour la langue $isolang" $NORMAL
python replace.py -fix:encodage -lang:$isolang -xml:$isolang-wikiversity-latest-pages-articles.xml
decharge $isolang
done
}
 
function encodagemanu {
echo -e $ROSE "nom de la page AVEC son lien langue ?" $NORMAL
read page
python replace.py -fix:encodage -page:"$page"
}
 
function wikilien {
fairelangue
for isolang in $existlang ; do
charge_et_decompresse $isolang
echo -e $ROUGE "execution de remplace.py pour la langue $isolang" $NORMAL
python replace.py -fix:wikilien -lang:$isolang -xml:$isolang-wikiversity-latest-pages-articles.xml
python replace.py -lang:$isolang -xml:$isolang-wikiversity-latest-pages-articles.xml "[[:$isolang:" "[["
python replace.py -lang:$isolang -xml:$isolang-wikiversity-latest-pages-articles.xml -regex "\[\[(n|q|wikt|w|s|b):$isolang:" "[[\1:"
python replace.py -lang:$isolang -xml:$isolang-wikiversity-latest-pages-articles.xml -regex ":..:$isolang:" ":"
python replace.py -lang:$isolang -xml:$isolang-wikiversity-latest-pages-articles.xml ":$isolang:" ":"
python replace.py -lang:$isolang -xml:$isolang-wikiversity-latest-pages-articles.xml -regex "\[\[:(n|q|wikt|w|s|b):" "[[\1:"
decharge $isolang
done
}
 
function wikilienmanu {
echo -e $ROSE "nom de la page SANS son lien langue ?" $NORMAL
read page
echo -e $ROSE "code langue ?" $NORMAL
read isolang
python replace.py -fix:wikilien -page:"$page" -lang:"$isolang"
python replace.py -page:"$page" -lang:"$isolang" "[[:$isolang:" "[["
python replace.py -page:"$page" -lang:"$isolang" -regex "\[\[(n|q|wikt|w|s|b):$isolang:" "[[\1:"
python replace.py -page:"$page" -lang:"$isolang" -regex ":..:$isolang:" ":"
python replace.py -page:"$page" -lang:"$isolang" ":$isolang:" ":"
python replace.py -page:"$page" -lang:"$isolang" -regex "\[\[:(n|q|wikt|w|s|b):" "[[\1:"
}
 
 
function fairelangue {
echo -e $ROSE "Sur quel langue exécuter le programme parmi ?" $NORMAL
echo -e $BLEU "cs de el en es fi fr it ja pt ru" $NORMAL
echo -e $CYAN "all pour toutes" $NORMAL
read langue
if [ $langue = 'all' ] ;
then
existlang="cs de el en es fi fr it ja pt ru"
else
existlang=$langue
fi
}
 
function typoauto {
isolang="fr"
charge_et_decompresse $isolang
echo -e $ROUGE "execution de remplace.py pour la langue $isolang" $NORMAL
bash typo-fr.sh
decharge $isolang
}
 
function interwikimanu {
python interwiki.py
}
 
function tabletowiki {
echo -e $ROSE "nom de la page avec son lien langue ?" $NORMAL
read page
python table2wiki.py $page
}
 
function typomanu {
fairelangue
for isolang in $existlang ; do
charge_et_decompresse $isolang
echo -e $ROUGE "execution de remplace.py pour la langue $isolang" $NORMAL
echo "Utilisation du regex [N] [y] ?"
read useregex
while true
do
echo "regex du texte avant. Taper 'FiN' pour arrêter ce sous programme"
read avant
if [ $avant = 'FiN' ] ;
then break
else
echo "regex du texte après"
read apres
if [ $useregex = 'y' ] ;
then
python replace.py -lang:$isolang -xml:$isolang-wikiversity-latest-pages-articles.xml -regex "$avant" "$apres"
else
python replace.py -lang:$isolang -xml:$isolang-wikiversity-latest-pages-articles.xml "$avant" "$apres"
fi
fi
done
decharge $isolang
done
}
 
 
while true
do
clear
echo "Éxecute un robot en utilisant certain script"
echo
echo "Les arguments possibles sont :"
echo " 1 : syntaxechapitre "
echo " 2 : syntaxelecon "
echo " 3 : wikilien : Transforme les wikiliens ou lien internet de façon correct"
echo " 4 : automatique : Effectue une vérification des liens interwiki"
echo " 5 : encodage : Transforme les code étendu en code UTF-8"
echo " 6 : cosmetic "
echo " 7 : mise à jour de pywikipediabot "
echo " 8 : correction suivant règle de typographie manuel"
echo " 9 : correction suivant règle de typographie automatique avec le fichier typo-fr.sh"
echo " 10 : interwiki manuel "
echo " 11 : encodage manuel "
echo " 12 : table -> wiki"
echo " 13 : correction des wikilien en manuel"
echo " 0 : fin"
read clavier
case $clavier in
1) chapitre ;;
2) lecon ;;
3) wikilien ;;
4) automatique ;;
5) encodage ;;
6) cosmetic ;;
7) svn up ;;
8) typomanu ;;
9) typoauto ;;
10) interwikimanu ;;
11) encodagemanu ;;
12) tabletowiki ;;
13) wikilienmanu ;;
0) exit 0 ;;
esac
sleep 1
done
</source>