import sys

log_file = r"C:\Users\mmiro\AppData\Roaming\Kodi\kodi.log"
out_file = r"C:\Users\mmiro\AppData\Roaming\Kodi\addons\plugin.video.mmirousek_v3\parsed.txt"

with open(log_file, "r", encoding="utf-8", errors="replace") as f:
    lines = f.readlines()

with open(out_file, "w", encoding="utf-8") as out:
    for ln in lines:
        if "SM2-cloud_sync" in ln or "SM2-service" in ln or "SM2-metadata_db" in ln:
            out.write(ln)
