diff --git a/cdoseaplay/play.py b/cdoseaplay/play.py index 9be7a57..37c9a22 100755 --- a/cdoseaplay/play.py +++ b/cdoseaplay/play.py @@ -14,11 +14,12 @@ logger = logging.getLogger('cdosea') player = None quit = False + def q_binding(*args): global player - player.quit() - del player quit = True + player.quit() + player = None def main(): @@ -61,13 +62,16 @@ def main(): pause_next = False play_lights = True while True: - if not quit and pause_next: - player.pause = True - pause_next = False - play_lights = False - elif not quit and player.path.decode().endswith('black.mp4'): - pause_next = True - play_lights = False + if not player: + break + if not quit: + if pause_next: + player.pause = True + pause_next = False + play_lights = False + elif player.path.decode().endswith('black.mp4'): + pause_next = True + play_lights = False if play_lights and config.lights and player.path: trigger_lights(player.path.decode())