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.
|
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
|
### Known issues
|
||||||
1. PROTIP: Don't change your system time while Syncplay is running as it confuses the sync. It is known.
|
1. Changing your system time while Syncplay is running confuses the sync. PROTIP: Don't do it.
|
||||||
2. PROTIP: Don't try to jump less than 8 seconds as it won't register properly. It is known.
|
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(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'):
|
if(self._args.mpc_path[-10:] == 'mpc-hc.exe' or self._args.mpc_path[-12:] == 'mpc-hc64.exe'):
|
||||||
return True
|
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
|
return False
|
||||||
|
|
||||||
def _valuesToReadFromConfig(self, section_name):
|
def _valuesToReadFromConfig(self, section_name):
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
version = '0.6.6'
|
version = '0.7.0'
|
||||||
milestone = 'Clara'
|
milestone = 'Clara'
|
||||||
projectURL = 'http://uriziel.github.com/syncplay/'
|
projectURL = 'http://uriziel.github.com/syncplay/'
|
||||||
@ -260,6 +260,8 @@ class SyncplayClientManager(object):
|
|||||||
reactor.run()
|
reactor.run()
|
||||||
|
|
||||||
def stop(self, promptForAction = True):
|
def stop(self, promptForAction = True):
|
||||||
|
if(promptForAction):
|
||||||
|
self.ui.promptFor("Press enter to exit\n")
|
||||||
if not self.running:
|
if not self.running:
|
||||||
return
|
return
|
||||||
self.running = False
|
self.running = False
|
||||||
@ -270,8 +272,7 @@ class SyncplayClientManager(object):
|
|||||||
if self.player:
|
if self.player:
|
||||||
self.player.drop()
|
self.player.drop()
|
||||||
reactor.callLater(0.1, reactor.stop)
|
reactor.callLater(0.1, reactor.stop)
|
||||||
if(promptForAction):
|
|
||||||
self.ui.promptFor("Press enter to exit")
|
|
||||||
|
|
||||||
def checkIfFileMatchesOthers(self):
|
def checkIfFileMatchesOthers(self):
|
||||||
notMatchingList = self.users.getUsersWithNotMatchingFilenames()
|
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_mpc_closed = lambda: self.__syncplayClient.stop(False)
|
||||||
self.mpc_api.callbacks.on_fileStateChange = lambda _: self.lockAsking()
|
self.mpc_api.callbacks.on_fileStateChange = lambda _: self.lockAsking()
|
||||||
self.mpc_api.callbacks.on_update_playstate = lambda _: self.unlockAsking()
|
self.mpc_api.callbacks.on_update_playstate = lambda _: self.unlockAsking()
|
||||||
self.preventAsking = False
|
self.preventAsking = True
|
||||||
self.askLock = threading.RLock()
|
self.askLock = threading.RLock()
|
||||||
self.playerStateChangeLock = threading.RLock()
|
self.playerStateChangeLock = threading.RLock()
|
||||||
|
|
||||||
@ -27,24 +27,27 @@ class MPCHCAPIPlayer(object):
|
|||||||
|
|
||||||
def set_speed(self, value):
|
def set_speed(self, value):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def testMpcReady(self):
|
def __testMpcReady(self):
|
||||||
try:
|
i = 0
|
||||||
self.playerStateChangeLock.acquire()
|
while self.preventAsking:
|
||||||
self.mpc_api.ask_for_current_position()
|
if(i >= 100):
|
||||||
except MPC_API.PlayerNotReadyException:
|
raise Exception("Player failed opening file")
|
||||||
|
i+=1
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
self.testMpcReady()
|
|
||||||
finally:
|
|
||||||
self.playerStateChangeLock.release()
|
|
||||||
|
|
||||||
def make_ping(self):
|
def make_ping(self):
|
||||||
self.testMpcReady()
|
try:
|
||||||
self.mpc_api.callbacks.on_update_filename = self.handleUpdatedFilename
|
self.__testMpcReady()
|
||||||
self.__syncplayClient.initPlayer(self)
|
self.mpc_api.callbacks.on_update_filename = self.handleUpdatedFilename
|
||||||
self.handleUpdatedFilename(self.mpc_api.fileplaying)
|
self.__syncplayClient.initPlayer(self)
|
||||||
self.ask_for_status()
|
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):
|
def display_message(self, message):
|
||||||
try:
|
try:
|
||||||
self.mpc_api.send_osd(message, 2, 3000)
|
self.mpc_api.send_osd(message, 2, 3000)
|
||||||
@ -80,15 +83,6 @@ class MPCHCAPIPlayer(object):
|
|||||||
self.playerStateChangeLock.release()
|
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):
|
def ask_for_status(self):
|
||||||
try:
|
try:
|
||||||
if(not self.preventAsking and self.mpc_api.is_file_ready() and self.askLock.acquire(0)):
|
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):
|
def outReceived(self, data):
|
||||||
self._leftover_out, lines = self.parse_lines(self._leftover_out, data)
|
self._leftover_out, lines = self.parse_lines(self._leftover_out, data)
|
||||||
for line in lines:
|
for line in lines:
|
||||||
|
line = line.replace('\r', "")
|
||||||
self.outLineReceived(line)
|
self.outLineReceived(line)
|
||||||
|
|
||||||
def errReceived(self, data):
|
def errReceived(self, data):
|
||||||
@ -91,8 +92,7 @@ class MplayerProtocol(LineProcessProtocol):
|
|||||||
|
|
||||||
|
|
||||||
def prepare_player(self):
|
def prepare_player(self):
|
||||||
self.set_paused(True)
|
self.set_paused(True)
|
||||||
|
|
||||||
self.set_position(0)
|
self.set_position(0)
|
||||||
self.send_get_filename()
|
self.send_get_filename()
|
||||||
self.send_get_length()
|
self.send_get_length()
|
||||||
@ -148,8 +148,6 @@ class MplayerProtocol(LineProcessProtocol):
|
|||||||
self.setUpFileInPlayer()
|
self.setUpFileInPlayer()
|
||||||
|
|
||||||
def set_paused(self, value):
|
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')
|
self.send_set_property('pause', 'yes' if value else 'no')
|
||||||
|
|
||||||
def send_get_paused(self):
|
def send_get_paused(self):
|
||||||
|
|||||||
@ -308,9 +308,8 @@ class SyncFactory(Factory):
|
|||||||
self.pause_change_by = watcher
|
self.pause_change_by = watcher
|
||||||
else:
|
else:
|
||||||
pause_changed = False
|
pause_changed = False
|
||||||
position, _ = self.find_position(watcher.room)
|
self.send_state_to(watcher)
|
||||||
self.send_state_to(watcher, position, curtime) # To jest kurwa bez sensu
|
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)
|
||||||
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)
|
|
||||||
|
|
||||||
def seek(self, watcher_proto, counter, ctime, position):
|
def seek(self, watcher_proto, counter, ctime, position):
|
||||||
watcher = self.watchers.get(watcher_proto)
|
watcher = self.watchers.get(watcher_proto)
|
||||||
@ -328,13 +327,12 @@ class SyncFactory(Factory):
|
|||||||
receiver.max_position = position
|
receiver.max_position = position
|
||||||
receiver.watcher_proto.sender.send_seek(curtime-receiver.time_offset, position, watcher.name)
|
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
|
minWatcher = None
|
||||||
if position is None:
|
if position is None:
|
||||||
position, minWatcher = self.find_position(watcher.room)
|
position, minWatcher = self.find_position(watcher.room)
|
||||||
minWatcher = minWatcher.name if minWatcher else None
|
minWatcher = minWatcher.name if minWatcher else None
|
||||||
if curtime is None:
|
curtime = time.time()
|
||||||
curtime = time.time()
|
|
||||||
ctime = curtime - watcher.time_offset
|
ctime = curtime - watcher.time_offset
|
||||||
if self.pause_change_by:
|
if self.pause_change_by:
|
||||||
watcher.watcher_proto.sender.send_state(watcher.counter, ctime, self.paused[watcher.room], position, self.pause_change_by.name)
|
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