From 9b9dffe39416a9355bdf6c31cb6b26e7c0e6d8d5 Mon Sep 17 00:00:00 2001 From: Klaus-Uwe Mitterer Date: Tue, 21 Feb 2017 16:03:45 +0100 Subject: [PATCH] Limit text length --- lyricsmanager.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lyricsmanager.py b/lyricsmanager.py index e7e3a6f..8d70329 100644 --- a/lyricsmanager.py +++ b/lyricsmanager.py @@ -7,7 +7,12 @@ def addLyrics(text, ref = 0, db = dbtools.dbHelper()): def queryLyrics(ref = 0): text = input("Text: ") - ref = int(input("Reference [%i]: " % ref) or 0) + + if len(text) > 130: + print("Text too long (%i characters)" % len(text)) + return queryLyrics(ref) + + ref = int(input("Reference [%i]: " % ref) or ref) row = addLyrics(text, ref)