From b08578615925cd90da0606c1e5b457ab4ee7e56e Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Sun, 4 Oct 2015 17:07:01 +0200 Subject: Only insert from dump when non-empty --- cli.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cli.py b/cli.py index 085a0bc..921ecf5 100755 --- a/cli.py +++ b/cli.py @@ -90,10 +90,12 @@ def load_biblehub(db, f): 'VALUES (?, ?, ?)', (v['book'], v['chapter'], v['verse'])) for translation, text in v['translations'].items(): - conn.execute('INSERT OR IGNORE INTO translated_verses ' - '(translation, book, chapter, nr, text) ' - 'VALUES (?, ?, ?, ?, ?)', - (translation, cur_book, v['chapter'], v['verse'], text)) + text = text.strip() + if text != '': + conn.execute('INSERT OR IGNORE INTO translated_verses ' + '(translation, book, chapter, nr, text) ' + 'VALUES (?, ?, ?, ?, ?)', + (translation, cur_book, v['chapter'], v['verse'], text)) click.echo(str(round(time.time() - timer, 3)) + 's') db.commit() -- cgit v1.2.3