diff --git a/HandBrake_recursive/HandBrake_recursive.py b/HandBrake_recursive/HandBrake_recursive.py index bf0f8b1..62dceda 100644 --- a/HandBrake_recursive/HandBrake_recursive.py +++ b/HandBrake_recursive/HandBrake_recursive.py @@ -9,13 +9,15 @@ import math import json import argparse import ffmpeg - +from datetime import datetime import pydbus as dbus import openpyxl from openpyxl.styles import PatternFill from openpyxl.formatting.rule import CellIsRule +date = datetime.now().strftime("%Y-%m-%d_%Hh%M") + def inhibit_arret(application, raison): inhibiteurs = {} @@ -95,10 +97,17 @@ def set_column_width(ws, column_range, width=15): ws.column_dimensions[col].width = width def export_xlsx(lignes, fichier_sortie="résumé.xlsx"): - # Créer un nouveau classeur et sélectionner la feuille active - wb = openpyxl.Workbook() - ws = wb.active - ws.title = "Résumé" + # Charger le classeur existant ou en créer un nouveau + if os.path.exists(fichier_sortie): + wb = openpyxl.load_workbook(fichier_sortie) + else: + wb = openpyxl.Workbook() + # Supprimer la feuille par défaut si on ajoute une nouvelle + default_sheet = wb.active + wb.remove(default_sheet) + + # Créer une nouvelle feuille + ws = wb.create_sheet(title=date) # En-têtes headers = ["Fichier", "Codec", "Résolution", "Action", "Durée", "Taille SRC", "Bitrate SRC",