From 2a66932bff132794e10754f3d977dcf1275e95e8 Mon Sep 17 00:00:00 2001 From: j Date: Thu, 5 Oct 2017 01:49:32 +0200 Subject: [PATCH] catch keyboard in head request too --- cdoseaplay/update.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cdoseaplay/update.py b/cdoseaplay/update.py index 3010612..fd243e1 100755 --- a/cdoseaplay/update.py +++ b/cdoseaplay/update.py @@ -59,7 +59,10 @@ def update_video(url, name): if folder and not os.path.exists(folder): os.makedirs(folder) if os.path.exists(name): - head = requests.head(url, allow_redirects=True) + try: + head = requests.head(url, allow_redirects=True) + except KeyboardInterrupt: + sys.exit(-1) modified = head.headers.get("Last-Modified") if modified: mtime = time.mktime(datetime.strptime(modified, "%a, %d %b %Y %X GMT").timetuple())