Fixed Syncplay Public Server not working whatsoever

This commit is contained in:
Uriziel 2014-07-29 21:53:23 +02:00
parent 9fdb8d080d
commit 1db7e0e095
1 changed files with 10 additions and 12 deletions

View File

@ -5,13 +5,11 @@ import syncplay
from syncplay.protocols import SyncServerProtocol from syncplay.protocols import SyncServerProtocol
import time import time
from syncplay import constants from syncplay import constants
import threading
from syncplay.messages import getMessage from syncplay.messages import getMessage
import codecs import codecs
import os import os
from string import Template from string import Template
import argparse import argparse
from pprint import pprint
class SyncFactory(Factory): class SyncFactory(Factory):
def __init__(self, password='', motdFilePath=None, isolateRooms=False): def __init__(self, password='', motdFilePath=None, isolateRooms=False):
@ -160,13 +158,13 @@ class PublicRoomManager(RoomManager):
self.broadcastRoom(sender, what) self.broadcastRoom(sender, what)
def getAllWatchersForUser(self, sender): def getAllWatchersForUser(self, sender):
room = sender.getRoom().getWatchers() return sender.getRoom().getWatchers()
def moveWatcher(self, watcher, room): def moveWatcher(self, watcher, room):
oldRoom = watcher.room oldRoom = watcher.getRoom()
l = lambda w: w.sendSetting(watcher.getName(), oldRoom, None, {"left": True}) l = lambda w: w.sendSetting(watcher.getName(), oldRoom, None, {"left": True})
self.broadcast(watcher, l) self.broadcast(watcher, l)
RoomManager.watcherSetRoom(self, watcher, room) RoomManager.moveWatcher(self, watcher, room)
watcher.setFile(watcher.getFile()) watcher.setFile(watcher.getFile())
@ -243,9 +241,9 @@ class Watcher(object):
self._connector.setWatcher(self) self._connector.setWatcher(self)
reactor.callLater(0.1, self._scheduleSendState) reactor.callLater(0.1, self._scheduleSendState)
def setFile(self, file): def setFile(self, file_):
self._file = file self._file = file_
self._server.sendFileUpdate(self, file) self._server.sendFileUpdate(self, file_)
def setRoom(self, room): def setRoom(self, room):
self._room = room self._room = room
@ -331,10 +329,10 @@ class Watcher(object):
class ConfigurationGetter(object): class ConfigurationGetter(object):
def getConfiguration(self): def getConfiguration(self):
self._prepareArgParser() self._prepareArgParser()
self._args = self._argparser.parse_args() args = self._argparser.parse_args()
if self._args.port == None: if args.port is None:
self._args.port = constants.DEFAULT_PORT args.port = constants.DEFAULT_PORT
return self._args return args
def _prepareArgParser(self): def _prepareArgParser(self):
self._argparser = argparse.ArgumentParser(description=getMessage("server-argument-description"), self._argparser = argparse.ArgumentParser(description=getMessage("server-argument-description"),