checkminidlna.py
· 598 B · Python
Raw
#!/usr/bin/python2.7
import urllib
def getInfo():
audio, video, image = urllib.urlopen("http://localhost:8200").read()[111:-22].split("<br>")
audiod = audio.split(" files: ")
videod = video.split(" files: ")
imaged = image.split(" files: ")
info = {audiod[0]: int(audiod[1]),
videod[0]: int(videod[1]),
imaged[0]: int(imaged[1])}
return info
def main():
info = getinfo()
print "MiniDLNA status"
print "Audio files:", str(info["Audio"])
print "Video files:", str(info["Video"])
print "Image files:", str(info["Image"])
if __name__ == "__main__":
main()
| 1 | #!/usr/bin/python2.7 |
| 2 | import urllib |
| 3 | |
| 4 | def getInfo(): |
| 5 | audio, video, image = urllib.urlopen("http://localhost:8200").read()[111:-22].split("<br>") |
| 6 | audiod = audio.split(" files: ") |
| 7 | videod = video.split(" files: ") |
| 8 | imaged = image.split(" files: ") |
| 9 | info = {audiod[0]: int(audiod[1]), |
| 10 | videod[0]: int(videod[1]), |
| 11 | imaged[0]: int(imaged[1])} |
| 12 | return info |
| 13 | |
| 14 | def main(): |
| 15 | info = getinfo() |
| 16 | print "MiniDLNA status" |
| 17 | print "Audio files:", str(info["Audio"]) |
| 18 | print "Video files:", str(info["Video"]) |
| 19 | print "Image files:", str(info["Image"]) |
| 20 | |
| 21 | if __name__ == "__main__": |
| 22 | main() |