Plugin icecast2_all: fix code style issues reported by flake8
This commit is contained in:
parent
ab3a583756
commit
8b24b64960
|
@ -1,5 +1,15 @@
|
|||
#! /usr/bin/python
|
||||
# -*- coding: iso-8859-1 -*-
|
||||
"""
|
||||
This plugin shows the statistics of every source currently connected to the Icecast2 server.
|
||||
See the Icecast2_ plugin for specific mountpoint plugin.
|
||||
"""
|
||||
|
||||
|
||||
import sys
|
||||
import urllib2
|
||||
from xml.dom import minidom
|
||||
|
||||
|
||||
# Hostname of Icecast server
|
||||
# Just canonical name, no http:// nor ending /
|
||||
|
@ -9,10 +19,6 @@ username = "admin"
|
|||
password = ""
|
||||
realm = "Icecast2 Server"
|
||||
|
||||
# This plugin shows the statistics of every source currently connected to the Icecast2 server. See the Icecast2_ plugin for specific mountpoint plugin.
|
||||
|
||||
import urllib2, os.path, time, sys
|
||||
from xml.dom import minidom
|
||||
|
||||
def hent_XML():
|
||||
auth_handler = urllib2.HTTPBasicAuthHandler()
|
||||
|
@ -29,41 +35,41 @@ def hent_XML():
|
|||
xmldoc = minidom.parseString(xml)
|
||||
xmldoc = xmldoc.firstChild
|
||||
|
||||
#Totalt antall lyttere
|
||||
# Totalt antall lyttere
|
||||
total_lyttere = xmldoc.getElementsByTagName("clients")[0].firstChild.nodeValue
|
||||
#Totalt antall kilder
|
||||
# Totalt antall kilder
|
||||
total_kilder = xmldoc.getElementsByTagName("sources")[0].firstChild.nodeValue
|
||||
#Status for enkelt strøm
|
||||
# Status for enkelt strøm
|
||||
sources = xmldoc.getElementsByTagName("source")
|
||||
sourcelist = {}
|
||||
for source in sources:
|
||||
mount = source.getAttribute("mount")
|
||||
listeners = source.getElementsByTagName("listeners")[0].firstChild.nodeValue
|
||||
name = source.getElementsByTagName("server_name")[0].firstChild.nodeValue
|
||||
mount = mount.replace("-", "_").replace(".", "_")
|
||||
mount = mount.replace("-", "_").replace(".", "_")
|
||||
sourcelist[mount[1:]] = (listeners, name)
|
||||
|
||||
if len(sys.argv) > 0 and sys.argv[1] == "autoconf":
|
||||
print "yes"
|
||||
print "yes"
|
||||
elif len(sys.argv) == 1 or sys.argv[1] != "config":
|
||||
print "totallyttere.value %s" % total_lyttere
|
||||
print "totalkilder.value %s" % total_kilder
|
||||
sourcesort = sourcelist.keys()
|
||||
sourcesort.sort()
|
||||
sourcesort = sourcelist.keys()
|
||||
sourcesort.sort()
|
||||
for source in sourcesort:
|
||||
listeners, name = sourcelist[source]
|
||||
print "%s.value %s" % (source, listeners)
|
||||
elif sys.argv[1] == "config":
|
||||
print "graph_title Total number of listeners"
|
||||
print "graph_vlabel listeners"
|
||||
print "graph_category streaming"
|
||||
print "graph_category streaming"
|
||||
print "totallyttere.label Total number of listeners"
|
||||
print "totalkilder.label Totalt number of sources"
|
||||
sourcesort = sourcelist.keys()
|
||||
sourcesort.sort()
|
||||
for source in sourcesort:
|
||||
listeners, name = sourcelist[source]
|
||||
print "%s.label %s" % (source, "/" + source)
|
||||
sourcesort = sourcelist.keys()
|
||||
sourcesort.sort()
|
||||
for source in sourcesort:
|
||||
listeners, name = sourcelist[source]
|
||||
print "%s.label %s" % (source, "/" + source)
|
||||
else:
|
||||
print sys.argv[1]
|
||||
|
||||
|
|
|
@ -157,7 +157,6 @@ plugins/http/wget_page
|
|||
plugins/i2p/i2p_
|
||||
plugins/icecast/icecast_
|
||||
plugins/icecast/icecast2
|
||||
plugins/icecast/icecast2_all
|
||||
plugins/icecast/icecast2_stats_
|
||||
plugins/imapproxy/imapproxy_multi
|
||||
plugins/ip6/ip6_
|
||||
|
|
Loading…
Reference in New Issue