Python 寻找自动滚动信息板的解决方案

Python 寻找自动滚动信息板的解决方案,python,firefox,powerpoint,television,Python,Firefox,Powerpoint,Television,现在,我的公司有大约40个信息板,分散在各个建筑物中,每个区域都有相关信息。每个单元都是一个基于linux的小型设备,通过编程可以启动RDP会话,使用用户名和密码登录,然后打开相应的powerpoint并开始播放。董事会将每4小时关闭约5分钟,复制新版本的演示文稿(如果适用),然后重新启动 我们现在对实时数据有“需求”。不幸的是,我相信powerpoint将不再是一个选项,因为我们使用了powerpoint viewer,它不支持插件。我想使用谷歌幻灯片,但也有一个限制,我们不能有一个面向公众的

现在,我的公司有大约40个信息板,分散在各个建筑物中,每个区域都有相关信息。每个单元都是一个基于linux的小型设备,通过编程可以启动RDP会话,使用用户名和密码登录,然后打开相应的powerpoint并开始播放。董事会将每4小时关闭约5分钟,复制新版本的演示文稿(如果适用),然后重新启动

我们现在对实时数据有“需求”。不幸的是,我相信powerpoint将不再是一个选项,因为我们使用了powerpoint viewer,它不支持插件。我想使用谷歌幻灯片,但也有一个限制,我们不能有一个面向公众的服务,如谷歌驱动器,所以有这样的想法

我在想一种方法来启动一个web浏览器,让它在指定的网页列表中旋转(可能存储在txt或csv文件中)。我找到了一种启动Firefox并通过python将其自动登录到OBIEE的方法:

#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()

如果我可以使用这个,我只需要一种方式,以旋转到一个新的网页每30秒。有什么想法/建议吗?

您可以在每个页面上放置一个简单的javascript片段,等待指定的时间,然后重定向到新页面。这具有实现简单的优点,但是在许多html文件上维护它可能会很烦人

另一个选项是将副本写入标记文件,然后使用一个html页面在文件列表中旋转,呈现并显示标记。然后通过重写标记文件来更新数据。它不会是真正的现场直播,但如果30秒的分辨率是可以的,你可以逃脱它。对于客户端代码,类似于以下内容:

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>
// 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);