raspberry kiosk
authorBernhard Tittelbach <xro@realraum.at>
Wed, 17 Apr 2013 04:39:41 +0000 (04:39 +0000)
committerBernhard Tittelbach <xro@realraum.at>
Wed, 17 Apr 2013 04:39:41 +0000 (04:39 +0000)
documents/statuten/main.pdf
documents/statuten/main.tex
raspberry-kiosk/kiosk.css [new file with mode: 0644]
raspberry-kiosk/kiosk.html [new file with mode: 0644]
raspberry-kiosk/kiosk.js [new file with mode: 0644]
raspberry-kiosk/restart-kiosk [new file with mode: 0644]
raspberry-kiosk/start-kiosk.sh [new file with mode: 0644]

index 0315f6d..025c614 100644 (file)
Binary files a/documents/statuten/main.pdf and b/documents/statuten/main.pdf differ
index c976ad4..36825a8 100644 (file)
@@ -25,7 +25,7 @@
 %-------------------------PACKAGES-------------------------------
 
 % Load Babel language support
-\usepackage[austrian, german]{babel}
+\usepackage[austrian, ngerman]{babel}
 \usepackage[utf8]{inputenc}
 \usepackage{textcomp}
 \usepackage{amsmath}
diff --git a/raspberry-kiosk/kiosk.css b/raspberry-kiosk/kiosk.css
new file mode 100644 (file)
index 0000000..91e34b7
--- /dev/null
@@ -0,0 +1,173 @@
+
+body {
+  font-family: "Droid Sans", Helvetica, Arial, Sans;
+  color:black;
+  font-size:22px;
+  padding:0;
+  margin:0;
+  background-color: white;
+}
+
+div {
+  width: 100%;
+  padding: 0;
+}
+
+div#siteheader {
+  text-align: center;
+  font-size: 1.2em;
+  font-weight: bold;
+  color: white;
+  //background-color: #36373B;
+  background-color: rgb(118, 20, 7);
+  font-size:40px;
+  margin-top:10px;
+}
+
+img.headerphoto {
+  width:100%;
+  margin: -60px 0 0 0px;
+}
+
+div.headerphoto {
+  display:block;
+  width: 100%;
+  height: 350px;
+  overflow: hidden;
+  padding: 0.1em 0;
+  text-align: center;
+  margin-top:10px;
+}
+
+div.status {
+  display:block;
+  width: 98%;
+  margin-top:10px;
+  margin-left:auto;
+  margin-right:auto;
+}
+
+table.status {
+  width:571px;
+  display:inline;
+  margin-left: 0;
+  margin:right: 0;
+  margin-top:0;
+  margin-bottom:1ex;
+}
+
+p.anwesenheit_status {
+}
+
+td.anwesenheitsstatus {
+  height:100px;
+  text-align:center;
+  margin-left:105px;
+  margin-right:auto;
+  vertical-align:middle;
+  display:table-cell;
+  font-weight:bold;
+  font-size:30px;
+}
+
+p.topic {
+  width: 100%;
+  margin-bottom:1ex;
+  margin-top:0px;
+  margin-left:0px;
+  margin-right:0px;
+  font-weight: bold;
+  font-variant:small-caps;
+  font-size: 110%;
+  color: white;
+  text-align:center;
+  background-color: #36373B;
+}
+
+div.calendars {
+  display:block;
+  width: 100%;
+  height: 15em;
+  margin-top:10px;
+  margin-left:0px;
+  margin-right:0px;
+}
+
+div.calendar {
+  //width: 48%;
+  width: 99%;
+  height: 15em;
+  overflow: hidden;
+  border:1px solid #333;
+  margin-bottom:0ex;
+  margin-top:0ex;
+  margin-left:5px;
+  margin-right:5px;
+}
+
+div.sensorgraphs {
+  display:block;
+  text-align:center;
+  border:1px solid #333;
+  width:99%;
+  //height:35em;
+  padding-bottom:2px;
+  background-color:#fff;
+  margin-top:10px;
+  margin-bottom:10px;
+  margin-left:auto;
+  margin-right:auto;
+}
+
+div.sensorelem {
+  display:block;
+  width:571px;
+  margin-top:2px;
+  margin-bottom:0;
+  margin-left:auto;
+  margin-right:auto;
+}
+
+img.sensorimg {
+  margin:0;
+  padding:0;
+  border:0px none black;
+  width:571px;
+}
+
+div.even {
+  background-color: white;
+}
+
+div.odd {
+  background-color: #E0E0E0;
+}
+
+div#dateclock {
+  text-align: center;
+  font-size: 1.2em;
+  font-weight: bold;
+  color: white;
+  background-color: #36373B;
+  font-size:48px;
+}
+
+span.start,span.end,span.showname {
+  font-weight: bold;
+  margin: 0.1em 0.22em;
+}
+
+span.start,span.end {
+  font-size: 0.75em;
+  margin-left: 1em;
+  margin-right: 1em;
+}
+
+span.start {
+  float: left;
+}
+
+span.end {
+  float: right;
+}
+
diff --git a/raspberry-kiosk/kiosk.html b/raspberry-kiosk/kiosk.html
new file mode 100644 (file)
index 0000000..8a5b0e2
--- /dev/null
@@ -0,0 +1,48 @@
+<html>
+  <head>
+  <meta charset="utf-8">
+  <title>Realraum Kiosk Seite</title>
+  <script src="/jquery.min.js"></script>
+  <!--script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script-->
+  <script type="text/javascript" src="kiosk.js"></script>
+  <link rel="stylesheet" href="kiosk.css" type="text/css" />
+ </head>
+ <body>
+  <div id="dateclock"></div>
+  <div id="siteheader"><span style="font-size:110%;">realraum</span> - Verein für Technik &amp; Kultur</div>
+  <div id="headerphoto" class="headerphoto">
+  <img class="headerphoto" src="http://realraum.at/wiki/lib/exe/fetch.php?media=xro:realraum_hdr.jpg"></img>
+  </div>
+  <div class="calendars">
+   <div class="calendar" style="float:left;">
+    <p class="topic">Upcoming Events</p>
+    <div id="grical_upcoming">Loading calendar ...</div>
+   </div>
+   <!--div class="calendar" style="float:right;">
+    <p class="topic">Previous Events</p>
+    <div id="grical_previous">Loading Old Events ...</div>
+   </div-->
+  </div>
+  <!-- Door and Presence Status ------------------------ -->
+  <br/>
+   <!-- Sensor Data ------------------------ -->
+  <div class="sensorgraphs">
+    <p class="topic">Sensor Data</p>
+    <div class="sensorelem">
+    <table class="status" style="">
+    <tr><td id="anwesenheit_status" style="height:100px; border:0px none black;">Loading ...</td></tr>
+    <tr><td id="sensor_status" style="border:1px solid black; margin-top:5px;">Loading ...</td></tr>
+    </table>
+    </div>
+    <!--div class="sensorelem">
+     <img id="tempsensor" class="sensorimg" src="http://realraum.at/get_sensor.php?sensor=temp"/>
+    </div-->
+    <div class="sensorelem">
+      <img id="lightsensor" class="sensorimg" src="http://realraum.at/get_sensor.php?sensor=light"/>
+    </div>
+    <div class="sensorelem">
+      <img id="movementsensor" class="sensorimg" src="http://realraum.at/get_sensor.php?sensor=movement"/>
+    </div>
+  </div>
+</body>
+</html>
diff --git a/raspberry-kiosk/kiosk.js b/raspberry-kiosk/kiosk.js
new file mode 100644 (file)
index 0000000..15fe505
--- /dev/null
@@ -0,0 +1,163 @@
+
+function writeCalendar(data, elem)
+{
+    var calhtml = "";
+    for (var s=0; s<data.length; s++)
+    {
+      var when = "";
+      var dt = Date.parse(data[s].start+'T'+data[s].starttime);
+      if (Date.now() > dt)
+      {
+        when = "JETZT";
+      }
+      else
+      {
+        var stime = data[s].starttime;
+        while (stime.substring(stime.length-3,stime.length) == ":00")
+        {
+          stime=stime.substring(0,stime.length-3);
+        }
+        when = data[s].start +", "+stime+" Uhr";
+      }
+      calhtml += '<li class="level1"><div class="li">'+when+' - <a href="'+data[s].url+'" class="urlextern" title="'+data[s].title+'"  rel="nofollow">'+data[s].title+'</a></div></li>'+"\n";
+    }
+    elem.innerHTML='<ul>'+calhtml+'</ul>';
+}
+function loadCalendar()
+{
+  //old URI: //grical.realraum.at/s/?query=!realraum&limit=9&view=json
+  var calcontainer=document.getElementById("grical_upcoming");
+  calcontainer.innerHTML="Calendar loading ...<br/>please wait a second or two";
+  $.getJSON('/shmcache/grical_realraum.json', function(data){
+    writeCalendar(data, calcontainer);
+  });
+}
+
+function writeAnwesenheitStatus(data)
+{
+  var html="";
+  var sensorshtml="";
+  var sensorstd="";
+  if (data.open)
+  {
+   iconuri=data.icon.open;
+   statuscolor="lime";
+  }
+  else
+  {
+   iconuri=data.icon.closed;
+   statuscolor="red";
+  }
+  html='<table border="0" cellpadding="0" cellspacing="0" width="100%" height="100"><tr><td style="width:100px;"><img style="float:left;" src="'+iconuri+'" height="100" width="100"/></td><td style="width:4px;"></td><td class="anwesenheitsstatus" style="background-color:'+statuscolor+'; ">'+data.status+'</td></tr></table>';
+  document.getElementById('anwesenheit_status').innerHTML=html;
+
+  if (data.sensors)
+  {
+    for (var s=0; s<data.sensors.length;s++)
+    {
+      $.each( data.sensors[s], function(stype, std){
+        $.each( std, function(swhere, svalue){
+           sensorstd+='<td style="background-color:white; height:42px; text-align:center; vertical-align:middle; display:table-cell;"><b>'+stype+'</b><br/>'+swhere+': '+svalue+'</td>';
+        });
+      });
+    }
+  }
+  if (sensorstd != "")
+  {
+    sensorshtml='<table border="0" cellpadding="0" cellspacing="0" width="100%"><tr>'+sensorstd+'</tr></table>';
+    document.getElementById('sensor_status').innerHTML=sensorshtml;
+  }
+}
+
+function updateAnwesenheitStatus()
+{
+ //var req = new XMLHttpRequest();
+ url = "/status.json";
+ //req.open("GET", url ,false);
+ //google chrome workaround
+ //req.setRequestHeader("googlechromefix","");
+ //req.send(null);
+ var jqxhr = $.getJSON(url, writeAnwesenheitStatus);
+}
+var anwesenheit_timer = window.setInterval("updateAnwesenheitStatus()", 10000);
+
+function updateSensors()
+{
+  //reloadImg(document.getElementById("tempsensor"));
+  reloadImg(document.getElementById("movementsensor"));
+  reloadImg(document.getElementById("lightsensor"));
+}
+
+var timer;
+var seconds = 0;
+var schedule = Array()
+
+$(document).ready(function()
+{
+  updateDateClock(new Date());
+  setInterval("clock()", 500);
+  updateAnwesenheitStatus();
+  loadCalendar();
+  setInterval("updateAnwesenheitStatus()", 10000);
+  setInterval("loadCalendar()", 100000);
+  setInterval("updateSensors()", 50000);
+});
+
+function updateDateClock(now)
+{
+  var daynames = new Array('So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa');
+  var datetimestr = daynames[now.getDay()];
+  datetimestr += ' ' + now.getDate();
+  datetimestr += '.' + (now.getMonth() + 1);
+  datetimestr += '.' + now.getFullYear();
+  datetimestr += (now.getHours() > 9 ? ' ' : ' 0') + now.getHours();
+  datetimestr += (now.getMinutes() > 9 ? ':' : ':0') + now.getMinutes();
+  datetimestr += (now.getSeconds() > 9 ? ':' : ':0') + now.getSeconds();
+  $('#dateclock').html(datetimestr);
+}
+
+function highlightEntry(idx, color, value)
+{
+  if(value == 0) {
+    if(idx%2 == 0)
+      $('#upnext' + idx).css('background-color', 'white');
+    else 
+      $('#upnext' + idx).css('background-color', '#E0E0E0');
+  } else {
+    $('#upnext' + idx).css('background-color', color);
+  }
+}
+
+
+function clock(now)
+{
+  var now = new Date(new Date().valueOf() + 300);
+  updateDateClock(now);
+  seconds++;
+  if(seconds >= 20) {
+    seconds = 0;
+  }
+}
+
+//function updateSchedule()
+//{
+//  $.ajax({type: "GET", url: "/export/schedules.php", data: "days=3&start=-1", dataType: "xml", error: showError, success: parseXml});
+//}
+
+function showError(XMLHttpRequest, textStatus, errorThrown)
+{
+  alert("Error: " + textStatus);
+}
+
+function reloadImg(element)
+{
+    //var image = document.getElementById("theText");
+    if(element.complete) {
+        var new_image = new Image();
+        //set up the new image
+        new_image.id = element.id;
+        new_image.src = element.src;
+        element.parentNode.insertBefore(new_image,element);
+        element.parentNode.removeChild(element);
+    }
+}
diff --git a/raspberry-kiosk/restart-kiosk b/raspberry-kiosk/restart-kiosk
new file mode 100644 (file)
index 0000000..cb6f3fb
--- /dev/null
@@ -0,0 +1,4 @@
+# cron.d/restart-kiosk - restart midori and unclutter (memory gets filled up...)
+#
+42 4 * * 1 pi /usr/local/bin/start-kiosk.sh
+10 19 * * 5 pi /usr/local/bin/start-kiosk.sh
diff --git a/raspberry-kiosk/start-kiosk.sh b/raspberry-kiosk/start-kiosk.sh
new file mode 100644 (file)
index 0000000..475ceff
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/sh
+KIOSKURI="http://www.realraum.at/kiosk.html"
+#KIOSKURI="http://grical.realraum.at"
+#KIOSKURI="http://radi-o-matic.helsinki.at/nextshows/index.php?len=11"
+sleep 1
+
+killall midori 2> /dev/null
+killall unclutter 2> /dev/null
+killall chromium 2> /dev/null
+
+sleep 5
+export DISPLAY=:0.0
+
+xset dpms 0 0 0
+xset dpms force on
+xset s off
+xset s noblank
+
+unclutter &
+#midori -e Fullscreen -a "$KIOSKURI"
+chromium --kiosk --incognito "$KIOSKURI"
+
+exit 0