From daba1363bed67d768a48e59b65d7ddf940b0c0e5 Mon Sep 17 00:00:00 2001 From: Jacob Henry Date: Tue, 29 Nov 2016 23:32:26 +0000 Subject: [PATCH] Tweaked regex --- kong.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/kong.py b/kong.py index 69b9d84..8eb5249 100644 --- a/kong.py +++ b/kong.py @@ -7,10 +7,10 @@ DEFAULT_SONG = "dk_rap_classic" #Patterns patterns = {} -patterns['start'] = re.compile("^#STARTSONG (.*?)") -patterns['time'] = re.compile("^#TIMEPERLINE (\\d*)") -patterns['rest'] = re.compile("^#REST") -patterns['end'] = re.compile("^#ENDSONG") +patterns['start'] = re.compile(r"#STARTSONG\a+(.*?)") +patterns['time'] = re.compile(r"#TIMEPERLINE\a+(\d*)") +patterns['rest'] = re.compile(r"#REST") +patterns['end'] = re.compile(r"#ENDSONG") #SongContents lyric_lines = [] @@ -33,6 +33,7 @@ class SongThread(threading.Thread): playing = False for line in lyric_lines: + print(line) if line == "": continue @@ -72,9 +73,7 @@ class SongThread(threading.Thread): def getAllTitles(): titles = [] - print(lyric_lines) for line in lyric_lines: - print(line) m = patterns['start'].match(line) if m: titles += [m.group(1)]