1
0
Fork 0

Patch bug gros nombre de pages

This commit is contained in:
Rick 2020-11-02 16:24:44 +01:00
parent 6ddfd04fe2
commit a0728e3549
Signed by: Rick
GPG Key ID: 9570A7DB7CB2F436
2 changed files with 23 additions and 14 deletions

View File

@ -8,25 +8,33 @@
# #
#***************************#
fichierExtract="/tmp/file-tmp"
fichierB="$fichierExtract.b"
################################################################################
# Télécharge le fichier .b se trouvant à lurl en paramètre et le dézip dans
# /tmp/file-tmp.
# Globals:
# [TODO:var-name]
# $fichierB: le chemin vers le fichier compressé .b
# $fichierExtract: le chemin vers le fichier décompressé
# Arguments:
# $1: le curl (sans de --output) à faire pour récupérer le fichier
################################################################################
function recupDezip {
command="$@ --output /tmp/file-tmp.b"
eval $command
command="$@ --output $fichierB"
eval $command 2> /dev/null
if [ -f "/tmp/file-tmp" ]
if [ -f $fichierExtract ]
then
rm /tmp/file-tmp
rm $fichierExtract
fi
brotli -d -S .b /tmp/file-tmp.b
brotli -d -S .b $fichierB
if [ $? -eq 1 ]
then
sleep 3s
recupDezip $@
fi
}
read -p "Entrez commande curl sans --compressed : " commandCurl
@ -45,13 +53,14 @@ then
nbPage=$((nbPage + 1))
fi
echo
read -p "Attention ! $nbPage pages seront traités !"
if [ -f result.json ]
then
rm result.json
fi
cp /tmp/file-tmp result.json
cp $fichierExtract result.json
j=25
for i in $(seq 1 $nbPage)
@ -61,6 +70,5 @@ do
recupDezip $newCommand
python3 help.py -u
j=$((j + 25))
echo -e "\r$i/$nbPage pages\c"
done
echo $nbPage

View File

@ -9,17 +9,18 @@ __author__ = "rick@gnous.eu"
__licence__ = "GLP3 or later"
parser = argparse.ArgumentParser(
description="Permet dentrer des phrases ou des mots qui seront traduient en morse grace à la classe traducteurMorse. Cette traduction sera ensuite convertie en flash lumineux."
description="Outil pour manipuler le fichier JSON des recherches discord"
)
parser.add_argument('-g', '--getelem', action="store_true", help="Retourne le nombre déléments du fichier json")
parser.add_argument('-u', '--updatejson', action="store_true", help="Met à jour le fichier json avec les nouvelles infos")
parser.add_argument('-g', '--getelem', action="store_true",
help="Retourne le nombre déléments du fichier json")
parser.add_argument('-u', '--updatejson', action="store_true",
help="Met à jour le fichier json avec les nouvelles infos")
args = parser.parse_args()
if args.getelem:
with open("/tmp/file-tmp", 'r') as file:
data = json.load(file)
print(data["total_results"])
exit(0)
elif args.updatejson:
with open("/tmp/file-tmp", 'r') as file:
data = json.load(file)