text reader

workspace
km0 3 years ago
parent 77493ddf0b
commit 63621f86eb

@ -53,7 +53,7 @@ class Soup(Bureau):
prn = self._get_small_printer() prn = self._get_small_printer()
for file in files: for file in files:
filename = os.path.basename(file) filename, ext = os.path.basename(file).split('.')
self.print_small(filename) self.print_small(filename)
prn.soft_barcode("code128", "SBtp." + filename) prn.soft_barcode("code128", "SBtp." + filename)
@ -61,7 +61,7 @@ class Soup(Bureau):
def print_preview(self, data): def print_preview(self, data):
filename, _ = data.split(".") filename, _ = data.split(".")
with open(os.path.join(self.mdir, 'contents', filename), 'r') as f: with open(os.path.join(self.mdir, 'contents', filename + '.txt'), 'r') as f:
text = f.read() text = f.read()
self.print_small(filename + '\n' + text[:200] + '...') self.print_small(filename + '\n' + text[:200] + '...')

Loading…
Cancel
Save