[HandBrake_recursive] export_xlsx sans écraser le fichier existant
This commit is contained in:
parent
dbb3cc68a1
commit
efa7127914
@ -9,13 +9,15 @@ import math
|
|||||||
import json
|
import json
|
||||||
import argparse
|
import argparse
|
||||||
import ffmpeg
|
import ffmpeg
|
||||||
|
from datetime import datetime
|
||||||
import pydbus as dbus
|
import pydbus as dbus
|
||||||
|
|
||||||
import openpyxl
|
import openpyxl
|
||||||
from openpyxl.styles import PatternFill
|
from openpyxl.styles import PatternFill
|
||||||
from openpyxl.formatting.rule import CellIsRule
|
from openpyxl.formatting.rule import CellIsRule
|
||||||
|
|
||||||
|
date = datetime.now().strftime("%Y-%m-%d_%Hh%M")
|
||||||
|
|
||||||
def inhibit_arret(application, raison):
|
def inhibit_arret(application, raison):
|
||||||
inhibiteurs = {}
|
inhibiteurs = {}
|
||||||
|
|
||||||
@ -95,10 +97,17 @@ def set_column_width(ws, column_range, width=15):
|
|||||||
ws.column_dimensions[col].width = width
|
ws.column_dimensions[col].width = width
|
||||||
|
|
||||||
def export_xlsx(lignes, fichier_sortie="résumé.xlsx"):
|
def export_xlsx(lignes, fichier_sortie="résumé.xlsx"):
|
||||||
# Créer un nouveau classeur et sélectionner la feuille active
|
# Charger le classeur existant ou en créer un nouveau
|
||||||
wb = openpyxl.Workbook()
|
if os.path.exists(fichier_sortie):
|
||||||
ws = wb.active
|
wb = openpyxl.load_workbook(fichier_sortie)
|
||||||
ws.title = "Résumé"
|
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
|
# En-têtes
|
||||||
headers = ["Fichier", "Codec", "Résolution", "Action", "Durée", "Taille SRC", "Bitrate SRC",
|
headers = ["Fichier", "Codec", "Résolution", "Action", "Durée", "Taille SRC", "Bitrate SRC",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user