From 6e2d244bc92c52510274101bc192f7772a7efcd5 Mon Sep 17 00:00:00 2001 From: Klaus-Uwe Mitterer Date: Tue, 21 Feb 2017 16:00:55 +0100 Subject: [PATCH] Quickly code a lyrics manager... Hopefully works... --- lyricsmanager.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 lyricsmanager.py diff --git a/lyricsmanager.py b/lyricsmanager.py new file mode 100644 index 0000000..e7e3a6f --- /dev/null +++ b/lyricsmanager.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python3 + +def addLyrics(text, ref = 0, db = dbtools.dbHelper()): + db.executeQuery("INSERT INTO lyrics(text, ref, active) VALUES('%s', %i, %i);" % (text, ref, (1 if ref == 0 else 0)) + db.commit() + return db.cur.lastrowid + +def queryLyrics(ref = 0): + text = input("Text: ") + ref = int(input("Reference [%i]: " % ref) or 0) + + row = addLyrics(text, ref) + + ans = "" + + while ans.lower() not in ("y", "n"): + ans = input("Add follow-up lyrics? [Y/n] ") + + if ans.lower() != "n": + queryLyrics(row) + +if __name__ == "__main__": + queryLyrics()