diff --git a/sdcard/rootfs/root/pwnagotchi/scripts/main.py b/sdcard/rootfs/root/pwnagotchi/scripts/main.py index a593353..60469e8 100755 --- a/sdcard/rootfs/root/pwnagotchi/scripts/main.py +++ b/sdcard/rootfs/root/pwnagotchi/scripts/main.py @@ -46,7 +46,7 @@ if args.do_clear: elif args.do_manual: logging.info("entering manual mode ...") - log = SessionParser(config['main']['log']) + log = SessionParser(config) logging.info( "the last session lasted %s (%d completed epochs, trained for %d), average reward:%s (min:%s max:%s)" % ( log.duration_human, diff --git a/sdcard/rootfs/root/pwnagotchi/scripts/pwnagotchi/locale/voice.pot b/sdcard/rootfs/root/pwnagotchi/scripts/pwnagotchi/locale/voice.pot index fbeba17..c11874e 100644 --- a/sdcard/rootfs/root/pwnagotchi/scripts/pwnagotchi/locale/voice.pot +++ b/sdcard/rootfs/root/pwnagotchi/scripts/pwnagotchi/locale/voice.pot @@ -186,3 +186,22 @@ msgid "" "{associated} new friends and ate {handshakes} handshakes! #pwnagotchi " "#pwnlog #pwnlife #hacktheplanet #skynet" msgstr "" + +msgid "hours" +msgstr "" + +msgid "hour" +msgstr "" + +msgid "minutes" +msgstr "" + +msgid "minute" +msgstr "" + +msgid "hours" +msgstr "" + +msgid "hour" +msgstr "" + diff --git a/sdcard/rootfs/root/pwnagotchi/scripts/pwnagotchi/log.py b/sdcard/rootfs/root/pwnagotchi/scripts/pwnagotchi/log.py index 8648521..c6a108f 100644 --- a/sdcard/rootfs/root/pwnagotchi/scripts/pwnagotchi/log.py +++ b/sdcard/rootfs/root/pwnagotchi/scripts/pwnagotchi/log.py @@ -1,10 +1,10 @@ -import os import hashlib import time import re import os from datetime import datetime +from pwnagotchi.voice import Voice from pwnagotchi.mesh.peer import Peer from file_read_backwards import FileReadBackwards @@ -125,17 +125,19 @@ class SessionParser(object): self.duration = '%02d:%02d:%02d' % (hours, mins, secs) self.duration_human = [] if hours > 0: - self.duration_human.append('%d hours' % hours) + self.duration_human.append('%d %s' % (hours, self.voice.custom('hours' if hours > 1 else 'hour'))) if mins > 0: - self.duration_human.append('%d minutes' % mins) + self.duration_human.append('%d %s' % (mins, self.voice.custom('minutes' if mins > 1 else 'minute'))) if secs > 0: - self.duration_human.append('%d seconds' % secs) + self.duration_human.append('%d %s' % (secs, self.voice.custom('seconds' if secs > 1 else 'second'))) self.duration_human = ', '.join(self.duration_human) self.avg_reward /= (self.epochs if self.epochs else 1) - def __init__(self, path='/var/log/pwnagotchi.log'): - self.path = path + def __init__(self, config): + self.config = config + self.voice = Voice(lang=config['main']['lang']) + self.path = config['main']['log'] self.last_session = None self.last_session_id = '' self.last_saved_session_id = ''