notebook
This commit is contained in:
+29
-2
@@ -1,3 +1,4 @@
|
||||
import time
|
||||
import win32com.client
|
||||
import pandas as pd
|
||||
from pathlib import Path
|
||||
@@ -18,9 +19,14 @@ entries = gal.AddressEntries
|
||||
|
||||
rows = []
|
||||
|
||||
print(f"Počet položek v GAL: {entries.Count}")
|
||||
total = entries.Count
|
||||
print(f"Počet položek v GAL: {total}")
|
||||
|
||||
for i in range(1, entries.Count + 1): # Outlook COM je 1-based
|
||||
start = time.perf_counter()
|
||||
last = start
|
||||
PROGRESS_EVERY = 100 # každých N položek vypsat rychlost
|
||||
|
||||
for i in range(1, total + 1): # Outlook COM je 1-based
|
||||
try:
|
||||
entry = entries.Item(i)
|
||||
|
||||
@@ -80,6 +86,27 @@ for i in range(1, entries.Count + 1): # Outlook COM je 1-based
|
||||
"error": str(e),
|
||||
})
|
||||
|
||||
# průběžný výpis rychlosti
|
||||
if i % PROGRESS_EVERY == 0 or i == total:
|
||||
now = time.perf_counter()
|
||||
elapsed = now - start
|
||||
rate = i / elapsed if elapsed else 0
|
||||
recent_rate = PROGRESS_EVERY / (now - last) if now > last else 0
|
||||
remaining = (total - i) / rate if rate else 0
|
||||
print(
|
||||
f" {i}/{total} ({i / total:.0%}) | "
|
||||
f"{rate:.1f} pol./s (akt. {recent_rate:.1f}) | "
|
||||
f"uplynulo {elapsed:.1f}s | zbývá ~{remaining:.0f}s",
|
||||
flush=True,
|
||||
)
|
||||
last = now
|
||||
|
||||
total_elapsed = time.perf_counter() - start
|
||||
print(
|
||||
f"Zpracováno {total} položek za {total_elapsed:.1f}s "
|
||||
f"({total / total_elapsed:.1f} pol./s)"
|
||||
)
|
||||
|
||||
df = pd.DataFrame(rows)
|
||||
df.to_excel(OUT_XLSX, index=False)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user