31 lines
721 B
Python
Executable file
31 lines
721 B
Python
Executable file
#!/usr/bin/python3 -u
|
|
import json
|
|
import time
|
|
from datetime import timedelta
|
|
|
|
import Display
|
|
import SingleDisplay
|
|
|
|
CONFIG_PATH = '/home/michel/.config/polybar/scripts/storage/config.json'
|
|
REFRESH_INTERVAL: timedelta = timedelta(seconds=1)
|
|
|
|
|
|
def main():
|
|
with open(CONFIG_PATH) as config:
|
|
drives = json.load(config)
|
|
|
|
isRunning = True
|
|
|
|
currentDisplay: Display = SingleDisplay.SingleDisplay(drives)
|
|
while isRunning:
|
|
start = time.time()
|
|
|
|
renderedText = currentDisplay.render(REFRESH_INTERVAL)
|
|
print(" " + renderedText)
|
|
|
|
duration: float = time.time() - start
|
|
time.sleep(max(REFRESH_INTERVAL.total_seconds() - duration, 0))
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|