if key & 0xFF == ord('q'): break #set skip image if key & 0xFF == ord('s'): skip_detector.update_template(frame, selector.point1, selector.point2) if key & 0xFF == ord('a'): ads_detector.update_template(frame, selector.point1, selector.point2) selector.draw(frame) if not ret: continue ads_detected = ads_detector.analyse(frame, frame) if ads_detected == True: if not ads_active: ads_active = True config.controller.notify("Ad detected") print("Ads detected, pressing mute") config.controller.mute() elif ads_detected == False: if ads_active: print("No more ads detected, pressing unmute") ads_active = False config.controller.unmute() else: #changing... pass