Compare commits
2 Commits
c6c85f4737
...
f457a9fec8
Author | SHA1 | Date | |
---|---|---|---|
f457a9fec8 | |||
8a4b91e935 |
@ -49,8 +49,43 @@ sum_mots=0
|
||||
# Afficher le résultat
|
||||
print("Nombre de mots par chapitre : ")
|
||||
count_chapitres=0
|
||||
def nombre_de_pages(nombre_de_mots):
|
||||
return round(nombre_de_mots / 250)
|
||||
def format_with_spaces(n):
|
||||
return '{:,}'.format(n).replace(',', ' ')
|
||||
def genre_de_livre(nombre_de_mots):
|
||||
if nombre_de_mots < 5000:
|
||||
return "Nouvelle"
|
||||
elif 5000 <= nombre_de_mots < 30000:
|
||||
return "Récit"
|
||||
elif 30000 <= nombre_de_mots < 50000:
|
||||
return "Nouvelles"
|
||||
elif 50000 <= nombre_de_mots < 100000:
|
||||
return "Roman court"
|
||||
elif 100000 <= nombre_de_mots < 200000:
|
||||
return "Roman"
|
||||
elif 200000 <= nombre_de_mots < 500000:
|
||||
return "Roman épais"
|
||||
else:
|
||||
return "Autre"
|
||||
|
||||
|
||||
# temps de lecture en minutes
|
||||
def temps_de_lecture(nombre_de_signes):
|
||||
return round(nombre_de_signes / 80 * 60)
|
||||
|
||||
def format_time(seconds):
|
||||
minutes, seconds = divmod(seconds, 60)
|
||||
hours, minutes = divmod(minutes, 60)
|
||||
return "{:02d} heures {:02d} minutes {:02d} secondes.".format(hours, minutes, seconds)
|
||||
|
||||
for count, value in sorted(chapters_word_count.items(), key=lambda item: item[0]):
|
||||
sum_mots+=value
|
||||
count_chapitres+=1
|
||||
print(f"{value} mots \t\t \t{count} \t\t{draw_progress_bar(value, objectif_mots)} \t\t ")
|
||||
print(f"\n Total : \n\t {sum_mots} mots.\n\t {count_chapitres} chapitres.")
|
||||
sec_count = sum_mots*6
|
||||
|
||||
print(f"\n Total : \n\t {format_with_spaces(sum_mots)} mots.\n\t {format_with_spaces(sec_count)} signes espaces compris.\n\t {format_with_spaces(count_chapitres)} chapitres.")
|
||||
print(f"Estimation de pages A4: {nombre_de_pages(sum_mots)} ")
|
||||
print(f"Genre de livre: {genre_de_livre(sum_mots)}")
|
||||
print(f"Estimation du temps de lecture: {format_time(temps_de_lecture(sum_mots))}")
|
||||
|
@ -12,12 +12,11 @@ if ! [ -d $dossier ]; then
|
||||
echo "le dossier $dossier n'existe pas, oh noes! ajoutez le en argument à ce script: \n bash update_ebook.sh /$USER/Nextcloud/textes/livre_bidule"
|
||||
else
|
||||
# on supprime les scripts existants
|
||||
rm "$dossier/*.py"
|
||||
rm "$dossier/*.sh"
|
||||
rm "$dossier/*.css"
|
||||
rm $dossier/*.py
|
||||
rm $dossier/*.sh
|
||||
rm $dossier/*.css
|
||||
|
||||
# on met les nouvelles versions
|
||||
cp Makefile "$dossier/"
|
||||
cp *.py "$dossier/"
|
||||
cp *.sh "$dossier/"
|
||||
cp *.css "$dossier/"
|
||||
|
Loading…
Reference in New Issue
Block a user