Skip to content

Commit

Permalink
Merge branch 'philippe' into 'master'
Browse files Browse the repository at this point in the history
Option to show server console

See merge request motion-pictures/blender/dccsync!4
  • Loading branch information
Celeborn2BeAlive committed Feb 18, 2020
2 parents 9624352 + 3490599 commit edabf66
Show file tree
Hide file tree
Showing 5 changed files with 240 additions and 178 deletions.
18 changes: 9 additions & 9 deletions broadcaster/dccBroadcaster.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def joinRoom(self, roomName):
with common.mutex:
room = rooms.get(roomName)
if room is None:
logging.info(f"Room {roomName} does not exist. Creating it.")
logging.info("Room %s does not exist. Creating it.", roomName)
room = Room(roomName)
rooms[roomName] = room
room.addClient(self)
Expand Down Expand Up @@ -88,7 +88,7 @@ def run(self):
break

if command is not None:
logging.info(f"client {self.address}: {command.type} received")
logging.info("client % s: % s: % s received", self.address[0], self.address[1], command.type)

if command.type == common.MessageType.JOIN_ROOM:
self.joinRoom(command.data.decode())
Expand Down Expand Up @@ -136,7 +136,7 @@ def close(self):
self.socket.close()
except Exception:
pass
logging.info(f"{self.address} closed")
logging.info("%s closed", self.address)


class Room:
Expand All @@ -146,7 +146,7 @@ def __init__(self, roomName):
self.commands = []

def addClient(self, client):
logging.info(f"Add Client {client.address} to Room {self.name}")
logging.info("Add Client % s to Room % s", client.address, self.name)
self.clients.append(client)
if len(self.clients) == 1:
command = common.Command(common.MessageType.CONTENT)
Expand All @@ -168,18 +168,18 @@ def close(self):
self.clients = []
with common.mutex:
del rooms[self.name]
logging.info(f'Room {self.name} deleted')
logging.info("Room % s deleted", self.name)

def clear(self):
self.commands = []

def removeClient(self, client):
logging.info(f"Remove Client {client.address} from Room {self.name}")
logging.info("Remove Client % s from Room % s", client.address, self.name)
self.clients.remove(client)
if len(self.clients) == 0:
with common.mutex:
del rooms[self.name]
logging.info(f'No more clients in room "{self.name}". Room deleted')
logging.info("No more clients in room \"%s\". Room deleted", self.name)

def mergeCommands(self, command):
commandType = command.type
Expand Down Expand Up @@ -210,11 +210,11 @@ def runServer():
connection.setblocking(0)
connection.listen(1000)

logging.info(f"Listening on port {common.DEFAULT_PORT}")
logging.info("Listening on port % s", common.DEFAULT_PORT)
while True:
try:
newConnection = connection.accept()
logging.info(f"New connection {newConnection[1]}")
logging.info("New connection %s", newConnection[1])
Connection(*newConnection)
except KeyboardInterrupt:
break
Expand Down
Loading

0 comments on commit edabf66

Please sign in to comment.