@@ -199,6 +199,8 @@ def __init__(self, config, keybindings, ui=True, external=False):
199199 def sigint_handler (self , _signum , _frame ):
200200 """Handling Ctrl-C event"""
201201 self .stop_playback ()
202+ time .sleep (1 )
203+ sys .exit () # failsafe
202204
203205
204206 def pil_img_to_term (self , img , remove_alpha = True ):
@@ -436,17 +438,17 @@ def audio_player(self, audio_queue, samplerate, channels, audio_ready):
436438 time .sleep (0.1 )
437439
438440
439- def video_player (self , video_queue , audio_queue , frame_duration ):
441+ def video_player (self , video_queue , audio_queue , frame_duration , no_audio = False ):
440442 """Play video frames from the queue"""
441443 while True :
442444 frame = video_queue .get ()
443445 if frame is None :
444446 break
445- if audio_queue .qsize () >= 1 :
447+ if audio_queue .qsize () >= 1 or no_audio :
446448 start_time = time .time ()
447449 img = frame .to_image ()
448450 self .pil_img_to_term (img , remove_alpha = False )
449- if audio_queue .qsize () >= 3 :
451+ if audio_queue .qsize () >= 3 or no_audio :
450452 time .sleep (max (frame_duration - (time .time () - start_time ), 0 ))
451453 while self .pause :
452454 time .sleep (0.1 )
@@ -489,7 +491,7 @@ def play_video(self, path):
489491
490492 # prepare video
491493 video_queue = Queue (maxsize = 10 )
492- video_thread = threading .Thread (target = self .video_player , args = (video_queue , audio_queue , frame_duration ), daemon = True )
494+ video_thread = threading .Thread (target = self .video_player , args = (video_queue , audio_queue , frame_duration , not ( have_audio ) ), daemon = True )
493495 video_thread .start ()
494496
495497 num = 0
0 commit comments