Abort on empty text, replace recursion with while loop
This commit is contained in:
parent
dceaeb7452
commit
7c7d612311
1 changed files with 8 additions and 3 deletions
|
@ -18,7 +18,10 @@ def queryLyrics(ref = 0):
|
||||||
else:
|
else:
|
||||||
out = text
|
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))
|
print("Text too long (%i characters)" % len(out))
|
||||||
return queryLyrics(ref)
|
return queryLyrics(ref)
|
||||||
|
|
||||||
|
@ -32,7 +35,9 @@ def queryLyrics(ref = 0):
|
||||||
ans = input("Add follow-up lyrics? [Y/n] ")
|
ans = input("Add follow-up lyrics? [Y/n] ")
|
||||||
|
|
||||||
if ans.lower() != "n":
|
if ans.lower() != "n":
|
||||||
queryLyrics(row)
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
queryLyrics()
|
while queryLyrics():
|
||||||
|
continue
|
||||||
|
|
Loading…
Reference in a new issue