diff --git a/py3status/modules/file_status.py b/py3status/modules/file_status.py index 5d15b09b0d..3a53bc3583 100644 --- a/py3status/modules/file_status.py +++ b/py3status/modules/file_status.py @@ -149,12 +149,16 @@ def file_status(self): if self.thresholds: self.py3.threshold_get_color(count_path, 'path') + self.py3.threshold_get_color(count_path, 'paths') return { - 'cached_until': self.py3.time_in(self.cache_timeout), - 'full_text': self.py3.safe_format( + 'cached_until': + self.py3.time_in(self.cache_timeout), + 'full_text': + self.py3.safe_format( self.format, { 'path': count_path, + 'paths': count_path, 'format_path': format_path } ) diff --git a/py3status/modules/vnstat.py b/py3status/modules/vnstat.py index de7f9d061e..60e63eb45f 100644 --- a/py3status/modules/vnstat.py +++ b/py3status/modules/vnstat.py @@ -44,6 +44,7 @@ """ from __future__ import division # python2 compatibility + STRING_ERROR = 'vnstat: returned wrong' STRING_NOT_INSTALLED = 'not installed' @@ -73,10 +74,16 @@ def post_config_hook(self): if not self.py3.check_commands('vnstat'): raise Exception(STRING_NOT_INSTALLED) - self.value_format = "{value:%s.%sf} {unit}" % (self.left_align, self.precision) + self.value_format = "{value:%s.%sf} {unit}" % (self.left_align, + self.precision) # list of units, first one - value/initial_multi, second - value/1024, # third - value/1024^2, etc... - self.units = ["kb", "mb", "gb", "tb", ] + self.units = [ + "kb", + "mb", + "gb", + "tb", + ] def _divide_and_format(self, value): # Divide a value and return formatted string @@ -91,12 +98,15 @@ def _divide_and_format(self, value): def vntstat(self): def filter_stat(): # Get statistics in list of lists of words - out = self.py3.command_output(["vnstat", "--exportdb"]).splitlines() + out = self.py3.command_output(["vnstat", + "--exportdb"]).splitlines() for x in out: if x.startswith("{};0;".format(self.statistics_type)): return x + try: - type, number, ts, rxm, txm, rxk, txk, fill = filter_stat().split(";") + type, number, ts, rxm, txm, rxk, txk, fill = filter_stat().split( + ";") except: return { 'cached_until': self.py3.time_in(self.cache_timeout), @@ -108,7 +118,12 @@ def filter_stat(): up = (int(txm) * 1024 + int(txk)) * 1024 down = (int(rxm) * 1024 + int(rxk)) * 1024 - stat = {"up": up, "down": down, "total": up + down} + stat = { + "up": up, + "down": down, + "total": up + down, + "estimated": int(fill) * 1024 + } keys = list(self.coloring.keys()) keys.sort() @@ -120,9 +135,11 @@ def filter_stat(): response['full_text'] = self.py3.safe_format( self.format, - dict(total=self._divide_and_format(stat['total']), - up=self._divide_and_format(stat['up']), - down=self._divide_and_format(stat['down']))) + dict( + total=self._divide_and_format(stat['total']), + up=self._divide_and_format(stat['up']), + down=self._divide_and_format(stat['down']), + estimated=self._divide_and_format(stat['estimated']))) return response