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

View File

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

View File

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

View File

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

View File

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