Add "find public server" feature
This commit is contained in:
parent
f0f29653ce
commit
411808b348
@ -654,7 +654,7 @@ guiIcons = ['resources/accept.png', 'resources/arrow_undo.png', 'resources/clock
|
|||||||
'resources/user_key.png', 'resources/lock.png', 'resources/key_go.png', 'resources/page_white_key.png',
|
'resources/user_key.png', 'resources/lock.png', 'resources/key_go.png', 'resources/page_white_key.png',
|
||||||
'resources/tick.png', 'resources/lock_open.png', 'resources/empty_checkbox.png', 'resources/tick_checkbox.png',
|
'resources/tick.png', 'resources/lock_open.png', 'resources/empty_checkbox.png', 'resources/tick_checkbox.png',
|
||||||
'resources/world_explore.png', 'resources/application_get.png', 'resources/cog.png',
|
'resources/world_explore.png', 'resources/application_get.png', 'resources/cog.png',
|
||||||
'resources/film_go.png', 'resources/world_go.png'
|
'resources/film_go.png', 'resources/world_go.png', 'resources/report_magnify.png'
|
||||||
]
|
]
|
||||||
resources = ["resources/icon.ico", "resources/syncplay.png"]
|
resources = ["resources/icon.ico", "resources/syncplay.png"]
|
||||||
resources.extend(guiIcons)
|
resources.extend(guiIcons)
|
||||||
|
|||||||
BIN
resources/report_magnify.png
Normal file
BIN
resources/report_magnify.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 738 B |
@ -174,3 +174,4 @@ FILEITEM_SWITCH_STREAM_SWITCH = 2
|
|||||||
|
|
||||||
SYNCPLAY_UPDATE_URL = u"http://syncplay.pl/checkforupdate?{}" # Params
|
SYNCPLAY_UPDATE_URL = u"http://syncplay.pl/checkforupdate?{}" # Params
|
||||||
SYNCPLAY_DOWNLOAD_URL = "http://syncplay.pl/download/"
|
SYNCPLAY_DOWNLOAD_URL = "http://syncplay.pl/download/"
|
||||||
|
SYNCPLAY_PUBLIC_SERVER_LIST_URL = u"http://syncplay.pl/listpublicservers?{}" # Params
|
||||||
@ -137,6 +137,8 @@ en = {
|
|||||||
"switch-file-not-found-error" : u"Could not switch to file '{0}'. Syncplay looks in the folder of the currently playing file and specified media directories.", # File not found
|
"switch-file-not-found-error" : u"Could not switch to file '{0}'. Syncplay looks in the folder of the currently playing file and specified media directories.", # File not found
|
||||||
"folder-search-timeout-error" : u"The search for media in '{}' was aborted as it took too long. This will occur if you select a folder with too many sub-folders in your list of media folders to search through. Until Syncplay is restarted only the directory of the currently open file will be checked.", #Folder
|
"folder-search-timeout-error" : u"The search for media in '{}' was aborted as it took too long. This will occur if you select a folder with too many sub-folders in your list of media folders to search through. Until Syncplay is restarted only the directory of the currently open file will be checked.", #Folder
|
||||||
|
|
||||||
|
"failed-to-load-server-list-error" : u"Failed to load public server list. Please visit http://www.syncplay.pl/ in your browser.",
|
||||||
|
|
||||||
# Client arguments
|
# Client arguments
|
||||||
"argument-description" : 'Solution to synchronize playback of multiple MPlayer and MPC-HC instances over the network.',
|
"argument-description" : 'Solution to synchronize playback of multiple MPlayer and MPC-HC instances over the network.',
|
||||||
"argument-epilog" : 'If no options supplied _config values will be used',
|
"argument-epilog" : 'If no options supplied _config values will be used',
|
||||||
@ -171,6 +173,7 @@ en = {
|
|||||||
"media-path-label" : "Path to media file:",
|
"media-path-label" : "Path to media file:",
|
||||||
"player-arguments-label" : "Player arguments (if any):",
|
"player-arguments-label" : "Player arguments (if any):",
|
||||||
"browse-label" : "Browse",
|
"browse-label" : "Browse",
|
||||||
|
"list-servers-label" : u"Find public server",
|
||||||
|
|
||||||
"more-title" : "Show more settings",
|
"more-title" : "Show more settings",
|
||||||
"never-rewind-value" : "Never",
|
"never-rewind-value" : "Never",
|
||||||
@ -275,6 +278,8 @@ en = {
|
|||||||
"identifyascontroller-msgbox-label" : "Identify as room operator",
|
"identifyascontroller-msgbox-label" : "Identify as room operator",
|
||||||
"identifyinfo-msgbox-label" : "Enter operator password for this room\r\n(see http://syncplay.pl/guide/ for usage instructions):",
|
"identifyinfo-msgbox-label" : "Enter operator password for this room\r\n(see http://syncplay.pl/guide/ for usage instructions):",
|
||||||
|
|
||||||
|
"public-server-msgbox-label" : "Find public server (you must all use the same one!)",
|
||||||
|
|
||||||
"megabyte-suffix" : " MB",
|
"megabyte-suffix" : " MB",
|
||||||
|
|
||||||
# Tooltips
|
# Tooltips
|
||||||
@ -500,6 +505,8 @@ ru = {
|
|||||||
"switch-file-not-found-error" : u"Невозможно переключиться на файл '{0}'. Syncplay looks in the folder of the currently playing file and specified media directories.", # File not found # TODO: Translate last part into Russian
|
"switch-file-not-found-error" : u"Невозможно переключиться на файл '{0}'. Syncplay looks in the folder of the currently playing file and specified media directories.", # File not found # TODO: Translate last part into Russian
|
||||||
"folder-search-timeout-error" : u"The search for media in '{}' was aborted as it took too long. This will occur if you select a folder with too many sub-folders in your list of media folders to search through. Until Syncplay is restarted only the directory of the currently open file will be checked.", #Folder # TODO: Translate into Russian
|
"folder-search-timeout-error" : u"The search for media in '{}' was aborted as it took too long. This will occur if you select a folder with too many sub-folders in your list of media folders to search through. Until Syncplay is restarted only the directory of the currently open file will be checked.", #Folder # TODO: Translate into Russian
|
||||||
|
|
||||||
|
"failed-to-load-server-list-error" : u"Failed to load public server list. Please visit http://www.syncplay.pl/ in your browser.", # TODO: Translate into Russian
|
||||||
|
|
||||||
# Client arguments
|
# Client arguments
|
||||||
"argument-description" : u'Решение для синхронного воспроизведения в VLC, MPlayer или MPC-HC через Интернет.',
|
"argument-description" : u'Решение для синхронного воспроизведения в VLC, MPlayer или MPC-HC через Интернет.',
|
||||||
"argument-epilog" : u'Если параметр не будет передан, то будет использоваться значение, указанное в _config.',
|
"argument-epilog" : u'Если параметр не будет передан, то будет использоваться значение, указанное в _config.',
|
||||||
@ -534,6 +541,7 @@ ru = {
|
|||||||
"media-path-label" : u"Путь к видеофайлу:",
|
"media-path-label" : u"Путь к видеофайлу:",
|
||||||
"player-arguments-label" : u"Аргументы для запуска проигрывателя:",
|
"player-arguments-label" : u"Аргументы для запуска проигрывателя:",
|
||||||
"browse-label" : u"Выбрать",
|
"browse-label" : u"Выбрать",
|
||||||
|
"list-servers-label" : u"Find public server", # TODO: Translate into Russian
|
||||||
|
|
||||||
"more-title" : u"Больше настроек",
|
"more-title" : u"Больше настроек",
|
||||||
"never-rewind-value" : u"Никогда",
|
"never-rewind-value" : u"Никогда",
|
||||||
@ -638,6 +646,8 @@ ru = {
|
|||||||
"identifyascontroller-msgbox-label" : u"Войти как оператор комнаты",
|
"identifyascontroller-msgbox-label" : u"Войти как оператор комнаты",
|
||||||
"identifyinfo-msgbox-label" : u"Введите пароль оператора комнаты\r\n(см. инструкцию на странице http://syncplay.pl/guide/):",
|
"identifyinfo-msgbox-label" : u"Введите пароль оператора комнаты\r\n(см. инструкцию на странице http://syncplay.pl/guide/):",
|
||||||
|
|
||||||
|
"public-server-msgbox-label" : "Find public server (you must all use the same one!)", # TODO: Translate into Russian
|
||||||
|
|
||||||
"megabyte-suffix" : u" МБ", # Technically it is a mebibyte
|
"megabyte-suffix" : u" МБ", # Technically it is a mebibyte
|
||||||
|
|
||||||
# Tooltips
|
# Tooltips
|
||||||
@ -863,6 +873,8 @@ de = {
|
|||||||
"switch-file-not-found-error" : u"Could not switch to file '{0}'. Syncplay looks in the folder of the currently playing file and specified media directories.", # File not found, folder it was not found in # TODO: Translate into German
|
"switch-file-not-found-error" : u"Could not switch to file '{0}'. Syncplay looks in the folder of the currently playing file and specified media directories.", # File not found, folder it was not found in # TODO: Translate into German
|
||||||
"folder-search-timeout-error" : u"The search for media in '{}' was aborted as it took too long. This will occur if you select a folder with too many sub-folders in your list of media folders to search through. Until Syncplay is restarted only the directory of the currently open file will be checked.", #Folder # TODO: Translate into German
|
"folder-search-timeout-error" : u"The search for media in '{}' was aborted as it took too long. This will occur if you select a folder with too many sub-folders in your list of media folders to search through. Until Syncplay is restarted only the directory of the currently open file will be checked.", #Folder # TODO: Translate into German
|
||||||
|
|
||||||
|
"failed-to-load-server-list-error" : u"Failed to load public server list. Please visit http://www.syncplay.pl/ in your browser.", # TODO: Translate into German
|
||||||
|
|
||||||
# Client arguments
|
# Client arguments
|
||||||
"argument-description" : u'Syncplay ist eine Anwendung um mehrere MPlayer, MPC-HC und VLC-Instanzen über das Internet zu synchronisieren.',
|
"argument-description" : u'Syncplay ist eine Anwendung um mehrere MPlayer, MPC-HC und VLC-Instanzen über das Internet zu synchronisieren.',
|
||||||
"argument-epilog" : u'Wenn keine Optionen angegeben sind, werden die _config-Werte verwendet',
|
"argument-epilog" : u'Wenn keine Optionen angegeben sind, werden die _config-Werte verwendet',
|
||||||
@ -897,6 +909,7 @@ de = {
|
|||||||
"media-path-label" : u"Pfad zur Datei:",
|
"media-path-label" : u"Pfad zur Datei:",
|
||||||
"player-arguments-label" : u"Player arguments:", # TODO: Translate into German
|
"player-arguments-label" : u"Player arguments:", # TODO: Translate into German
|
||||||
"browse-label" : u"Durchsuchen",
|
"browse-label" : u"Durchsuchen",
|
||||||
|
"list-servers-label" : u"Find public server", # TODO: Translate into German
|
||||||
|
|
||||||
"more-title" : u"Mehr Einstellungen zeigen",
|
"more-title" : u"Mehr Einstellungen zeigen",
|
||||||
"never-rewind-value" : u"Niemals",
|
"never-rewind-value" : u"Niemals",
|
||||||
@ -999,6 +1012,8 @@ de = {
|
|||||||
"identifyascontroller-msgbox-label" : u"Als Raumleiter identifizieren",
|
"identifyascontroller-msgbox-label" : u"Als Raumleiter identifizieren",
|
||||||
"identifyinfo-msgbox-label" : u"Passwort des zentral gesteuerten Raums eingeben\r\n(siehe http://syncplay.pl/guide/ für eine Anleitung [Englisch]):",
|
"identifyinfo-msgbox-label" : u"Passwort des zentral gesteuerten Raums eingeben\r\n(siehe http://syncplay.pl/guide/ für eine Anleitung [Englisch]):",
|
||||||
|
|
||||||
|
"public-server-msgbox-label" : "Find public server (you must all use the same one!)", # TODO: Translate into German
|
||||||
|
|
||||||
"megabyte-suffix" : u" MB",
|
"megabyte-suffix" : u" MB",
|
||||||
|
|
||||||
# Tooltips
|
# Tooltips
|
||||||
|
|||||||
@ -226,6 +226,32 @@ class ConfigDialog(QtGui.QDialog):
|
|||||||
settings.setValue("ShowMoreSettings", morestate)
|
settings.setValue("ShowMoreSettings", morestate)
|
||||||
settings.endGroup()
|
settings.endGroup()
|
||||||
|
|
||||||
|
|
||||||
|
def findPublicServer(self):
|
||||||
|
try:
|
||||||
|
servers = utils.getListOfPublicServers()
|
||||||
|
except IOError as e:
|
||||||
|
self.showErrorMessage(unicode(e))
|
||||||
|
return
|
||||||
|
dialog = QtGui.QInputDialog()
|
||||||
|
dialog.setOption(QtGui.QInputDialog.UseListViewForComboBoxItems)
|
||||||
|
dialog.setWindowTitle(getMessage("public-server-msgbox-label"))
|
||||||
|
dialog.setLabelText(getMessage("public-server-msgbox-label"))
|
||||||
|
serverTitles = []
|
||||||
|
serverDict = {}
|
||||||
|
for server in servers:
|
||||||
|
serverTitle = server[0]
|
||||||
|
serverAddress = server[1]
|
||||||
|
serverTitles.append(serverTitle)
|
||||||
|
serverDict[serverTitle]=serverAddress
|
||||||
|
dialog.setComboBoxItems(serverTitles)
|
||||||
|
ok = dialog.exec_()
|
||||||
|
if ok:
|
||||||
|
self.hostTextbox.setText(serverDict[dialog.textValue()])
|
||||||
|
|
||||||
|
def showErrorMessage(self, errorMessage):
|
||||||
|
QtGui.QMessageBox.warning(self, "Syncplay", errorMessage)
|
||||||
|
|
||||||
def browseMediapath(self):
|
def browseMediapath(self):
|
||||||
self.loadMediaBrowseSettings()
|
self.loadMediaBrowseSettings()
|
||||||
options = QtGui.QFileDialog.Options()
|
options = QtGui.QFileDialog.Options()
|
||||||
@ -389,7 +415,10 @@ class ConfigDialog(QtGui.QDialog):
|
|||||||
self.connectionSettingsGroup = QtGui.QGroupBox(getMessage("connection-group-title"))
|
self.connectionSettingsGroup = QtGui.QGroupBox(getMessage("connection-group-title"))
|
||||||
self.hostTextbox = QLineEdit(host, self)
|
self.hostTextbox = QLineEdit(host, self)
|
||||||
self.hostLabel = QLabel(getMessage("host-label"), self)
|
self.hostLabel = QLabel(getMessage("host-label"), self)
|
||||||
|
self.findServerButton = QtGui.QPushButton(QtGui.QIcon(resourcespath + 'report_magnify.png'), getMessage("list-servers-label"))
|
||||||
|
self.findServerButton.clicked.connect(self.findPublicServer)
|
||||||
self.usernameTextbox = QLineEdit(self)
|
self.usernameTextbox = QLineEdit(self)
|
||||||
|
|
||||||
self.usernameTextbox.setObjectName("name")
|
self.usernameTextbox.setObjectName("name")
|
||||||
self.serverpassLabel = QLabel(getMessage("password-label"), self)
|
self.serverpassLabel = QLabel(getMessage("password-label"), self)
|
||||||
self.defaultroomTextbox = QLineEdit(self)
|
self.defaultroomTextbox = QLineEdit(self)
|
||||||
@ -409,12 +438,13 @@ class ConfigDialog(QtGui.QDialog):
|
|||||||
self.connectionSettingsLayout = QtGui.QGridLayout()
|
self.connectionSettingsLayout = QtGui.QGridLayout()
|
||||||
self.connectionSettingsLayout.addWidget(self.hostLabel, 0, 0)
|
self.connectionSettingsLayout.addWidget(self.hostLabel, 0, 0)
|
||||||
self.connectionSettingsLayout.addWidget(self.hostTextbox, 0, 1)
|
self.connectionSettingsLayout.addWidget(self.hostTextbox, 0, 1)
|
||||||
|
self.connectionSettingsLayout.addWidget(self.findServerButton, 0, 2)
|
||||||
self.connectionSettingsLayout.addWidget(self.serverpassLabel, 1, 0)
|
self.connectionSettingsLayout.addWidget(self.serverpassLabel, 1, 0)
|
||||||
self.connectionSettingsLayout.addWidget(self.serverpassTextbox, 1, 1)
|
self.connectionSettingsLayout.addWidget(self.serverpassTextbox, 1, 1, 1, 2)
|
||||||
self.connectionSettingsLayout.addWidget(self.usernameLabel, 2, 0)
|
self.connectionSettingsLayout.addWidget(self.usernameLabel, 2, 0)
|
||||||
self.connectionSettingsLayout.addWidget(self.usernameTextbox, 2, 1)
|
self.connectionSettingsLayout.addWidget(self.usernameTextbox, 2, 1, 1, 2)
|
||||||
self.connectionSettingsLayout.addWidget(self.defaultroomLabel, 3, 0)
|
self.connectionSettingsLayout.addWidget(self.defaultroomLabel, 3, 0)
|
||||||
self.connectionSettingsLayout.addWidget(self.defaultroomTextbox, 3, 1)
|
self.connectionSettingsLayout.addWidget(self.defaultroomTextbox, 3, 1, 1, 2)
|
||||||
self.connectionSettingsGroup.setLayout(self.connectionSettingsLayout)
|
self.connectionSettingsGroup.setLayout(self.connectionSettingsLayout)
|
||||||
self.connectionSettingsGroup.setMaximumHeight(self.connectionSettingsGroup.minimumSizeHint().height())
|
self.connectionSettingsGroup.setMaximumHeight(self.connectionSettingsGroup.minimumSizeHint().height())
|
||||||
|
|
||||||
|
|||||||
@ -10,6 +10,7 @@ import hashlib
|
|||||||
import random
|
import random
|
||||||
import string
|
import string
|
||||||
import urllib
|
import urllib
|
||||||
|
import ast
|
||||||
|
|
||||||
folderSearchEnabled = True
|
folderSearchEnabled = True
|
||||||
|
|
||||||
@ -260,6 +261,23 @@ def findFilenameInDirectories(filename, directoryList):
|
|||||||
raise IOError(getMessage("folder-search-timeout-error").format(directory))
|
raise IOError(getMessage("folder-search-timeout-error").format(directory))
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def getListOfPublicServers():
|
||||||
|
try:
|
||||||
|
import urllib, syncplay, sys, messages, json
|
||||||
|
params = urllib.urlencode({'version': syncplay.version, 'milestone': syncplay.milestone, 'release_number': syncplay.release_number,
|
||||||
|
'language': messages.messages["CURRENT"]})
|
||||||
|
f = urllib.urlopen(constants.SYNCPLAY_PUBLIC_SERVER_LIST_URL.format(params))
|
||||||
|
response = f.read()
|
||||||
|
response = response.replace("<p>","").replace("</p>","").replace("<br />","").replace("“","'").replace("”","'").replace(":’","'").replace("’","'").replace("′","'").replace("\n","").replace("\r","") # Fix Wordpress
|
||||||
|
response = ast.literal_eval(response)
|
||||||
|
|
||||||
|
if response:
|
||||||
|
return response
|
||||||
|
else:
|
||||||
|
raise IOError
|
||||||
|
except:
|
||||||
|
raise IOError(getMessage("failed-to-load-server-list-error"))
|
||||||
|
|
||||||
class RoomPasswordProvider(object):
|
class RoomPasswordProvider(object):
|
||||||
CONTROLLED_ROOM_REGEX = re.compile("^\+(.*):(\w{12})$")
|
CONTROLLED_ROOM_REGEX = re.compile("^\+(.*):(\w{12})$")
|
||||||
PASSWORD_REGEX = re.compile("[A-Z]{2}-\d{3}-\d{3}")
|
PASSWORD_REGEX = re.compile("[A-Z]{2}-\d{3}-\d{3}")
|
||||||
@ -320,3 +338,4 @@ class RandomStringGenerator(object):
|
|||||||
|
|
||||||
class NotControlledRoom(Exception):
|
class NotControlledRoom(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user