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 14:22:56 +0100
commitfc1beb22f4cb4ccbe1f620b8a98de44e250eded5 (patch)
tree2b7e2881a7bd96b88cefe0fcce84885bff79054b /scripts
parent5789d04d024e44aa28e7067eeb17c6c6abbc3660 (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)