Removed libMal reffeences (and little formating)
This commit is contained in:
parent
6c4e2fa402
commit
da17982866
@ -11,14 +11,6 @@ import threading
|
||||
from syncplay.constants import PRIVACY_SENDHASHED_MODE, PRIVACY_DONTSEND_MODE, \
|
||||
PRIVACY_HIDDENFILENAME, FILENAME_STRIP_REGEX
|
||||
import collections
|
||||
# <MAL DISABLE>
|
||||
libMal = None
|
||||
'''try:
|
||||
import libMal
|
||||
except ImportError:
|
||||
libMal = None
|
||||
'''
|
||||
# </MAL DISABLE>
|
||||
|
||||
class SyncClientFactory(ClientFactory):
|
||||
def __init__(self, client, retry=constants.RECONNECT_RETRIES):
|
||||
@ -67,7 +59,6 @@ class SyncplayClient(object):
|
||||
self.userlist = SyncplayUserlist(self.ui, self)
|
||||
self._protocol = None
|
||||
self._player = None
|
||||
self.givenmalprivacywarning = False
|
||||
if(config['room'] == None or config['room'] == ''):
|
||||
config['room'] = config['name'] # ticket #58
|
||||
self.defaultRoom = config['room']
|
||||
@ -98,7 +89,6 @@ class SyncplayClient(object):
|
||||
self._speedChanged = False
|
||||
|
||||
self._warnings = self._WarningManager(self._player, self.userlist, self.ui)
|
||||
self._malUpdater = MalUpdater(config["malUsername"], config["malPassword"], self.ui)
|
||||
|
||||
def initProtocol(self, protocol):
|
||||
self._protocol = protocol
|
||||
@ -233,7 +223,6 @@ class SyncplayClient(object):
|
||||
if(self.userlist.hasRoomStateChanged() and not paused):
|
||||
self._warnings.checkWarnings()
|
||||
self.userlist.roomStateConfirmed()
|
||||
self._malUpdater.playingHook(position, paused)
|
||||
|
||||
def updateGlobalState(self, position, paused, doSeek, setBy, messageAge):
|
||||
if(self.__getUserlistOnLogon):
|
||||
@ -309,12 +298,6 @@ class SyncplayClient(object):
|
||||
filename, size = self.__executePrivacySettings(filename, size)
|
||||
self.userlist.currentUser.setFile(filename, duration, size)
|
||||
self.sendFile()
|
||||
self._malUpdater.fileChangeHook(rawfilename, duration)
|
||||
if libMal and filename <> rawfilename and self.givenmalprivacywarning == False:
|
||||
message = getMessage("en", "mal-noprivacy-notification")
|
||||
self.ui.showErrorMessage(message)
|
||||
self.givenmalprivacywarning = True
|
||||
|
||||
|
||||
def __executePrivacySettings(self, filename, size):
|
||||
if (self._config['filenamePrivacyMode'] == PRIVACY_SENDHASHED_MODE):
|
||||
@ -475,53 +458,6 @@ class SyncplayUser(object):
|
||||
else:
|
||||
return "{}".format(self.username)
|
||||
|
||||
class MalUpdater(object):
|
||||
def __init__(self, username, password, ui):
|
||||
self._filePlayingFor = 0.0
|
||||
self._lastHookUpdate = None
|
||||
self._fileDuration = 0
|
||||
self._filename = ""
|
||||
self.__username = username
|
||||
self.__password = password
|
||||
self._ui = ui
|
||||
|
||||
def _updatePlayingTime(self, paused):
|
||||
if (not self._lastHookUpdate):
|
||||
self._lastHookUpdate = time.time()
|
||||
if (not paused):
|
||||
self._filePlayingFor += time.time() - self._lastHookUpdate
|
||||
self._lastHookUpdate = time.time()
|
||||
|
||||
def playingHook(self, position, paused):
|
||||
if(self._fileDuration == 0):
|
||||
return
|
||||
self._updatePlayingTime(paused)
|
||||
pastMark = position / self._fileDuration > 0.4
|
||||
if self._filePlayingFor > 30 and pastMark:
|
||||
threading.Thread(target=self._updateMal).start()
|
||||
|
||||
def fileChangeHook(self, filename, duration):
|
||||
self._fileDuration = duration
|
||||
self._filename = filename
|
||||
self._filePlayingFor = 0.0
|
||||
self._lastHookUpdate = None
|
||||
|
||||
def _updateMal(self):
|
||||
try:
|
||||
self._fileDuration = 0 # Disable playingHook
|
||||
if(libMal and self._filename and self.__username and self.__password):
|
||||
manager = libMal.Manager(self.__username, self.__password)
|
||||
results = manager.findEntriesOnMal(self._filename)
|
||||
if(len(results) > 0):
|
||||
result = results[0]
|
||||
message = "Updating MAL with: \"{}\", episode: {}".format(result.mainTitle, result.episodeBeingWatched)
|
||||
reactor.callFromThread(self._ui.showMessage, (message),)
|
||||
options = {"tags": ["syncplay"]}
|
||||
manager.updateEntryOnMal(result, options)
|
||||
self._filename = "" # Make sure no updates will be performed until switch
|
||||
except:
|
||||
reactor.callFromThread(self._ui.showMessage, ("MAL Update failure"),)
|
||||
|
||||
class SyncplayUserlist(object):
|
||||
def __init__(self, ui, client):
|
||||
self.currentUser = SyncplayUser()
|
||||
|
||||
@ -1,39 +1,39 @@
|
||||
#coding:utf8
|
||||
# coding:utf8
|
||||
|
||||
en = {
|
||||
|
||||
# Client notifications
|
||||
"connection-attempt-notification" : "Attempting to connect to {}:{}", #Port, IP
|
||||
"connection-attempt-notification" : "Attempting to connect to {}:{}", # Port, IP
|
||||
"reconnection-attempt-notification" : "Connection with server lost, attempting to reconnect",
|
||||
"disconnection-notification" : "Disconnected from server",
|
||||
"connection-failed-notification" : "Connection with server failed",
|
||||
"connected-successful-notification" : "Successfully connected to server",
|
||||
"retrying-notification" : "%s, Retrying in %d seconds...", #Seconds
|
||||
"retrying-notification" : "%s, Retrying in %d seconds...", # Seconds
|
||||
|
||||
"rewind-notification" : "Rewinded due to time difference with <{}>", #User
|
||||
"slowdown-notification" : "Slowing down due to time difference with <{}>", #User
|
||||
"rewind-notification" : "Rewinded due to time difference with <{}>", # User
|
||||
"slowdown-notification" : "Slowing down due to time difference with <{}>", # User
|
||||
"revert-notification" : "Reverting speed back to normal",
|
||||
|
||||
"pause-notification" : "<{}> paused", #User
|
||||
"unpause-notification" : "<{}> unpaused", #User
|
||||
"seek-notification" : "<{}> jumped from {} to {}", #User, from time, to time
|
||||
"pause-notification" : "<{}> paused", # User
|
||||
"unpause-notification" : "<{}> unpaused", # User
|
||||
"seek-notification" : "<{}> jumped from {} to {}", # User, from time, to time
|
||||
|
||||
"current-offset-notification" : "Current offset: {} seconds", #Offset
|
||||
"current-offset-notification" : "Current offset: {} seconds", # Offset
|
||||
|
||||
"room-join-notification" : "<{}> has joined the room: '{}'", #User
|
||||
"left-notification" : "<{}> has left", #User
|
||||
"playing-notification" : "<{}> is playing '{}' ({})", #User, file, duration
|
||||
"playing-notification/room-addendum" : " in room: '{}'", #Room
|
||||
"room-join-notification" : "<{}> has joined the room: '{}'", # User
|
||||
"left-notification" : "<{}> has left", # User
|
||||
"playing-notification" : "<{}> is playing '{}' ({})", # User, file, duration
|
||||
"playing-notification/room-addendum" : " in room: '{}'", # Room
|
||||
|
||||
"file-different-notification" : "File you are playing appears to be different from <{}>'s", #User
|
||||
"file-different-notification" : "File you are playing appears to be different from <{}>'s", # User
|
||||
"file-differences-notification" : "Your file differs in the following way(s): ",
|
||||
"room-files-not-same" : "Not all files played in the room are the same",
|
||||
"alone-in-the-room": "You're alone in the room",
|
||||
|
||||
"different-filesize-notification" : " (their file size is different from yours!)",
|
||||
"file-played-by-notification" : "File: {} is being played by:", #File
|
||||
"file-played-by-notification" : "File: {} is being played by:", # File
|
||||
"notplaying-notification" : "People who are not playing any file:",
|
||||
"userlist-room-notification" : "In room '{}':", #Room
|
||||
"userlist-room-notification" : "In room '{}':", # Room
|
||||
|
||||
"mplayer-file-required-notification" : "Syncplay using mplayer requires you to provide file when starting",
|
||||
"mplayer-file-required-notification/example" : "Usage example: syncplay [options] [url|path/]filename",
|
||||
@ -47,18 +47,16 @@ en = {
|
||||
"commandlist-notification/pause" : "\tp - toggle pause",
|
||||
"commandlist-notification/seek" : "\t[s][+-]time - seek to the given value of time, if + or - is not specified it's absolute time in seconds or min:sec",
|
||||
"commandlist-notification/help" : "\th - this help",
|
||||
"syncplay-version-notification" : "Syncplay version: {}", #syncplay.version
|
||||
"more-info-notification" : "More info available at: {}", #projectURL
|
||||
"syncplay-version-notification" : "Syncplay version: {}", # syncplay.version
|
||||
"more-info-notification" : "More info available at: {}", # projectURL
|
||||
|
||||
"gui-data-cleared-notification" : "Syncplay has cleared the path and window state data used by the GUI.",
|
||||
|
||||
"vlc-version-mismatch": "Warning: You are running VLC version {}, but Syncplay is designed to run on VLC {} and above.", # VLC version, VLC min version
|
||||
"vlc-interface-version-mismatch": "Warning: You are running version {} of the Syncplay interface module for VLC, but Syncplay is designed to run with version {} and above.", # VLC interface version, VLC interface min version
|
||||
"vlc-version-mismatch": "Warning: You are running VLC version {}, but Syncplay is designed to run on VLC {} and above.", # VLC version, VLC min version
|
||||
"vlc-interface-version-mismatch": "Warning: You are running version {} of the Syncplay interface module for VLC, but Syncplay is designed to run with version {} and above.", # VLC interface version, VLC interface min version
|
||||
"vlc-interface-oldversion-ignored": "Warning: Syncplay detected that an old version version of the Syncplay interface module for VLC was installed in the VLC directory. As such, if you are running VLC 2.0 then it will be ignored in favour of the syncplay.lua module contained within the Syncplay directory, but this will mean that other custom interface scripts and extensions will not work. Please refer to the Syncplay User Guide at http://syncplay.pl/guide/ for instructions on how to install syncplay.lua.",
|
||||
"vlc-interface-not-installed": "Warning: The Syncplay interface module for VLC was not found in the VLC directory. As such, if you are running VLC 2.0 then VLC will use the syncplay.lua module contained within the Syncplay directory, but this will mean that other custom interface scripts and extensions will not work. Please refer to the Syncplay User Guide at http://syncplay.pl/guide/ for instructions on how to install syncplay.lua.",
|
||||
|
||||
"mal-noprivacy-notification": "Warning: The MyAnimeList updater does not support Syncplay's filename privacy settings. Filename information sent to Google.com, MAL-API.com and MyAnimeList.net will not be encrypted, masked or hashed. See http://syncplay.pl/tech/ for more details on MyAnimeList/libMal behaviour.",
|
||||
|
||||
# Client prompts
|
||||
"enter-to-exit-prompt" : "Press enter to exit\n",
|
||||
|
||||
@ -70,7 +68,7 @@ en = {
|
||||
"player-file-open-error" : "Player failed opening file",
|
||||
"player-path-error" : "Player path is not set properly",
|
||||
"hostname-empty-error" : "Hostname can't be empty",
|
||||
"empty-error" : "{} can't be empty", #Configuration
|
||||
"empty-error" : "{} can't be empty", # Configuration
|
||||
|
||||
"arguments-missing-error" : "Some necessary arguments are missing, refer to --help",
|
||||
|
||||
@ -79,12 +77,12 @@ en = {
|
||||
"not-json-error" : "Not a json encoded string\n",
|
||||
"hello-arguments-error" : "Not enough Hello arguments\n",
|
||||
"version-mismatch-error" : "Mismatch between versions of client and server\n",
|
||||
"vlc-error-echo": "VLC error: {}", # VLC error line
|
||||
"vlc-error-echo": "VLC error: {}", # VLC error line
|
||||
"vlc-unicode-loadfile-error" : "Cannot load file through Syncplay because it contains non-ASCII characters. Please load the file through VLC.",
|
||||
"vlc-failed-connection": "Failed to connect to VLC. If you have not installed syncplay.lua then please refer to http://syncplay.pl/LUA/ for instructions.",
|
||||
"vlc-failed-noscript": "VLC has reported that the syncplay.lua interface script has not been installed. Please refer to http://syncplay.pl/LUA/ for instructions.",
|
||||
"vlc-failed-versioncheck": "This version of VLC is not supported by Syncplay. Please use VLC 2.",
|
||||
"vlc-failed-other" : "When trying to load the syncplay.lua interface script VLC has provided the following error: {}", #Syncplay Error
|
||||
"vlc-failed-other" : "When trying to load the syncplay.lua interface script VLC has provided the following error: {}", # Syncplay Error
|
||||
|
||||
# Client arguments
|
||||
"argument-description" : 'Solution to synchronize playback of multiple MPlayer and MPC-HC instances over the network.',
|
||||
@ -117,8 +115,6 @@ en = {
|
||||
"browse-label" : "Browse",
|
||||
|
||||
"more-title" : "Show more settings",
|
||||
"mal-username-label" : "MAL username:",
|
||||
"mal-password-label" : "MAL password:",
|
||||
"privacy-sendraw-option" : "Send raw",
|
||||
"privacy-sendhashed-option" : "Send hashed",
|
||||
"privacy-dontsend-option" : "Don't send",
|
||||
@ -148,8 +144,6 @@ en = {
|
||||
"media-path-tooltip" : "Location of video or stream to be opened. Necessary for mpv and mplayer2.",
|
||||
|
||||
"more-tooltip" : "Display less frequently used settings.",
|
||||
"mal-username-tooltip" : "Your MyAnimeList username. Note: MAL support is experimental!",
|
||||
"mal-password-tooltip" : "Your MyAnimeList password. Note: This is not encrypted!",
|
||||
"filename-privacy-tooltip" : "Privacy mode for sending currently playing filename to server.",
|
||||
"filesize-privacy-tooltip" : "Privacy mode for sending size of currently playing file to server.",
|
||||
"privacy-sendraw-tooltip" : "Send this information without obfuscation. This is the default option with most functionality.",
|
||||
@ -164,15 +158,15 @@ en = {
|
||||
"help-tooltip" : "Opens the Syncplay.pl user guide.",
|
||||
|
||||
# Server messages to client
|
||||
"new-syncplay-available-motd-message" : "<NOTICE> You are using Syncplay {} but a newer version is available from http://syncplay.pl </NOTICE>", #ClientVersion
|
||||
"new-syncplay-available-motd-message" : "<NOTICE> You are using Syncplay {} but a newer version is available from http://syncplay.pl </NOTICE>", # ClientVersion
|
||||
|
||||
# Server notifications
|
||||
"welcome-server-notification" : "Welcome to Syncplay server, ver. {0}", #version
|
||||
"client-connected-room-server-notification" : "{0}({2}) connected to room '{1}'", #username, host, room
|
||||
"client-left-server-notification" : "{0} left server", #name
|
||||
"welcome-server-notification" : "Welcome to Syncplay server, ver. {0}", # version
|
||||
"client-connected-room-server-notification" : "{0}({2}) connected to room '{1}'", # username, host, room
|
||||
"client-left-server-notification" : "{0} left server", # name
|
||||
|
||||
|
||||
#Server arguments
|
||||
# Server arguments
|
||||
"server-argument-description" : 'Solution to synchronize playback of multiple MPlayer and MPC-HC instances over the network. Server instance',
|
||||
"server-argument-epilog" : 'If no options supplied _config values will be used',
|
||||
"server-port-argument" : 'server TCP port',
|
||||
@ -186,11 +180,11 @@ en = {
|
||||
"server-irc-verbose": "Should server actively report changes in rooms",
|
||||
"server-irc-config": "Path to irc bot config files",
|
||||
|
||||
#Server errors
|
||||
"unknown-command-server-error" : "Unknown command {}", #message
|
||||
"not-json-server-error" : "Not a json encoded string {}", #message
|
||||
# Server errors
|
||||
"unknown-command-server-error" : "Unknown command {}", # message
|
||||
"not-json-server-error" : "Not a json encoded string {}", # message
|
||||
"not-known-server-error" : "You must be known to server before sending this command",
|
||||
"client-drop-server-error" : "Client drop: {} -- {}", #host, error
|
||||
"client-drop-server-error" : "Client drop: {} -- {}", # host, error
|
||||
"password-required-server-error" : "Password required",
|
||||
"wrong-password-server-error" : "Wrong password supplied",
|
||||
"hello-server-error" : "Not enough Hello arguments",
|
||||
@ -203,33 +197,33 @@ en = {
|
||||
pl = {
|
||||
|
||||
# Client notifications
|
||||
"connection-attempt-notification" : "Próba połączenia z {}:{}", #Port, IP
|
||||
"connection-attempt-notification" : "Próba połączenia z {}:{}", # Port, IP
|
||||
"reconnection-attempt-notification" : "Połączenie z serwerem zostało przerwane, ponowne łączenie",
|
||||
"disconnection-notification" : "Odłączono od serwera",
|
||||
"connection-failed-notification" : "Połączenie z serwerem zakończone fiaskiem",
|
||||
|
||||
"rewind-notification" : "Cofnięto z powodu różnicy czasu z <{}>", #User
|
||||
"slowdown-notification" : "Zwolniono z powodu różnicy czasu z <{}>", #User
|
||||
"rewind-notification" : "Cofnięto z powodu różnicy czasu z <{}>", # User
|
||||
"slowdown-notification" : "Zwolniono z powodu różnicy czasu z <{}>", # User
|
||||
"revert-notification" : "Przywrócono normalną prędkość odtwarzania",
|
||||
|
||||
"pause-notification" : "<{}> zatrzymał odtwarzanie", #User
|
||||
"unpause-notification" : "<{}> wznowił odtwarzanie", #User
|
||||
"seek-notification" : "<{}> skoczył z {} do {}", #User, from time, to time
|
||||
"pause-notification" : "<{}> zatrzymał odtwarzanie", # User
|
||||
"unpause-notification" : "<{}> wznowił odtwarzanie", # User
|
||||
"seek-notification" : "<{}> skoczył z {} do {}", # User, from time, to time
|
||||
|
||||
"current-offset-notification" : "Obecny offset: {} seconds", #Offset
|
||||
"current-offset-notification" : "Obecny offset: {} seconds", # Offset
|
||||
|
||||
"room-join-notification" : "<{}> dołączył do pokoju: '{}'", #User
|
||||
"left-notification" : "<{}> wyszedł", #User
|
||||
"playing-notification" : "<{}> odtwarza '{}' ({})", #User, file, duration
|
||||
"playing-notification/room-addendum" : " w pokoju: '{}'", #Room
|
||||
"room-join-notification" : "<{}> dołączył do pokoju: '{}'", # User
|
||||
"left-notification" : "<{}> wyszedł", # User
|
||||
"playing-notification" : "<{}> odtwarza '{}' ({})", # User, file, duration
|
||||
"playing-notification/room-addendum" : " w pokoju: '{}'", # Room
|
||||
|
||||
"file-different-notification" : "Plik, który odtwarzasz wydaje się być różny od <{}>", #User
|
||||
"file-different-notification" : "Plik, który odtwarzasz wydaje się być różny od <{}>", # User
|
||||
"file-differences-notification" : "Twój plik różni się następującymi parametrami: ",
|
||||
|
||||
"different-filesize-notification" : " (inny rozmiar pliku!)",
|
||||
"file-played-by-notification" : "Plik: {} jest odtwarzany przez:", #File
|
||||
"file-played-by-notification" : "Plik: {} jest odtwarzany przez:", # File
|
||||
"notplaying-notification" : "Osoby, które nie odtwarzają żadnych plików:",
|
||||
"userlist-room-notification" : "W pokoju '{}':", #Room
|
||||
"userlist-room-notification" : "W pokoju '{}':", # Room
|
||||
# Client prompts
|
||||
"enter-to-exit-prompt" : "Wciśnij Enter, aby zakończyć działanie programu\n",
|
||||
|
||||
|
||||
@ -8,7 +8,7 @@ from syncplay.players.playerFactory import PlayerFactory
|
||||
import codecs
|
||||
try:
|
||||
from syncplay.ui.GuiConfiguration import GuiConfiguration
|
||||
from PySide import QtGui #@UnresolvedImport
|
||||
from PySide import QtGui # @UnresolvedImport
|
||||
from PySide.QtCore import QCoreApplication
|
||||
except ImportError:
|
||||
GuiConfiguration = None
|
||||
@ -33,11 +33,8 @@ class ConfigurationGetter(object):
|
||||
"file": None,
|
||||
"playerArgs": [],
|
||||
"playerClass": None,
|
||||
"slowOnDesync": True,
|
||||
"slowOnDesync": True,
|
||||
"rewindOnDesync": True,
|
||||
"malUsername": "",
|
||||
"malPassword": "",
|
||||
"malPassword": "",
|
||||
"filenamePrivacyMode": constants.PRIVACY_SENDRAW_MODE,
|
||||
"filesizePrivacyMode": constants.PRIVACY_SENDRAW_MODE,
|
||||
"pauseOnLeave": False,
|
||||
@ -45,7 +42,7 @@ class ConfigurationGetter(object):
|
||||
}
|
||||
|
||||
#
|
||||
#Custom validation in self._validateArguments
|
||||
# Custom validation in self._validateArguments
|
||||
#
|
||||
self._required = [
|
||||
"host",
|
||||
@ -70,11 +67,10 @@ class ConfigurationGetter(object):
|
||||
self._iniStructure = {
|
||||
"server_data": ["host", "port", "password"],
|
||||
"client_settings": ["name", "room", "playerPath", "slowOnDesync", "rewindOnDesync", "forceGuiPrompt", "filenamePrivacyMode", "filesizePrivacyMode", "pauseOnLeave"],
|
||||
"mal": ["malPassword", "malUsername"]
|
||||
}
|
||||
|
||||
#
|
||||
#Watch out for the method self._overrideConfigWithArgs when you're adding custom multi-word command line arguments
|
||||
# Watch out for the method self._overrideConfigWithArgs when you're adding custom multi-word command line arguments
|
||||
#
|
||||
self._argparser = argparse.ArgumentParser(description=getMessage("en", "argument-description"),
|
||||
epilog=getMessage("en", "argument-epilog"))
|
||||
@ -166,7 +162,7 @@ class ConfigurationGetter(object):
|
||||
|
||||
return configFile
|
||||
|
||||
def _parseConfigFile(self, iniPath, createConfig = True):
|
||||
def _parseConfigFile(self, iniPath, createConfig=True):
|
||||
parser = SafeConfigParserUnicode()
|
||||
if(not os.path.isfile(iniPath)):
|
||||
if(createConfig):
|
||||
@ -191,12 +187,12 @@ class ConfigurationGetter(object):
|
||||
except:
|
||||
sys.exit()
|
||||
|
||||
def _promptForMissingArguments(self, error = None):
|
||||
def _promptForMissingArguments(self, error=None):
|
||||
if(self._config['noGui']):
|
||||
print getMessage("en", "missing-arguments-error")
|
||||
sys.exit()
|
||||
elif(GuiConfiguration):
|
||||
gc = GuiConfiguration(self._config, error = error)
|
||||
gc = GuiConfiguration(self._config, error=error)
|
||||
gc.setAvailablePaths(self._playerFactory.getAvailablePlayerPaths())
|
||||
gc.run()
|
||||
return gc.getProcessedConfiguration()
|
||||
@ -254,7 +250,7 @@ class ConfigurationGetter(object):
|
||||
for location in locations:
|
||||
for name in constants.CONFIG_NAMES:
|
||||
path = location + os.path.sep + name
|
||||
self._parseConfigFile(path, createConfig = False)
|
||||
self._parseConfigFile(path, createConfig=False)
|
||||
self._checkConfig()
|
||||
|
||||
def getConfiguration(self):
|
||||
@ -262,7 +258,7 @@ class ConfigurationGetter(object):
|
||||
self._parseConfigFile(iniPath)
|
||||
args = self._argparser.parse_args()
|
||||
self._overrideConfigWithArgs(args)
|
||||
#Arguments not validated yet - booleans are still text values
|
||||
# Arguments not validated yet - booleans are still text values
|
||||
if(self._config['forceGuiPrompt'] == "True" or not self._config['file']):
|
||||
self._forceGuiPrompt()
|
||||
self._checkConfig()
|
||||
|
||||
@ -9,7 +9,7 @@ from syncplay.messages import getMessage
|
||||
from syncplay import constants
|
||||
|
||||
class GuiConfiguration:
|
||||
def __init__(self, config, error = None):
|
||||
def __init__(self, config, error=None):
|
||||
self.config = config
|
||||
self._availablePlayerPaths = []
|
||||
self.error = error
|
||||
@ -93,7 +93,7 @@ class ConfigDialog(QtGui.QDialog):
|
||||
if foundpath != "":
|
||||
settings.beginGroup("PlayerList")
|
||||
playerpathlist.append(os.path.normcase(os.path.normpath(foundpath)))
|
||||
settings.setValue("PlayerList", list(set(os.path.normcase(os.path.normpath(path)) for path in set(playerpathlist))))
|
||||
settings.setValue("PlayerList", list(set(os.path.normcase(os.path.normpath(path)) for path in set(playerpathlist))))
|
||||
settings.endGroup()
|
||||
return(foundpath)
|
||||
|
||||
@ -113,7 +113,7 @@ class ConfigDialog(QtGui.QDialog):
|
||||
browserfilter = "All files (*)"
|
||||
|
||||
if os.name == 'nt':
|
||||
browserfilter = "Executable files (*.exe);;All files (*)"
|
||||
browserfilter = "Executable files (*.exe);;All files (*)"
|
||||
if "PROGRAMFILES(X86)" in os.environ:
|
||||
defaultdirectory = os.environ["ProgramFiles(x86)"]
|
||||
elif "PROGRAMFILES" in os.environ:
|
||||
@ -170,7 +170,7 @@ class ConfigDialog(QtGui.QDialog):
|
||||
else:
|
||||
defaultdirectory = ""
|
||||
browserfilter = "All files (*)"
|
||||
fileName, filtr = QtGui.QFileDialog.getOpenFileName(self,"Browse for media files",defaultdirectory,
|
||||
fileName, filtr = QtGui.QFileDialog.getOpenFileName(self, "Browse for media files", defaultdirectory,
|
||||
browserfilter, "", options)
|
||||
if fileName:
|
||||
self.mediapathTextbox.setText(os.path.normpath(fileName))
|
||||
@ -212,8 +212,6 @@ class ConfigDialog(QtGui.QDialog):
|
||||
self.config['rewindOnDesync'] = True
|
||||
else:
|
||||
self.config['rewindOnDesync'] = False
|
||||
self.config['malUsername'] = self.malusernameTextbox.text()
|
||||
self.config['malPassword'] = self.malpasswordTextbox.text()
|
||||
|
||||
if self.filenameprivacySendRawOption.isChecked() == True:
|
||||
self.config['filenamePrivacyMode'] = constants.PRIVACY_SENDRAW_MODE
|
||||
@ -252,7 +250,7 @@ class ConfigDialog(QtGui.QDialog):
|
||||
if sys.platform.startswith('linux'):
|
||||
dropfilepath = unicode(urls[0].path())
|
||||
else:
|
||||
dropfilepath = unicode(urls[0].path())[1:] # Removes starting slash
|
||||
dropfilepath = unicode(urls[0].path())[1:] # Removes starting slash
|
||||
if dropfilepath[-4:].lower() == ".exe":
|
||||
self.executablepathCombobox.setEditText(dropfilepath)
|
||||
else:
|
||||
@ -264,13 +262,13 @@ class ConfigDialog(QtGui.QDialog):
|
||||
self.config = config
|
||||
self.datacleared = False
|
||||
if config['clearGUIData'] == True:
|
||||
settings = QSettings("Syncplay","PlayerList")
|
||||
settings = QSettings("Syncplay", "PlayerList")
|
||||
settings.clear()
|
||||
settings = QSettings("Syncplay","MediaBrowseDialog")
|
||||
settings = QSettings("Syncplay", "MediaBrowseDialog")
|
||||
settings.clear()
|
||||
settings = QSettings("Syncplay","MainWindow")
|
||||
settings = QSettings("Syncplay", "MainWindow")
|
||||
settings.clear()
|
||||
settings = QSettings("Syncplay","MoreSettings")
|
||||
settings = QSettings("Syncplay", "MoreSettings")
|
||||
settings.clear()
|
||||
self.datacleared = True
|
||||
self.QtGui = QtGui
|
||||
@ -292,16 +290,16 @@ class ConfigDialog(QtGui.QDialog):
|
||||
elif(":" in config['host']):
|
||||
host = config['host']
|
||||
else:
|
||||
host = config['host']+":"+str(config['port'])
|
||||
host = config['host'] + ":" + str(config['port'])
|
||||
|
||||
self.connectionSettingsGroup = QtGui.QGroupBox(getMessage("en", "connection-group-title"))
|
||||
self.hostTextbox = QLineEdit(host, self)
|
||||
self.hostLabel = QLabel(getMessage("en", "host-label"), self)
|
||||
self.usernameTextbox = QLineEdit(config['name'],self)
|
||||
self.usernameTextbox = QLineEdit(config['name'], self)
|
||||
self.serverpassLabel = QLabel(getMessage("en", "password-label"), self)
|
||||
self.defaultroomTextbox = QLineEdit(config['room'],self)
|
||||
self.defaultroomTextbox = QLineEdit(config['room'], self)
|
||||
self.usernameLabel = QLabel(getMessage("en", "username-label"), self)
|
||||
self.serverpassTextbox = QLineEdit(config['password'],self)
|
||||
self.serverpassTextbox = QLineEdit(config['password'], self)
|
||||
self.defaultroomLabel = QLabel(getMessage("en", "room-label"), self)
|
||||
|
||||
if (constants.SHOW_TOOLTIPS == True):
|
||||
@ -338,11 +336,11 @@ class ConfigDialog(QtGui.QDialog):
|
||||
self.executablepathCombobox.editTextChanged.connect(self.updateExecutableIcon)
|
||||
|
||||
self.executablepathLabel = QLabel(getMessage("en", "executable-path-label"), self)
|
||||
self.executablebrowseButton = QtGui.QPushButton(QtGui.QIcon(resourcespath + 'folder_explore.png'),getMessage("en", "browse-label"))
|
||||
self.executablebrowseButton = QtGui.QPushButton(QtGui.QIcon(resourcespath + 'folder_explore.png'), getMessage("en", "browse-label"))
|
||||
self.executablebrowseButton.clicked.connect(self.browsePlayerpath)
|
||||
self.mediapathTextbox = QLineEdit(config['file'], self)
|
||||
self.mediapathLabel = QLabel(getMessage("en", "media-path-label"), self)
|
||||
self.mediabrowseButton = QtGui.QPushButton(QtGui.QIcon(resourcespath + 'folder_explore.png'),getMessage("en", "browse-label"))
|
||||
self.mediabrowseButton = QtGui.QPushButton(QtGui.QIcon(resourcespath + 'folder_explore.png'), getMessage("en", "browse-label"))
|
||||
self.mediabrowseButton.clicked.connect(self.browseMediapath)
|
||||
|
||||
if (constants.SHOW_TOOLTIPS == True):
|
||||
@ -368,21 +366,6 @@ class ConfigDialog(QtGui.QDialog):
|
||||
self.moreSettingsGroup = QtGui.QGroupBox(getMessage("en", "more-title"))
|
||||
|
||||
self.moreSettingsGroup.setCheckable(True)
|
||||
self.malSettingsSplit = QtGui.QSplitter(self)
|
||||
self.malusernameTextbox = QLineEdit(config['malUsername'],self)
|
||||
self.malusernameTextbox.setMaximumWidth(115)
|
||||
self.malusernameLabel = QLabel(getMessage("en", "mal-username-label"), self)
|
||||
|
||||
self.malpasswordTextbox = QLineEdit(config['malPassword'],self)
|
||||
self.malpasswordTextbox.setEchoMode(QtGui.QLineEdit.Password)
|
||||
self.malpasswordLabel = QLabel(getMessage("en", "mal-password-label"), self)
|
||||
|
||||
### <MAL DISABLE>
|
||||
self.malpasswordTextbox.hide()
|
||||
self.malpasswordLabel.hide()
|
||||
self.malusernameTextbox.hide()
|
||||
self.malusernameLabel.hide()
|
||||
### </MAL DISABLE>
|
||||
|
||||
self.filenameprivacyLabel = QLabel(getMessage("en", "filename-privacy-label"), self)
|
||||
self.filenameprivacyButtonGroup = QButtonGroup()
|
||||
@ -431,11 +414,6 @@ class ConfigDialog(QtGui.QDialog):
|
||||
self.pauseonleaveCheckbox.setChecked(True)
|
||||
|
||||
if (constants.SHOW_TOOLTIPS == True):
|
||||
self.malusernameLabel.setToolTip(getMessage("en", "mal-username-tooltip"))
|
||||
self.malusernameTextbox.setToolTip(getMessage("en", "mal-username-tooltip"))
|
||||
self.malpasswordLabel.setToolTip(getMessage("en", "mal-password-tooltip"))
|
||||
self.malpasswordTextbox.setToolTip(getMessage("en", "mal-password-tooltip"))
|
||||
|
||||
self.filenameprivacyLabel.setToolTip(getMessage("en", "filename-privacy-tooltip"))
|
||||
self.filenameprivacySendRawOption.setToolTip(getMessage("en", "privacy-sendraw-tooltip"))
|
||||
self.filenameprivacySendHashedOption.setToolTip(getMessage("en", "privacy-sendhashed-tooltip"))
|
||||
@ -457,10 +435,10 @@ class ConfigDialog(QtGui.QDialog):
|
||||
self.privacyFrame = QtGui.QFrame()
|
||||
self.privacyFrame.setLineWidth(0)
|
||||
self.privacyFrame.setMidLineWidth(0)
|
||||
self.privacySettingsLayout.setContentsMargins(0,0,0,0)
|
||||
self.privacySettingsLayout.setContentsMargins(0, 0, 0, 0)
|
||||
self.privacySettingsLayout.addWidget(self.filenameprivacyLabel, 0, 0)
|
||||
self.privacySettingsLayout.addWidget(self.filenameprivacySendRawOption, 0, 1, Qt.AlignRight)
|
||||
self.privacySettingsLayout.addWidget(self.filenameprivacySendHashedOption, 0,2, Qt.AlignRight)
|
||||
self.privacySettingsLayout.addWidget(self.filenameprivacySendHashedOption, 0, 2, Qt.AlignRight)
|
||||
self.privacySettingsLayout.addWidget(self.filenameprivacyDontSendOption, 0, 3, Qt.AlignRight)
|
||||
self.privacySettingsLayout.addWidget(self.filesizeprivacyLabel, 1, 0)
|
||||
self.privacySettingsLayout.addWidget(self.filesizeprivacySendRawOption, 1, 1, Qt.AlignRight)
|
||||
@ -470,12 +448,7 @@ class ConfigDialog(QtGui.QDialog):
|
||||
|
||||
self.moreSettingsLayout.addWidget(self.privacyFrame, 0, 0, 1, 4)
|
||||
|
||||
self.moreSettingsLayout.addWidget(self.malusernameLabel , 1, 0)
|
||||
self.moreSettingsLayout.addWidget(self.malusernameTextbox, 1, 1)
|
||||
self.moreSettingsLayout.addWidget(self.malpasswordLabel , 1, 2)
|
||||
self.moreSettingsLayout.addWidget(self.malpasswordTextbox, 1, 3)
|
||||
|
||||
self.moreSettingsLayout.addWidget(self.slowdownCheckbox, 2, 0,1,4)
|
||||
self.moreSettingsLayout.addWidget(self.slowdownCheckbox, 2, 0, 1, 4)
|
||||
if constants.SHOW_REWIND_ON_DESYNC_CHECKBOX == True:
|
||||
self.moreSettingsLayout.addWidget(self.rewindCheckbox, 3, 0, 1, 4)
|
||||
self.moreSettingsLayout.addWidget(self.pauseonleaveCheckbox, 4, 0, 1, 4)
|
||||
@ -517,12 +490,12 @@ class ConfigDialog(QtGui.QDialog):
|
||||
self.mainLayout.addSpacing(12)
|
||||
|
||||
self.topLayout = QtGui.QHBoxLayout()
|
||||
self.helpButton = QtGui.QPushButton(QtGui.QIcon(resourcespath + 'help.png'),getMessage("en", "help-label"))
|
||||
self.helpButton = QtGui.QPushButton(QtGui.QIcon(resourcespath + 'help.png'), getMessage("en", "help-label"))
|
||||
if (constants.SHOW_TOOLTIPS == True):
|
||||
self.helpButton.setToolTip(getMessage("en", "help-tooltip"))
|
||||
self.helpButton.setMaximumSize(self.helpButton.sizeHint())
|
||||
self.helpButton.pressed.connect(self.openHelp)
|
||||
self.runButton = QtGui.QPushButton(QtGui.QIcon(resourcespath + 'accept.png'),getMessage("en", "storeandrun-label"))
|
||||
self.runButton = QtGui.QPushButton(QtGui.QIcon(resourcespath + 'accept.png'), getMessage("en", "storeandrun-label"))
|
||||
self.runButton.pressed.connect(self._saveDataAndLeave)
|
||||
if config['noStore'] == True:
|
||||
self.donotstoreCheckbox.setChecked(True)
|
||||
@ -538,4 +511,4 @@ class ConfigDialog(QtGui.QDialog):
|
||||
self.setAcceptDrops(True)
|
||||
|
||||
if self.datacleared == True:
|
||||
QtGui.QMessageBox.information(self,"Syncplay", getMessage("en", "gui-data-cleared-notification"))
|
||||
QtGui.QMessageBox.information(self, "Syncplay", getMessage("en", "gui-data-cleared-notification"))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user