Added RoutineRunner class
This commit is contained in:
14
slideshow.py
14
slideshow.py
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
from time import sleep
|
from time import sleep
|
||||||
|
import subprocess
|
||||||
|
|
||||||
from gui import GUI_PyGame as GuiModule
|
from gui import GUI_PyGame as GuiModule
|
||||||
|
|
||||||
@@ -19,10 +20,23 @@ directory = "2015-06-18"
|
|||||||
# Display time for slideshow pictures
|
# Display time for slideshow pictures
|
||||||
display_time = 3
|
display_time = 3
|
||||||
|
|
||||||
|
# Waiting time between synchronizations
|
||||||
|
sync_time = 60
|
||||||
|
|
||||||
###############
|
###############
|
||||||
### Classes ###
|
### 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:
|
class Slideshow:
|
||||||
def __init__(self, display_size, display_time, directory, recursive=True):
|
def __init__(self, display_size, display_time, directory, recursive=True):
|
||||||
self.directory = directory
|
self.directory = directory
|
||||||
|
|||||||
Reference in New Issue
Block a user