Broaden getFilePathErrors into getPlayerPathErrors

This commit is contained in:
Et0h 2014-11-30 15:05:29 +00:00
parent 45e576e4f2
commit 7ca29bf30b
5 changed files with 11 additions and 12 deletions

View File

@ -91,15 +91,14 @@ class BasePlayer(object):
raise NotImplementedError() raise NotImplementedError()
''' '''
@type playerPath: string
@type filePath: string @type filePath: string
@return errorMessage: string @return errorMessage: string
Checks if the player has any problems with the given file (or lack of file) Checks if the player has any problems with the given player/file path
If a problem is detected then it returns the error message
If the file is fine then it returns None
''' '''
@staticmethod @staticmethod
def getFilePathErrors(filePath): def getPlayerPathErrors(playerPath, filePath):
raise NotImplementedError() raise NotImplementedError()
class DummyPlayer(BasePlayer): class DummyPlayer(BasePlayer):
@ -121,5 +120,5 @@ class DummyPlayer(BasePlayer):
return path return path
@staticmethod @staticmethod
def getFilePathErrors(filePath): def getPlayerPathErrors(playerPath, filePath):
return None return None

View File

@ -333,7 +333,7 @@ class MPCHCAPIPlayer(BasePlayer):
self._mpcApi.sendRawCommand(MpcHcApi.CMD_CLOSEAPP, "") self._mpcApi.sendRawCommand(MpcHcApi.CMD_CLOSEAPP, "")
@staticmethod @staticmethod
def getFilePathErrors(filePath): def getPlayerPathErrors(playerPath, filePath):
return None return None
@staticmethod @staticmethod

View File

@ -213,7 +213,7 @@ class MplayerPlayer(BasePlayer):
return False return False
@staticmethod @staticmethod
def getFilePathErrors(filePath): def getPlayerPathErrors(playerPath, filePath):
if not filePath: if not filePath:
return getMessage("no-file-path-config-error") return getMessage("no-file-path-config-error")

View File

@ -201,7 +201,7 @@ class VlcPlayer(BasePlayer):
return False return False
@staticmethod @staticmethod
def getFilePathErrors(filePath): def getPlayerPathErrors(playerPath, filePath):
return None return None
@staticmethod @staticmethod

View File

@ -145,9 +145,9 @@ class ConfigurationGetter(object):
self._config["playerClass"] = player self._config["playerClass"] = player
else: else:
raise InvalidConfigValue(getMessage("player-path-config-error")) raise InvalidConfigValue(getMessage("player-path-config-error"))
fileErrors = player.getFilePathErrors(self._config['file'] if self._config['file'] else None) playerPathErrors = player.getPlayerPathErrors(self._config["playerPath"], self._config['file'] if self._config['file'] else None)
if fileErrors: if playerPathErrors:
raise InvalidConfigValue(fileErrors) raise InvalidConfigValue(playerPathErrors)
elif key == "host": elif key == "host":
self._config["host"], self._config["port"] = self._splitPortAndHost(self._config["host"]) self._config["host"], self._config["port"] = self._splitPortAndHost(self._config["host"])
hostNotValid = (self._config["host"] == "" or self._config["host"] is None) hostNotValid = (self._config["host"] == "" or self._config["host"] is None)