From 7a2948ef113e3091204a1b91eed905084240d994 Mon Sep 17 00:00:00 2001 From: dave Date: Tue, 29 Dec 2015 23:05:50 -0800 Subject: [PATCH] Create db if file exist (i.e. premade) but is size 0 --- libs/database.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 libs/database.py diff --git a/libs/database.py b/libs/database.py old mode 100644 new mode 100755 index 86fe767..c22d90f --- a/libs/database.py +++ b/libs/database.py @@ -14,7 +14,7 @@ class database: """INSERT INTO "streams" ("id","user","name","url","directory","status","message") VALUES (NULL,NULL,'WCMF Breakroom','http://1681.live.streamtheworld.com/WCMFFMAAC','wcmf-breakroom','0','')""", """INSERT INTO "times" ("id","streamid","su","m","t","w","r","f","sa","starthour","startmin","endhour","endmin") VALUES (NULL,'1','0','1','1','1','1','1','0','2','0','7','15')""" ] - if not os.path.exists("db.sqlite"): + if not os.path.exists("db.sqlite") or os.path.getsize("db.sqlite")==0: db = sqlite3.connect("db.sqlite", check_same_thread=False, cached_statements=0, isolation_level=None) cursor = db.cursor() for query in queries: