|
|
@ -61,7 +61,7 @@ def printNow(query, results): |
|
|
|
results_count = 0 |
|
|
|
for x, document in results.items(): |
|
|
|
for n, sentence in enumerate(document['matches']): |
|
|
|
if results_count < 4: |
|
|
|
if results_count <= 4: |
|
|
|
results_count += 1 |
|
|
|
sentence = str(sentence) # Turn Flask Markup object back to normal python string |
|
|
|
sentence = char_swap(sentence) |
|
|
@ -102,8 +102,6 @@ def printNow(query, results): |
|
|
|
print('\n | \n', file=print_pointer, flush=True) |
|
|
|
sleep(3) |
|
|
|
|
|
|
|
current_count += 1 |
|
|
|
|
|
|
|
end_line = insert_linebreaks('These are the first 5 results that the algorithm selected.', 35) |
|
|
|
print("\n\n{}\n".format(end_line), file=print_pointer, flush=True) |
|
|
|
print(escpos['paperfeed_1l'], file=print_pointer, flush=True) |
|
|
@ -113,16 +111,13 @@ def printNow(query, results): |
|
|
|
print(escpos['papercut'], file=print_pointer, flush=True) |
|
|
|
print(escpos['reset'], file=print_pointer, flush=True) |
|
|
|
|
|
|
|
# reset when all results are printed |
|
|
|
if printed == False: |
|
|
|
results_count = 0 |
|
|
|
# printNow(query, results, results_count) |
|
|
|
|
|
|
|
except: |
|
|
|
# print('test') |
|
|
|
e = sys.exc_info()[0] |
|
|
|
print("Could not print: {}".format(e)) |
|
|
|
|
|
|
|
# query = 'noise' |
|
|
|
# results, _, _ = readings.request_results(query) |
|
|
|
# pprint(results) |
|
|
|
# printNow(query, results, 0) |
|
|
|
# printNow(query, results) |