From 653a85138b8cb2aa0e70cc6a9b0a9965fa807b57 Mon Sep 17 00:00:00 2001 From: CronyAkatsuki Date: Sat, 10 Jul 2021 17:47:49 +0200 Subject: [PATCH] Clear exit after using ctrl + c --- adl.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/adl.py b/adl.py index 69a1c49..50896ff 100644 --- a/adl.py +++ b/adl.py @@ -1,4 +1,5 @@ -import os, subprocess, sys, argparse +import os, subprocess, sys, argparse, signal +from time import sleep # argument parser ap = argparse.ArgumentParser() @@ -140,9 +141,9 @@ def get_score(choice): choice = choice[68:71] return choice -# watch anime +# watch animes def watch(cmd): - os.system(cmd) + subprocess.run(cmd) # next episode def next_episode(title,episode): @@ -276,6 +277,11 @@ def wanna_update_title_after_watch(title, episode, score): elif yn == "N" or yn == "n": break +def interupt_command(signum, frame): + exit_adl() + +signal.signal(signal.SIGINT, interupt_command) + # choose what to do with episode def choose_episode(): subprocess.call("cls", shell=True)