From 5c5fae4c7321c942105d52711546dd3f055766f3 Mon Sep 17 00:00:00 2001 From: hyugogirubato <65763543+hyugogirubato@users.noreply.github.com> Date: Mon, 22 Jul 2024 20:31:01 +0200 Subject: [PATCH] Optimization data export --- keydive/__main__.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/keydive/__main__.py b/keydive/__main__.py index 52d6f9b..099994a 100644 --- a/keydive/__main__.py +++ b/keydive/__main__.py @@ -113,6 +113,10 @@ def main() -> None: logger.info('Watcher delay: %ss' % args.delay) current = None while core.running: + # Check if for current process data has been exported + if current and cdm.export(args.output, args.wvd): + raise KeyboardInterrupt + # https://github.com/hyugogirubato/KeyDive/issues/14#issuecomment-2146788792 processes = { key: (name, pid) @@ -124,12 +128,9 @@ def main() -> None: raise EnvironmentError('Unable to detect Widevine, refer to https://github.com/hyugogirubato/KeyDive/blob/main/docs/PACKAGE.md#drm-info') # Check if the current process has changed - if current: - if current not in [v[1] for v in processes.values()]: - logger.warning('Widevine process has changed') - current = None - elif cdm.export(args.output, args.wvd): - raise KeyboardInterrupt + if current and current not in [v[1] for v in processes.values()]: + logger.warning('Widevine process has changed') + current = None # If current process not found, attempt to hook into the detected processes if not current: