Quickly code a lyrics manager... Hopefully works...
This commit is contained in:
parent
04758ed796
commit
e3ae8f497a
1 changed files with 23 additions and 0 deletions
23
lyricsmanager.py
Normal file
23
lyricsmanager.py
Normal file
|
@ -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()
|
Loading…
Reference in a new issue