Added sound notification (for Windows) if not all files are same in one room
This commit is contained in:
parent
59b0cd0b6a
commit
65f3fc87ef
@ -27,6 +27,7 @@ info = dict(
|
||||
'compressed': 1
|
||||
}
|
||||
},
|
||||
data_files = [("resources", ["resources/buzzer.wav",]), ("", ["resources/syncplayClientForceConfiguration.bat",])],
|
||||
zipfile = "lib/libsync",
|
||||
|
||||
)
|
||||
|
||||
BIN
resources/buzzer.wav
Normal file
BIN
resources/buzzer.wav
Normal file
Binary file not shown.
1
resources/syncplayClientForceConfiguration.bat
Normal file
1
resources/syncplayClientForceConfiguration.bat
Normal file
@ -0,0 +1 @@
|
||||
Syncplay.exe -g
|
||||
@ -6,6 +6,7 @@ from twisted.internet.protocol import ClientFactory
|
||||
from twisted.internet import reactor, task
|
||||
from syncplay.protocols import SyncClientProtocol
|
||||
from syncplay import utils, constants
|
||||
from syncplay.ui import sound
|
||||
from syncplay.messages import getMessage
|
||||
|
||||
class SyncClientFactory(ClientFactory):
|
||||
@ -195,6 +196,7 @@ class SyncplayClient(object):
|
||||
if (paused == False and roomFilesDiffer):
|
||||
self.userlist.roomCheckedForDifferentFiles()
|
||||
self._player.displayMessage(getMessage("en", "room-files-not-same"), constants.DIFFERENT_FILE_MESSAGE_DURATION)
|
||||
sound.doBuzz()
|
||||
|
||||
def _changePlayerStateAccordingToGlobalState(self, position, paused, doSeek, setBy):
|
||||
madeChangeOnPlayer = False
|
||||
|
||||
@ -2,7 +2,7 @@ from ConfigParser import SafeConfigParser
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
from syncplay import constants
|
||||
from syncplay import constants, utils
|
||||
from syncplay.messages import getMessage
|
||||
try:
|
||||
from syncplay.ui.GuiConfiguration import GuiConfiguration
|
||||
@ -131,18 +131,8 @@ class ConfigurationGetter(object):
|
||||
host, port = host.split(':', 1)
|
||||
return host, int(port)
|
||||
|
||||
def _findWorkingDir(self):
|
||||
frozen = getattr(sys, 'frozen', '')
|
||||
if not frozen:
|
||||
path = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
|
||||
elif frozen in ('dll', 'console_exe', 'windows_exe'):
|
||||
path = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))))
|
||||
else:
|
||||
path = ""
|
||||
return path
|
||||
|
||||
def _checkForPortableFile(self):
|
||||
path = self._findWorkingDir()
|
||||
path = utils.findWorkingDir()
|
||||
if(os.path.isfile(os.path.join(path, constants.DEFAULT_CONFIG_NAME))):
|
||||
return os.path.join(path, constants.DEFAULT_CONFIG_NAME)
|
||||
|
||||
|
||||
11
syncplay/ui/sound.py
Normal file
11
syncplay/ui/sound.py
Normal file
@ -0,0 +1,11 @@
|
||||
try:
|
||||
import winsound
|
||||
except ImportError:
|
||||
winsound = None
|
||||
from syncplay import utils
|
||||
|
||||
def doBuzz():
|
||||
buzzPath = utils.findWorkingDir() + "\\resources\\buzzer.wav"
|
||||
print buzzPath
|
||||
if(winsound):
|
||||
winsound.PlaySound(buzzPath, winsound.SND_FILENAME|winsound.SND_ASYNC)
|
||||
@ -3,6 +3,8 @@ import re
|
||||
import datetime
|
||||
from syncplay import constants
|
||||
from syncplay.messages import getMessage
|
||||
import sys
|
||||
import os
|
||||
|
||||
def retry(ExceptionToCheck, tries=4, delay=3, backoff=2, logger=None):
|
||||
"""Retry calling the decorated function using an exponential backoff.
|
||||
@ -75,3 +77,14 @@ def formatTime(timeInSeconds):
|
||||
return '{0:02.0f}:{1:02.0f}:{2:02.0f}'.format(hours, minutes, seconds)
|
||||
else:
|
||||
return '{0:02.0f}:{1:02.0f}'.format(minutes, seconds)
|
||||
|
||||
def findWorkingDir():
|
||||
frozen = getattr(sys, 'frozen', '')
|
||||
if not frozen:
|
||||
path = os.path.dirname(os.path.dirname(__file__))
|
||||
elif frozen in ('dll', 'console_exe', 'windows_exe'):
|
||||
path = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
|
||||
else:
|
||||
path = ""
|
||||
return path
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user