Merge branch 'master' of github.com:Uriziel/syncplay
This commit is contained in:
commit
be5a461166
@ -157,5 +157,5 @@ You can report bugs through https://github.com/Uriziel/syncplay/issues but first
|
||||
You might also be able to discuss your problem through Internet Relay Chat (IRC). The #Syncplay channel is on the irc.rizon.net server.
|
||||
|
||||
### Known issues
|
||||
1. PROTIP: Don't change your system time while Syncplay is running as it confuses the sync. It is known.
|
||||
2. PROTIP: Don't try to jump less than 8 seconds as it won't register properly. It is known.
|
||||
1. Changing your system time while Syncplay is running confuses the sync. PROTIP: Don't do it.
|
||||
2. Syncplay cannot properly handle a seek that is within 8 seconds of the current position. PROTIP: Don't do it.
|
||||
@ -128,6 +128,12 @@ class MPCConfigurationGetter(ConfigurationGetter):
|
||||
if(os.path.isfile(self._args.mpc_path)):
|
||||
if(self._args.mpc_path[-10:] == 'mpc-hc.exe' or self._args.mpc_path[-12:] == 'mpc-hc64.exe'):
|
||||
return True
|
||||
if(os.path.isfile(self._args.mpc_path + "\\mpc-hc.exe")):
|
||||
self._args.mpc_path += "\\mpc-hc.exe"
|
||||
return True
|
||||
if(os.path.isfile(self._args.mpc_path + "\\mpc-hc64.exe")):
|
||||
self._args.mpc_path += "\\mpc-hc64.exe"
|
||||
return True
|
||||
return False
|
||||
|
||||
def _valuesToReadFromConfig(self, section_name):
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
version = '0.6.6'
|
||||
version = '0.7.0'
|
||||
milestone = 'Clara'
|
||||
projectURL = 'http://uriziel.github.com/syncplay/'
|
||||
@ -260,6 +260,8 @@ class SyncplayClientManager(object):
|
||||
reactor.run()
|
||||
|
||||
def stop(self, promptForAction = True):
|
||||
if(promptForAction):
|
||||
self.ui.promptFor("Press enter to exit\n")
|
||||
if not self.running:
|
||||
return
|
||||
self.running = False
|
||||
@ -270,8 +272,7 @@ class SyncplayClientManager(object):
|
||||
if self.player:
|
||||
self.player.drop()
|
||||
reactor.callLater(0.1, reactor.stop)
|
||||
if(promptForAction):
|
||||
self.ui.promptFor("Press enter to exit")
|
||||
|
||||
|
||||
def checkIfFileMatchesOthers(self):
|
||||
notMatchingList = self.users.getUsersWithNotMatchingFilenames()
|
||||
|
||||
@ -12,7 +12,7 @@ class MPCHCAPIPlayer(object):
|
||||
self.mpc_api.callbacks.on_mpc_closed = lambda: self.__syncplayClient.stop(False)
|
||||
self.mpc_api.callbacks.on_fileStateChange = lambda _: self.lockAsking()
|
||||
self.mpc_api.callbacks.on_update_playstate = lambda _: self.unlockAsking()
|
||||
self.preventAsking = False
|
||||
self.preventAsking = True
|
||||
self.askLock = threading.RLock()
|
||||
self.playerStateChangeLock = threading.RLock()
|
||||
|
||||
@ -27,24 +27,27 @@ class MPCHCAPIPlayer(object):
|
||||
|
||||
def set_speed(self, value):
|
||||
pass
|
||||
|
||||
def testMpcReady(self):
|
||||
try:
|
||||
self.playerStateChangeLock.acquire()
|
||||
self.mpc_api.ask_for_current_position()
|
||||
except MPC_API.PlayerNotReadyException:
|
||||
|
||||
def __testMpcReady(self):
|
||||
i = 0
|
||||
while self.preventAsking:
|
||||
if(i >= 100):
|
||||
raise Exception("Player failed opening file")
|
||||
i+=1
|
||||
time.sleep(0.1)
|
||||
self.testMpcReady()
|
||||
finally:
|
||||
self.playerStateChangeLock.release()
|
||||
|
||||
def make_ping(self):
|
||||
self.testMpcReady()
|
||||
self.mpc_api.callbacks.on_update_filename = self.handleUpdatedFilename
|
||||
self.__syncplayClient.initPlayer(self)
|
||||
self.handleUpdatedFilename(self.mpc_api.fileplaying)
|
||||
self.ask_for_status()
|
||||
|
||||
try:
|
||||
self.__testMpcReady()
|
||||
self.mpc_api.callbacks.on_update_filename = self.handleUpdatedFilename
|
||||
self.__syncplayClient.initPlayer(self)
|
||||
self.handleUpdatedFilename(self.mpc_api.fileplaying)
|
||||
self.ask_for_status()
|
||||
except Exception, err:
|
||||
self.__syncplayClient.ui.showMessage(err.message)
|
||||
self.__syncplayClient.stop()
|
||||
|
||||
|
||||
def display_message(self, message):
|
||||
try:
|
||||
self.mpc_api.send_osd(message, 2, 3000)
|
||||
@ -80,15 +83,6 @@ class MPCHCAPIPlayer(object):
|
||||
self.playerStateChangeLock.release()
|
||||
|
||||
|
||||
def __askForPositionUntilPlayerReady(self):
|
||||
if(self.__syncplayClient.running == False):
|
||||
return 0
|
||||
try:
|
||||
return self.mpc_api.ask_for_current_position()
|
||||
except MPC_API.PlayerNotReadyException:
|
||||
time.sleep(0.1)
|
||||
return self.__askForPositionUntilPlayerReady()
|
||||
|
||||
def ask_for_status(self):
|
||||
try:
|
||||
if(not self.preventAsking and self.mpc_api.is_file_ready() and self.askLock.acquire(0)):
|
||||
|
||||
@ -28,6 +28,7 @@ class LineProcessProtocol(ProcessProtocol):
|
||||
def outReceived(self, data):
|
||||
self._leftover_out, lines = self.parse_lines(self._leftover_out, data)
|
||||
for line in lines:
|
||||
line = line.replace('\r', "")
|
||||
self.outLineReceived(line)
|
||||
|
||||
def errReceived(self, data):
|
||||
@ -91,8 +92,7 @@ class MplayerProtocol(LineProcessProtocol):
|
||||
|
||||
|
||||
def prepare_player(self):
|
||||
self.set_paused(True)
|
||||
|
||||
self.set_paused(True)
|
||||
self.set_position(0)
|
||||
self.send_get_filename()
|
||||
self.send_get_length()
|
||||
@ -148,8 +148,6 @@ class MplayerProtocol(LineProcessProtocol):
|
||||
self.setUpFileInPlayer()
|
||||
|
||||
def set_paused(self, value):
|
||||
# docs say i can't set "pause" property, but it works...
|
||||
# no, Fluxid, it doesn't on Windows, fuck you. TODO:
|
||||
self.send_set_property('pause', 'yes' if value else 'no')
|
||||
|
||||
def send_get_paused(self):
|
||||
|
||||
@ -308,9 +308,8 @@ class SyncFactory(Factory):
|
||||
self.pause_change_by = watcher
|
||||
else:
|
||||
pause_changed = False
|
||||
position, _ = self.find_position(watcher.room)
|
||||
self.send_state_to(watcher, position, curtime) # To jest kurwa bez sensu
|
||||
self.broadcast_room(watcher, lambda receiver: self.send_state_to(receiver, position, curtime) if pause_changed or (curtime-receiver.last_update_sent) > self.update_time_limit else False)
|
||||
self.send_state_to(watcher)
|
||||
self.broadcast_room(watcher, lambda receiver: self.send_state_to(receiver, position) if pause_changed or (curtime-receiver.last_update_sent) > self.update_time_limit else False)
|
||||
|
||||
def seek(self, watcher_proto, counter, ctime, position):
|
||||
watcher = self.watchers.get(watcher_proto)
|
||||
@ -328,13 +327,12 @@ class SyncFactory(Factory):
|
||||
receiver.max_position = position
|
||||
receiver.watcher_proto.sender.send_seek(curtime-receiver.time_offset, position, watcher.name)
|
||||
|
||||
def send_state_to(self, watcher, position=None, curtime=None):
|
||||
def send_state_to(self, watcher, position=None):
|
||||
minWatcher = None
|
||||
if position is None:
|
||||
position, minWatcher = self.find_position(watcher.room)
|
||||
minWatcher = minWatcher.name if minWatcher else None
|
||||
if curtime is None:
|
||||
curtime = time.time()
|
||||
curtime = time.time()
|
||||
ctime = curtime - watcher.time_offset
|
||||
if self.pause_change_by:
|
||||
watcher.watcher_proto.sender.send_state(watcher.counter, ctime, self.paused[watcher.room], position, self.pause_change_by.name)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user