- 433CB3B45EBE59D30A4E2C8CE965BB756E34196F1FC14256620D4A9226EF5AD6E3B707E33D40BF6FAEBECF18178A0E6F982D48D17924585FA103EB9CC99532D4
+ 02094C29071DD57D190922D14909D064AFDECDA6F03288D7F80887F87B189C6CF9F708BC271DA3E9E0CB26D1A5345CB93518F3D9EDBCACDA6EA8A451929BD8E9
logotron/reader.py
(447 . 49)(447 . 6)
105 return Response(res, mimetype='text/plain')
106
107
108 # "Tape" is a raw log containing entried from ALL logged chans:
109 @app.route('/tape')
110 def tape():
111 res = ""
112
113 # Get start and end indices:
114 idx_start = request.args.get('istart', default = 0, type = int)
115 idx_end = request.args.get('iend', default = 0, type = int)
116
117 # Malformed bounds?
118 if idx_start > idx_end:
119 return Response("EGGOG: Start must precede End!",
120 mimetype='text/plain')
121
122 # Demanded too many in one burst ?
123 if (idx_end - idx_start) > Max_Raw_Ln :
124 return Response("EGGOG: May request Max. of %s Lines !" % Max_Raw_Ln,
125 mimetype='text/plain')
126
127 # Get the loglines from DB
128 lines = query_db(
129 '''select * from loglines where
130 idx between %s and %s order by idx asc;''',
131 [idx_start, idx_end], one=False)
132
133 # Retrieve raw lines in Tape format:
134 for l in lines:
135 action = ""
136 speaker = "%s;" % l['speaker']
137 if l['self']:
138 action = "*;"
139 speaker = "%s " % l['speaker']
140 res += "%s;%s;%s;%s%s%s\n" % (l['chan'],
141 l['idx'],
142 l['t'].strftime('%s'),
143 action,
144 speaker,
145 l['payload'])
146
147 # Return plain text:
148 return Response(res, mimetype='text/plain')
149
150
151 Name_Chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-"
152
153 def sanitize_speaker(s):