diff options
author | Britney Fransen <brfransen@gmail.com> | 2018-01-16 18:22:01 (GMT) |
---|---|---|
committer | Britney Fransen <brfransen@gmail.com> | 2018-01-16 18:22:01 (GMT) |
commit | d3bcf5aad566eddc2514d84c148ed1f7d0ee4033 (patch) | |
tree | 43be3409193b0d3f008e811b84f2f64e9e470f86 /abs/core/supplemental-web | |
parent | 9b78781d4221bc00563906f7d972e1370a0ef6b1 (diff) | |
download | linhes_pkgbuild-d3bcf5aad566eddc2514d84c148ed1f7d0ee4033.zip linhes_pkgbuild-d3bcf5aad566eddc2514d84c148ed1f7d0ee4033.tar.gz linhes_pkgbuild-d3bcf5aad566eddc2514d84c148ed1f7d0ee4033.tar.bz2 |
supplemental-web: fe_status.py: change get frontend method and add IP address
Diffstat (limited to 'abs/core/supplemental-web')
-rw-r--r-- | abs/core/supplemental-web/PKGBUILD | 4 | ||||
-rw-r--r-- | abs/core/supplemental-web/contents/fe_status.py | 39 |
2 files changed, 23 insertions, 20 deletions
diff --git a/abs/core/supplemental-web/PKGBUILD b/abs/core/supplemental-web/PKGBUILD index ea70a2e..4fcef9e 100644 --- a/abs/core/supplemental-web/PKGBUILD +++ b/abs/core/supplemental-web/PKGBUILD @@ -1,7 +1,7 @@ pkgbase=supplemental-web pkgname=('supplemental-web' 'supplemental-web-slave') -pkgver=8.4 -pkgrel=3 +pkgver=8.5 +pkgrel=1 arch=('i686' 'x86_64') license=('GPL') backup=('data/srv/httpd/cgi/extra.cfg.txt') diff --git a/abs/core/supplemental-web/contents/fe_status.py b/abs/core/supplemental-web/contents/fe_status.py index 993ef72..439d0c5 100644 --- a/abs/core/supplemental-web/contents/fe_status.py +++ b/abs/core/supplemental-web/contents/fe_status.py @@ -25,7 +25,8 @@ def parse_xml(frontend): tree = ET.parse(xml) root = tree.getroot() except: - msg(" Couldn't connect to %s" %frontend) + #msg(" Couldn't connect to %s" %frontend) + temp_dict['state'] = "offline" return temp_dict lst = root.find("State") @@ -51,23 +52,25 @@ def parse_xml(frontend): def mythfe_status(cursor,mythDB): - frontends=list(Frontend.fromUPNP()) status_dict={} - #try: + try: #frontends = mythDB.getFrontends() #use cursor instead so it doesn't test connection - #cursor.execute("select hostname from settings where value = 'FrontendIdleTimeout'") - #frontends=cursor.fetchall() - #except: - #msg("Excptions") - #return + cursor.execute("select distinct hostname from settings where hostname is not null;") + frontends=cursor.fetchall() + except: + #msg("Exceptions") + return for i in frontends: + i=''.join(i) try: - fe_hostname = socket.gethostbyaddr(i.host)[0] + fe_hostname = socket.gethostbyaddr(i)[0] except: - print "DNS lookup failed for %s" %i.host - fe_hostname = i.host - status_dict[fe_hostname] = parse_xml(i.host) + #print "DNS lookup failed for %s" %i + fe_hostname = socket.gethostbyname(i) + ip_addr = socket.gethostbyname(i) + fe_hostname = "%s (%s)" %(fe_hostname,ip_addr) + status_dict[fe_hostname] = parse_xml(ip_addr) return status_dict @@ -102,12 +105,12 @@ def print_html(status_dict): print "</table>" print '</div>' - print ''' - <div id="footer"> - </br> - <p>Offline systems are not listed</p> - </div> -''' +# print ''' +# <div id="footer"> +# </br> +# <p>Offline systems are not listed</p> +# </div> +#''' def main(): |