From 89109676a3fd1d428d1a875a41c4fa335ec10447 Mon Sep 17 00:00:00 2001 From: Jools Wills Date: Fri, 27 Jun 2014 22:42:51 +0100 Subject: [PATCH 1/2] actually allow breaking out of processing with ctrl+c --- scraper.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) mode change 100644 => 100755 scraper.py diff --git a/scraper.py b/scraper.py old mode 100644 new mode 100755 index e8cfef5..0b7bc32 --- a/scraper.py +++ b/scraper.py @@ -297,6 +297,8 @@ def autoChooseBestResult(nodes,t): return 0 def scanFiles(SystemInfo): + status = "ok" + name=SystemInfo[0] if name == "scummvm": global SCUMMVM @@ -414,15 +416,22 @@ def scanFiles(SystemInfo): newgenre.text=genre.strip() except KeyboardInterrupt: print "Ctrl+C detected. Closing work now..." + status = "break" + break except Exception as e: print "Exception caught! %s" % e - + else: + continue + break + if gamelist.find("game") is None: print "No new games added." else: print "{} games added.".format(len(gamelist)) exportList(gamelist) + return status + try: if os.getuid()==0: os.environ['HOME']="/home/"+os.getenv("SUDO_USER") @@ -454,6 +463,8 @@ def scanFiles(SystemInfo): sys.exit() else: for i,v in enumerate(ES_systems): - scanFiles(ES_systems[i]) + result = scanFiles(ES_systems[i]) + if result == "break": + break print "All done!" From 3ca077c0adb84d93e2b69ce89951f1c3bc3e188d Mon Sep 17 00:00:00 2001 From: Jools Wills Date: Fri, 27 Jun 2014 22:43:55 +0100 Subject: [PATCH 2/2] cosmetic: trailing spaces --- scraper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scraper.py b/scraper.py index 0b7bc32..ff847d2 100755 --- a/scraper.py +++ b/scraper.py @@ -423,7 +423,7 @@ def scanFiles(SystemInfo): else: continue break - + if gamelist.find("game") is None: print "No new games added." else: