Last active 1450319378

MiniDLNA status checker

checkminidlna.py Raw
1#!/usr/bin/python2.7
2import urllib
3
4def 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
14def 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
21if __name__ == "__main__":
22 main()