Abort on empty text, replace recursion with while loop

This commit is contained in:
Klaus-Uwe Mitterer 2017-02-26 20:29:50 +01:00
parent 411520ec53
commit cbe1c60774

View file

@ -18,7 +18,10 @@ def queryLyrics(ref = 0):
else:
out = text
if len(out) > 130:
if len(out) == 0:
print("No input. Aborting.")
return False
elif len(out) > 130:
print("Text too long (%i characters)" % len(out))
return queryLyrics(ref)
@ -32,7 +35,9 @@ def queryLyrics(ref = 0):
ans = input("Add follow-up lyrics? [Y/n] ")
if ans.lower() != "n":
queryLyrics(row)
return True
return False
if __name__ == "__main__":
queryLyrics()
while queryLyrics():
continue