"Teilnehmer verlässt Raum" hinzu
This commit is contained in:
parent
46f6df8e2f
commit
b9f5dcdcb6
35
jitsi-log.py
35
jitsi-log.py
|
@ -48,6 +48,10 @@ owner = re.compile(owner_regex)
|
||||||
member_regex = r"^Member\s(.*)@(.*)\/(.*)\sjoined."
|
member_regex = r"^Member\s(.*)@(.*)\/(.*)\sjoined."
|
||||||
member = re.compile(member_regex)
|
member = re.compile(member_regex)
|
||||||
|
|
||||||
|
# remove/leaving member
|
||||||
|
leaving_regex = r"^Member\s(.*)@(.*)\/(.*)\sis\sleaving"
|
||||||
|
leaving = re.compile(leaving_regex)
|
||||||
|
|
||||||
|
|
||||||
class MeetingRoom():
|
class MeetingRoom():
|
||||||
"""
|
"""
|
||||||
|
@ -79,6 +83,7 @@ class MeetingRoom():
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return '{}: {}'.format(self.jid, self.owner)
|
return '{}: {}'.format(self.jid, self.owner)
|
||||||
|
|
||||||
|
|
||||||
class logThread(threading.Thread):
|
class logThread(threading.Thread):
|
||||||
def __init__(self, threadID, name, filename):
|
def __init__(self, threadID, name, filename):
|
||||||
threading.Thread.__init__(self)
|
threading.Thread.__init__(self)
|
||||||
|
@ -89,7 +94,6 @@ class logThread(threading.Thread):
|
||||||
def run(self):
|
def run(self):
|
||||||
while True:
|
while True:
|
||||||
getLogMsg(self.filename)
|
getLogMsg(self.filename)
|
||||||
sleep(5)
|
|
||||||
|
|
||||||
|
|
||||||
class MyServer(BaseHTTPRequestHandler):
|
class MyServer(BaseHTTPRequestHandler):
|
||||||
|
@ -169,7 +173,7 @@ def process_line(line):
|
||||||
if new_room:
|
if new_room:
|
||||||
room_name = getRoomName(new_room.group(2))
|
room_name = getRoomName(new_room.group(2))
|
||||||
room_date = mkDatetime(erg.group(2), erg.group(3))
|
room_date = mkDatetime(erg.group(2), erg.group(3))
|
||||||
print('{} {}'.format(room_date, room_name))
|
print('{} {} created'.format(room_date, room_name))
|
||||||
currentRoom = MeetingRoom(room_name, room_date)
|
currentRoom = MeetingRoom(room_name, room_date)
|
||||||
if room_name in roomList:
|
if room_name in roomList:
|
||||||
# delete old room and recreate it
|
# delete old room and recreate it
|
||||||
|
@ -183,14 +187,12 @@ def process_line(line):
|
||||||
room_name = disposed_room.group(1)
|
room_name = disposed_room.group(1)
|
||||||
print('-> room disposed: {}'.format(room_name))
|
print('-> room disposed: {}'.format(room_name))
|
||||||
if room_name in roomList:
|
if room_name in roomList:
|
||||||
|
|
||||||
del roomList[room_name]
|
del roomList[room_name]
|
||||||
|
|
||||||
owner_match = owner.match(erg.group(7))
|
owner_match = owner.match(erg.group(7))
|
||||||
if owner_match:
|
if owner_match:
|
||||||
room_name = owner_match.group(1).strip()
|
room_name = owner_match.group(1).strip()
|
||||||
room_owner = owner_match.group(3).strip()
|
room_owner = owner_match.group(3).strip()
|
||||||
# print('{}: {}'.format(room_name, room_owner))
|
|
||||||
if room_name in roomList:
|
if room_name in roomList:
|
||||||
roomList[room_name].setOwner(room_owner)
|
roomList[room_name].setOwner(room_owner)
|
||||||
|
|
||||||
|
@ -198,10 +200,19 @@ def process_line(line):
|
||||||
if member_match:
|
if member_match:
|
||||||
room_name = member_match.group(1).strip()
|
room_name = member_match.group(1).strip()
|
||||||
room_member = member_match.group(3).strip()
|
room_member = member_match.group(3).strip()
|
||||||
print('--> {}: {}'.format(room_name, room_member))
|
print('{} enters {}'.format(room_member, room_name))
|
||||||
if room_name in roomList:
|
if room_name in roomList:
|
||||||
roomList[room_name].addMember(room_member)
|
roomList[room_name].addMember(room_member)
|
||||||
|
|
||||||
|
# participant is leaving a the room
|
||||||
|
leaving_match = leaving.match(erg.group(7))
|
||||||
|
if leaving_match:
|
||||||
|
room_name = member_match.group(1).strip()
|
||||||
|
room_member = member_match.group(3).strip()
|
||||||
|
print('{} leaves {}'.format(room_member, room_name))
|
||||||
|
if room_name in roomList:
|
||||||
|
roomList[room_name].delMember(room_member)
|
||||||
|
|
||||||
|
|
||||||
def getLogMsg(logfile):
|
def getLogMsg(logfile):
|
||||||
"""
|
"""
|
||||||
|
@ -224,9 +235,9 @@ if __name__ == '__main__':
|
||||||
parser.add_argument('--verbose', '-v',
|
parser.add_argument('--verbose', '-v',
|
||||||
help='be verbose eg. for debugging',
|
help='be verbose eg. for debugging',
|
||||||
action='store_true')
|
action='store_true')
|
||||||
parser.add_argument('--logwatch', '-w',
|
parser.add_argument('--port', '-p',
|
||||||
help='run as logwatch module, ' +
|
help='set the http server port',
|
||||||
' dont start the webserver and only run once')
|
default=9999)
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
@ -234,11 +245,11 @@ if __name__ == '__main__':
|
||||||
try:
|
try:
|
||||||
loggerThread = logThread(1, "Thread-Logger", args.log)
|
loggerThread = logThread(1, "Thread-Logger", args.log)
|
||||||
loggerThread.start()
|
loggerThread.start()
|
||||||
except:
|
except Exception as e:
|
||||||
print('Error: unable to start threads')
|
print('Error: unable to start threads {}'.format(e))
|
||||||
|
|
||||||
hostName = 'localhost'
|
hostName = 'localhost'
|
||||||
serverPort = 9999
|
serverPort = args.port
|
||||||
webServer = HTTPServer((hostName, serverPort), MyServer)
|
webServer = HTTPServer((hostName, serverPort), MyServer)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue