This commit is contained in:
2026-03-18 10:03:12 +01:00
5 changed files with 18 additions and 16 deletions

View File

@@ -2,10 +2,10 @@
# -*- coding: utf-8 -*-
"""
MehrmonatsAuswertung ACRCloud PDFReport + Druck
Mehrmonats Auswertung ACRCloud PDF Report und Druck
———————————————————————————————————————————————
• TimestampSpalte : "Timestamp(UTC+02:00)"
• DauerSpalte : "Played Duration" (Sekunden)
• Timestamp Spalten : "Timestamp(UTC+0x:00)"
• Dauer Spalte : "Played Duration" (Sekunden)
"""
import calendar
@@ -51,12 +51,12 @@ def musikanteil(path: Path) -> Tuple[int, int, float]:
def erstelle_pdf(daten: List[Tuple[int, int, float]], ausgabe: Path) -> None:
"""Erzeugt einen QuerformatPDFReport mit Tabelle."""
"""Erzeugt einen Querformat PDF Report mit Tabelle."""
c = canvas.Canvas(str(ausgabe), pagesize=landscape(A4))
w, h = landscape(A4)
# Überschrift
title = "Musikanteil pro Monat (ACRCloudAuswertung)"
title = "Musikanteil pro Monat (ACRCloud Auswertung)"
c.setFont("Helvetica-Bold", 16)
c.drawCentredString(w / 2, h - 25 * mm, title)
@@ -67,7 +67,7 @@ def erstelle_pdf(daten: List[Tuple[int, int, float]], ausgabe: Path) -> None:
# Tabellenkopf
ypos = h - 50 * mm
col_widths = [50 * mm, 50 * mm, 50 * mm]
headers = ["Monat/Jahr", "Musikanteil[%]", "Datei"]
headers = ["Monat/Jahr", "Musikanteil [%]", "Datei"]
c.setFont("Helvetica-Bold", 11)
for i, head in enumerate(headers):
@@ -88,9 +88,8 @@ def erstelle_pdf(daten: List[Tuple[int, int, float]], ausgabe: Path) -> None:
c.save()
def drucke_pdf(pfad: Path) -> None:
"""Sendet das PDF an den WindowsStandarddrucker (Acrobat bzw. Edge)."""
"""Sendet das PDF an den Windows Standarddrucker (Acrobat bzw. Edge)."""
try:
# os.startfile mit "print" funktioniert auf Windows
os.startfile(pfad, "print")
@@ -103,8 +102,8 @@ def main() -> None:
root.withdraw()
dateien = filedialog.askopenfilenames(
title="Mehrere ACRCloudExcelDateien wählen",
filetypes=[("ExcelDateien", "*.xlsx;*.xls")],
title="Mehrere ACRCloud Excel Dateien wählen",
filetypes=[("Excel Dateien", "*.xlsx;*.xls")],
)
if not dateien:
return
@@ -126,11 +125,11 @@ def main() -> None:
# chronologisch sortieren
ergebnisse.sort(key=lambda x: (x[0], x[1]))
# PDFDatei speichern
# PDF Datei speichern
save_path = filedialog.asksaveasfilename(
title="PDFReport speichern unter …",
title="PDF Report speichern unter …",
defaultextension=".pdf",
filetypes=[("PDFDatei", "*.pdf")],
filetypes=[("PDF Datei", "*.pdf")],
initialfile="Musikanteil_Report.pdf",
)
if not save_path:
@@ -138,8 +137,8 @@ def main() -> None:
erstelle_pdf(ergebnisse, Path(save_path))
# Zusammenfassung anzeigen + Druckoption
text_lines = [f"{m:02d}/{j}: {p:.2f}%" for j, m, p, _ in ergebnisse]
# Zusammenfassung anzeigen Druckoption
text_lines = [f"{m:02d}/{j}: {p:.2f} %" for j, m, p, _ in ergebnisse]
summary = "Erfolgreich erstellt:\n" + "\n".join(text_lines)
def dialog():

View File

@@ -1,3 +1,6 @@
# Suisa-Listen
Tools zur Auswertung und Formatierung von ACR Cloud Song Listen
Tools zur Auswertung und Formatierung von ACR Cloud Song Listen
Anwendbar auf ACR Cloud xlsx Downloads in CET oder CEST
- Header wie von Suisa verlangt mit relevanten Spalten
- Auswertung Musikanteil anhand der erkannten Musik

Binary file not shown.

Binary file not shown.