Skip to content

Commit ad1f73b

Browse files
committed
addressing issue #26 rep. : with "zu" for sports.
Need to take care if any other pages need to be added, refactoring.
1 parent cd0e73b commit ad1f73b

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

getVideoText.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def printAndSay(text):
1414
speaker.talk(text)
1515

1616
class VTextStatus(VideoTextUtils):
17-
"""settings and start"""
17+
"""videotext reader settings and start"""
1818
welcome = "Hallo, ich bin dein Videotext-Assistent.\n" + \
1919
"Eingabe Seitenzahl (dreistellig)," + \
2020
"Beenden durch die Eingabe 'stop'."

videoText.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ class RbbText:
5151
"x" : 600, \
5252
"w" : 160, \
5353
}
54+
55+
ballgamescorepages = { \
56+
252, 276
57+
}
5458
#
5559
api = 'https://www.rbbtext.de/'
5660
#
@@ -154,8 +158,16 @@ def extractJumpingPages(self):
154158
def appendContent(self):
155159
"""process and prettify extracted text lines and append these to content"""
156160
for x in self.lines:
157-
if len(str(x)) > 1 :
158-
self.content += '\n' + str(x)
161+
xAsText = str(x)
162+
if len(xAsText) > 1 :
163+
# quick first attempt for issue #26
164+
# I am canceling the first line of the text with a timestamp here
165+
# as a timestamp is not a score.
166+
if self.currentPage in self.ballgamescorepages \
167+
and not xAsText[0:2].isdigit() and not xAsText.strip().endswith(":"):
168+
xAsText = xAsText.replace("-:-", "noch kein Ergebnis")
169+
xAsText = xAsText.replace(":", " zu ")
170+
self.content += '\n' + xAsText
159171
if len(self.content) < 3:
160172
self.content += "Seite ist leer."
161173
self.content = self.content.replace('-\n', '')

0 commit comments

Comments
 (0)