2 Simple Client Counter for VLC VLM
6 class ClientCounter(object):
13 return self.clients.get(id, (False,))[0]
15 def add(self, id, ip):
16 if self.clients.has_key(id):
17 self.clients[id][0] += 1
18 self.clients[id][1].append(ip)
20 self.clients[id] = [1, [ip]]
23 return self.clients[id][0]
25 def delete(self, id, ip):
26 if self.clients.has_key(id):
28 if self.clients[id][0] == 1:
32 self.clients[id][0] -= 1
33 self.clients[id][1].remove(ip)
37 print "Total:", self.total
38 return self.clients[id][0]