Skip to content

Commit b3fa284

Browse files
author
arch
committed
add beep with try catch
1 parent 648055d commit b3fa284

File tree

4 files changed

+15
-12
lines changed

4 files changed

+15
-12
lines changed

contrib/Installer/mtfg-ofs-extension-installer.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ def update(download_urls, latest, release_notes):
137137
error("This installer only work on Windows")
138138

139139
is_ofs_installed()
140+
print('Fetch latest release data from github.com')
140141
download_urls, latest, release_notes = get_download_urls_with_api()
141142
update(download_urls, latest, release_notes)
142143

funscript_editor/algorithms/funscriptgenerator.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -296,8 +296,7 @@ def min_max_selector(self,
296296
cv2.putText(image, "Use 'space' to quit and set the trackbar values",
297297
(self.x_text_start, 100), cv2.FONT_HERSHEY_SIMPLEX, self.font_size, (255,0,0), 2)
298298

299-
# beep_thread = threading.Thread(target=self.beep)
300-
# beep_thread.start()
299+
self.beep()
301300
self.clear_keypress_queue()
302301
trackbarValueMin = lower_limit
303302
trackbarValueMax = upper_limit
@@ -320,13 +319,17 @@ def min_max_selector(self,
320319

321320
def beep(self) -> None:
322321
""" Play an sound to signal an event """
323-
if False:
324-
# we have problems on windows with this
325-
if NOTIFICATION_SOUND_FILE is not None:
326-
if os.path.exists(NOTIFICATION_SOUND_FILE):
327-
playsound(NOTIFICATION_SOUND_FILE)
328-
else:
329-
self.logger.warning("Notification sound file not found (%s)", NOTIFICATION_SOUND_FILE)
322+
if NOTIFICATION_SOUND_FILE is not None:
323+
if os.path.exists(NOTIFICATION_SOUND_FILE):
324+
def play_beep():
325+
try: playsound(NOTIFICATION_SOUND_FILE)
326+
except: pass
327+
try:
328+
self.beep_thread = threading.Thread(target=play_beep)
329+
self.beep_thread.start()
330+
except: pass
331+
else:
332+
self.logger.warning("Notification sound file not found (%s)", NOTIFICATION_SOUND_FILE)
330333

331334

332335
def calculate_score(self, bboxes) -> None:
@@ -860,8 +863,7 @@ def tracking(self) -> str:
860863

861864
scene_change_quit_flag = False
862865
if scene_detector.is_scene_change(frame_num-1 + self.params.start_frame):
863-
# beep_thread = threading.Thread(target=self.beep)
864-
# beep_thread.start()
866+
self.beep()
865867
cv2.putText(last_frame, "Scene change detected, Press 'space' to continue tracking or press 'q' to finalize tracking",
866868
(self.x_text_start, 75), cv2.FONT_HERSHEY_SIMPLEX, self.font_size, (255,0,0), 2)
867869
cv2.imshow(self.window_name, self.preview_scaling(last_frame))

funscript_editor/config/settings.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ tracker: 'CSRT'
1919

2020
# Specify the wav file to play when tracking finished (write 'off' to disable the sound notification)
2121
# This feature was removed in v0.1.1 due to problems on windows
22-
notification_sound: 'off'
22+
notification_sound: 'sound_notification.wav'
2323

2424
# Time in milliseconds at which the tracking is stopped if the selected feature is not found
2525
tracking_lost_time: 0

tests/data/rotation.mkv

-106 KB
Binary file not shown.

0 commit comments

Comments
 (0)