summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorolf <olf@subsignal.org>2015-03-15 13:28:41 +0100
committerolf <olf@subsignal.org>2015-03-15 13:28:41 +0100
commit2005fa3ae8e4745e97a9fc44a4f0ac259a21cc43 (patch)
treec2513b75b8d587e40c038921bb11a392ede245b7 /scripts
parent1d2281f57c70ff1f5378fd244cc99ecfe2b6caf0 (diff)
adapted status script
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/status_script.py25
1 files changed, 8 insertions, 17 deletions
diff --git a/scripts/status_script.py b/scripts/status_script.py
index a5595ac..1b30d01 100755
--- a/scripts/status_script.py
+++ b/scripts/status_script.py
@@ -64,26 +64,17 @@ def tweet(status, last_change):
else:
print "Message too long: " + tweet
-def update_css(colors):
+def update_css(statusimage):
css = '''
-span.sublabopen {
- color: %s;
-}
-
-span.sublabclosed {
- color: %s;
-}
-
#statusimage {
background: url(../img/%s) ;
- height: 100px;
- width: 100px;
- position: absolute;
- right: 20px;
+ height: 40px;
+ width: 40px;
+ margin: 5px;
}
-''' % colors
+''' % statusimage
path = os.path.realpath(os.path.dirname(__file__))
path = os.path.join(path, '..', 'public', 'css', 'sublab.status.css')
@@ -120,14 +111,14 @@ if __name__ == '__main__':
# check if status changed, if yes, update css and tweet it
if s.door_status() != old_status:
if s.door_status() == 'open':
- update_css(('#0f0', '#222', 'status-open.png'))
+ update_css('status-open.png')
save_statusfile(STATUSFILE, s.door_status())
tweet('open', last_change)
elif s.door_status() == 'closed':
save_statusfile(STATUSFILE, s.door_status())
- update_css(('#222', '#f00', 'status-closed.png'))
+ update_css('status-closed.png')
tweet('closed', last_change)
else:
save_statusfile(STATUSFILE, s.door_status())
- update_css(('#222', '#222', 'status-unknown.png'))
+ update_css('status-unknown.png')
tweet('unknown', last_change)