0

Right now, my company has about 40 information boards scattered throughout the buildings with information relevant to each area. Each unit is a small linux based device that is programmed to launch an RDP session, log in with a user name and password, and pull up the appropriate powerpoint and start playing. The boards would go down every 4 hours for about 5 minutes, copy over a new version of a presentation (if applicable) and restart.

We now have "demands" for live data. Unfortunately I believe powerpoint will no longer be an option as we used the Powerpoint viewer, which does not support plugins. I wanted to use Google Slides, but also have the restriction that we cannot have a public facing service like Google Drive, so there goes that idea.

I was thinking of some kind of way to launch a web browser and have it rotate through a list of specified webpages (perhaps stored in a txt or csv file). I found a way to launch Firefox and have it autologin to OBIEE via python:

#source: http://obitool.blogspot.com/2012/12/automatic-login-script-for-obiee-11g_12.html

import unittest
from selenium import webdriver
from selenium.webdriver.firefox.firefox_profile import FirefoxProfile


# Hardcoding this information is usually not a good Idea!
user       = ''   # Put your user name here
password   = ''   # Put your password here
serverName = ''   # Put Host name here


class OBIEE11G(unittest.TestCase):

    def setUp(self):

        # Create a new profile
        self.fp = webdriver.FirefoxProfile()
        self.fp.set_preference("browser.download.folderList",2)
        self.fp.set_preference("browser.download.manager.showWhenStarting",False)

        # Associate the profile with the Firefox selenium session
        self.driver   = webdriver.Firefox(firefox_profile=self.fp)
        self.driver.implicitly_wait(2)

        # Build the Analytics url and save it for the future
        self.base_url = "http://" + serverName + ":9704/analytics"

def login(self):

        # Retreive the driver variables created in setup
        driver = self.driver

        # Goto the loging page
        driver.get(self.base_url + "/")

        # The 11G login Page has following elements on it
        driver.find_element_by_id("sawlogonuser").clear()
        driver.find_element_by_id("sawlogonuser").send_keys(user)
        driver.find_element_by_id("sawlogonpwd").clear()
        driver.find_element_by_id("sawlogonpwd").send_keys(password)
        driver.find_element_by_id("idlogon").click()


    def test_OBIEE11G(self):
        self.login()

#
if __name__ == "__main__":
    unittest.main()

If I can use this, I would just need a way to rotate to a new webpage every 30 seconds. Any ideas / recommendations?

1 Answers1

0

You could put a simple javascript snippet on each page that waits a specified time then redirects to the new page. This has the advantage of simple implementation, however it may be annoying to maintain this over many html files.

The other option is to write your copy in a markdown file, then have a single html page that rotates through a list of files and renders and displays the markdown. You would then update the data by rewriting the markdown files. It wouldn't be exactly live, but if 30 second resolution is ok you can get away with it. Something like this for the client code:

HTML

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Message Board</title>
    <link rel="stylesheet" type="text/css" href="/css/style.css">
  </head>
  <body>
    <div id="content" class="container"></div>
    <!-- jQuery -->
    <script src="//code.jquery.com/jquery-2.1.4.min.js" defer></script>

    <!-- markdown compiler https://github.com/chjj/marked/ -->
    <script src="/js/marked.min.js" defer></script>

    <script src="/js/main.js" defer></script>
  </body>
</html>

And the javascript

// main.js
// the markdown files
var sites = ["http://mysites.com/site1.md", "http://mysites.com/site2.md", "http://mysites.com/site3.md", "http://mysites.com/site4.md"]

function render(sites) {
    window.scrollTo(0,0);

    //get first element and rotate list of sites
    var file = sites.shift();
    sites.push(file);

    $.ajax({
        url:file,
        success: function(data) { $("#content").html(marked(data)); },
        cache: false
    });

    setTimeout(render(sites), 30000);
}

// start the loop
render(sites);

You can then use any method you would like to write out the markdown files.

Danny Dyla
  • 631
  • 4
  • 15