From 72cb88e9ef3d29e598cd5bca3618c6422b3c9526 Mon Sep 17 00:00:00 2001 From: Balthasar Reuter Date: Thu, 18 Jun 2015 23:59:42 +0200 Subject: [PATCH] Added RoutineRunner class --- slideshow.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/slideshow.py b/slideshow.py index 14d608f..8baea27 100755 --- a/slideshow.py +++ b/slideshow.py @@ -3,6 +3,7 @@ import os from time import sleep +import subprocess from gui import GUI_PyGame as GuiModule @@ -19,10 +20,23 @@ directory = "2015-06-18" # Display time for slideshow pictures display_time = 3 +# Waiting time between synchronizations +sync_time = 60 + ############### ### Classes ### ############### +class RoutineRunner: + def __init__(self, cmd): + self.cmd = cmd + + def run(self, interval): + while True: + subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT) + sleep(interval) + + class Slideshow: def __init__(self, display_size, display_time, directory, recursive=True): self.directory = directory