From d31104a4f081a45b7003fbe94825dcd749b2ad41 Mon Sep 17 00:00:00 2001 From: lionel <.> Date: Wed, 21 May 2025 01:17:14 +0200 Subject: [PATCH] =?UTF-8?q?[HandBrake=5Frecursive]=20Ajouter=20un=20lien?= =?UTF-8?q?=20vers=20les=20fichiers=20de=20destination=20et=20d=C3=A9finir?= =?UTF-8?q?=20la=20nouvelle=20feuille=20comme=20active?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HandBrake_recursive/HandBrake_recursive.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/HandBrake_recursive/HandBrake_recursive.py b/HandBrake_recursive/HandBrake_recursive.py index 62dceda..87fa405 100644 --- a/HandBrake_recursive/HandBrake_recursive.py +++ b/HandBrake_recursive/HandBrake_recursive.py @@ -96,7 +96,7 @@ def set_column_width(ws, column_range, width=15): for col in column_range: ws.column_dimensions[col].width = width -def export_xlsx(lignes, fichier_sortie="résumé.xlsx"): +def export_xlsx(lignes, output_directory, fichier_sortie="résumé.xlsx"): # Charger le classeur existant ou en créer un nouveau if os.path.exists(fichier_sortie): wb = openpyxl.load_workbook(fichier_sortie) @@ -109,6 +109,9 @@ def export_xlsx(lignes, fichier_sortie="résumé.xlsx"): # Créer une nouvelle feuille ws = wb.create_sheet(title=date) + # Définir la nouvelle feuille comme active + wb.active = ws + # En-têtes headers = ["Fichier", "Codec", "Résolution", "Action", "Durée", "Taille SRC", "Bitrate SRC", "Taille DES", "Bitrate DES", "Gain %", "Résultat"] @@ -143,7 +146,7 @@ def export_xlsx(lignes, fichier_sortie="résumé.xlsx"): gain_percent = calc_gain_percent(input_size, output_size, raw=True) row = [ - file, # string + f'=HYPERLINK("{os.path.abspath(output_directory)}/{file}","{file}")', # string codec, # string resolution, # string action, # string @@ -550,7 +553,7 @@ def main(): )) xlsx_file = "résumé.xlsx" - export_xlsx(lignes, fichier_sortie=xlsx_file) + export_xlsx(lignes, output_directory, fichier_sortie=xlsx_file) print(f"📝 Classeur généré : {xlsx_file}") lever_inhibit_arret(inhibiteurs)