From d3eecbb0e62582846c137d780dcdaf3ef7071852 Mon Sep 17 00:00:00 2001 From: Elizabeth Cray Date: Thu, 2 May 2024 22:44:45 -0400 Subject: [PATCH] barebones --- .gitignore | 5 +++ README.md | 5 +++ index.py | 57 +++++++++++++++++++++++++++ index.spec | 38 ++++++++++++++++++ run.ps1 | 3 ++ run.ps1 - Shortcut.lnk | Bin 0 -> 1240 bytes scan_log.csv | 85 +++++++++++++++++++++++++++++++++++++++++ 7 files changed, 193 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 index.py create mode 100644 index.spec create mode 100644 run.ps1 create mode 100644 run.ps1 - Shortcut.lnk create mode 100644 scan_log.csv diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4d17948 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +dist/ +build/ +node_modules/ +console.err +console.out diff --git a/README.md b/README.md new file mode 100644 index 0000000..288e6ab --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +# CyberViewX5 Companion + +This really wasn't made to be usable by anyone except myself, but I might update it in the future. + +This is a tool to track how long each frame of film takes to scan so I can run analytics afterwards. \ No newline at end of file diff --git a/index.py b/index.py new file mode 100644 index 0000000..ec28c22 --- /dev/null +++ b/index.py @@ -0,0 +1,57 @@ +import sys +import win32gui +import time + +def callback(hwnd, strings): + if win32gui.IsWindowVisible(hwnd): + window_title = win32gui.GetWindowText(hwnd) + left, top, right, bottom = win32gui.GetWindowRect(hwnd) + if window_title and right-left and bottom-top: + strings.append(window_title) + return True + +log_file = open("C:\\Users\\liz\\Documents\\Git\\filmscantimer\\scan_log.csv", "a") + +def log(msg): + log_file.write(msg + "\n") + +def done(): + log_file.close() + sys.exit(0) + +def main(): + state = False + launchTime = time.time() + window = 120.0 # It has two minutes to launch + while not state: + win_list = [] + win32gui.EnumWindows(callback, win_list) + if win_list.count("CyberViewX5") > 0: + state = True + else: + time.sleep(0.5) + if time.time() - launchTime > window: + done() + state = False + while True: + win_list = [] # list of strings containing win handles and window titles + win32gui.EnumWindows(callback, win_list) # populate list + if win_list.count("CyberViewX5") > 1: + if not state: + print("START," + str(time.time())) + state = True + elif win_list.count("CyberViewX5") == 1: + if state: + print("END," + str(time.time())) + state = False + else: + # CyberViewX5 closed + print("CyberViewX5 Not Running") + done() + time.sleep(0.01) + + done() + + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/index.spec b/index.spec new file mode 100644 index 0000000..be64d56 --- /dev/null +++ b/index.spec @@ -0,0 +1,38 @@ +# -*- mode: python ; coding: utf-8 -*- + + +a = Analysis( + ['index.py'], + pathex=[], + binaries=[], + datas=[], + hiddenimports=[], + hookspath=[], + hooksconfig={}, + runtime_hooks=[], + excludes=[], + noarchive=False, + optimize=0, +) +pyz = PYZ(a.pure) + +exe = EXE( + pyz, + a.scripts, + a.binaries, + a.datas, + [], + name='index', + debug=False, + bootloader_ignore_signals=False, + strip=False, + upx=True, + upx_exclude=[], + runtime_tmpdir=None, + console=True, + disable_windowed_traceback=False, + argv_emulation=False, + target_arch=None, + codesign_identity=None, + entitlements_file=None, +) diff --git a/run.ps1 b/run.ps1 new file mode 100644 index 0000000..841be87 --- /dev/null +++ b/run.ps1 @@ -0,0 +1,3 @@ +Start-Process -FilePath "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\CyberViewX.lnk" +Start-Sleep -Milliseconds 3000 +Start-Process -FilePath "C:\Users\Liz\.pyenv\pyenv-win\versions\3.10.11\python3.exe" -ArgumentList 'C:\Users\Liz\Documents\Git\filmscantimer\index.py' -Wait diff --git a/run.ps1 - Shortcut.lnk b/run.ps1 - Shortcut.lnk new file mode 100644 index 0000000000000000000000000000000000000000..210bc7851de99b17c2a3e73f24f77f6c2e009832 GIT binary patch literal 1240 zcmb_bTS!z<6kVgEj7T{{A~wC|CyLD5m=)wuh>mF>HZfyf;s#k>b6{S1N9Tb*fk8oo zWfB$!;%MTBkzWcy)VCk?5fnxs5k(J>!0=0GojcAo)*c^!s)!f6$k2T6vJqJa|TuV;hsG2vZBo&>Ila))S?JxEIpa@?cbM{#|kCd@m$K=kdPIwbqR1H=i1nM^UoiGW%^CjzkUy7|xzQ_o? zNYGytDuSp6pQD_o4Bknfy~4oj3CGlKZZtrN z^S!8Ne-yNGdPFxh?wdKINlG^>b`d?CD3voC)pd>3MXBqg3{a!dqFvYeb-QkM?tgn! zh^vP&Bxa&RJuU9n=m#n+1nvL; literal 0 HcmV?d00001 diff --git a/scan_log.csv b/scan_log.csv new file mode 100644 index 0000000..38dfdfd --- /dev/null +++ b/scan_log.csv @@ -0,0 +1,85 @@ +ACTION,TIMESTAMP +START,1714671981.681007 +END,1714672081.9560761 +START,1714672281.681823 +END,1714672472.9604802 +START,1714672481.231264 +END,1714672675.256915 +START,1714672687.4683855 +END,1714672890.5915043 +START,1714672907.7280502 +END,1714673098.4014394 +START,1714673107.5587103 +END,1714673300.1613328 +START,1714679387.335423 +END,1714679656.7147973 +START,1714679676.898519 +END,1714679875.406228 +START,1714680190.1102633 +END,1714680386.4101868 +START,1714680424.206592 +END,1714680622.9295104 +START,1714680639.226426 +END,1714680830.2757254 +START,1714680835.032656 +END,1714681027.0559857 +START,1714681046.7317646 +END,1714681239.8537474 +START,1714681266.0327773 +END,1714681459.9294858 +START,1714682025.6242187 +END,1714682221.479338 +START,1714682997.7753234 +END,1714683245.02265 +START,1714683249.7641852 +END,1714683502.1769078 +START,1714683502.9376805 +END,1714683764.951064 +START,1714683813.6963525 +END,1714684049.0541506 +START,1714684066.3504825 +END,1714684327.0773475 +START,1714684353.2826965 +END,1714684586.778165 +START,1714684840.0408244 +END,1714685077.0288386 +START,1714685404.6945825 +END,1714685641.9328074 +START,1714685730.607431 +END,1714685977.6495645 +START,1714686012.8087292 +END,1714686245.3187919 +START,1714686308.0208383 +END,1714686538.8999248 +START,1714686700.0502682 +END,1714686929.3896363 +START,1714686941.567573 +END,1714687182.5082612 +START,1714687186.658023 +END,1714687422.0111208 +START,1714687546.6520996 +END,1714687779.508072 +START,1714687781.169326 +END,1714688065.7297397 +START,1714688112.6133792 +END,1714688351.9008133 +START,1714688610.090224 +END,1714688844.354024 +START,1714688848.0215528 +END,1714689073.2049983 +START,1714689109.9789798 +END,1714689336.7776277 +START,1714689362.462249 +END,1714689589.9356983 +START,1714689616.0727196 +END,1714689846.7305298 +START,1714689847.8862386 +END,1714690078.8723495 +START,1714690136.1198533 +END,1714690371.7041185 +START,1714690400.8575451 +END,1714690623.6396954 +START,1714690919.3011584 +END,1714691155.7371678 +START,1714691175.381525 +END,1714691411.826881 \ No newline at end of file