Added syncplay.ini as an optional config name
This commit is contained in:
parent
79a94c08d6
commit
88a68b11e6
@ -5,7 +5,7 @@ OSD_WARNING_MESSAGE_DURATION = 15
|
|||||||
MPC_OSD_POSITION = 2 #Right corner, 1 for left
|
MPC_OSD_POSITION = 2 #Right corner, 1 for left
|
||||||
MPLAYER_OSD_LEVEL = 1
|
MPLAYER_OSD_LEVEL = 1
|
||||||
UI_TIME_FORMAT = "[%X] "
|
UI_TIME_FORMAT = "[%X] "
|
||||||
DEFAULT_CONFIG_NAME = ".syncplay"
|
DEFAULT_CONFIG_NAMES = [".syncplay", "syncplay.ini"]
|
||||||
|
|
||||||
#Changing these might be ok
|
#Changing these might be ok
|
||||||
REWIND_THRESHOLD = 4
|
REWIND_THRESHOLD = 4
|
||||||
|
|||||||
@ -144,16 +144,20 @@ class ConfigurationGetter(object):
|
|||||||
|
|
||||||
def _checkForPortableFile(self):
|
def _checkForPortableFile(self):
|
||||||
path = utils.findWorkingDir()
|
path = utils.findWorkingDir()
|
||||||
if(os.path.isfile(os.path.join(path, constants.DEFAULT_CONFIG_NAME))):
|
for name in constants.DEFAULT_CONFIG_NAMES:
|
||||||
return os.path.join(path, constants.DEFAULT_CONFIG_NAME)
|
if(os.path.isfile(os.path.join(path, name))):
|
||||||
|
return os.path.join(path, name)
|
||||||
|
|
||||||
def _getConfigurationFilePath(self):
|
def _getConfigurationFilePath(self):
|
||||||
configFile = self._checkForPortableFile()
|
configFile = self._checkForPortableFile()
|
||||||
if(not configFile):
|
if not configFile:
|
||||||
if(os.name <> 'nt'):
|
for name in constants.DEFAULT_CONFIG_NAMES:
|
||||||
configFile = os.path.join(os.getenv('HOME', '.'), constants.DEFAULT_CONFIG_NAME)
|
if(configFile and os.path.isfile(configFile)):
|
||||||
else:
|
break
|
||||||
configFile = os.path.join(os.getenv('APPDATA', '.'), constants.DEFAULT_CONFIG_NAME)
|
if(os.name <> 'nt'):
|
||||||
|
configFile = os.path.join(os.getenv('HOME', '.'), name)
|
||||||
|
else:
|
||||||
|
configFile = os.path.join(os.getenv('APPDATA', '.'), name)
|
||||||
return configFile
|
return configFile
|
||||||
|
|
||||||
def _parseConfigFile(self, iniPath, createConfig = True):
|
def _parseConfigFile(self, iniPath, createConfig = True):
|
||||||
@ -242,9 +246,10 @@ class ConfigurationGetter(object):
|
|||||||
def _loadRelativeConfiguration(self):
|
def _loadRelativeConfiguration(self):
|
||||||
locations = self.__getRelativeConfigLocations()
|
locations = self.__getRelativeConfigLocations()
|
||||||
for location in locations:
|
for location in locations:
|
||||||
path = location + os.path.sep + constants.DEFAULT_CONFIG_NAME
|
for name in constants.DEFAULT_CONFIG_NAMES:
|
||||||
self._parseConfigFile(path, createConfig = False)
|
path = location + os.path.sep + name
|
||||||
self._checkConfig()
|
self._parseConfigFile(path, createConfig = False)
|
||||||
|
self._checkConfig()
|
||||||
|
|
||||||
def getConfiguration(self):
|
def getConfiguration(self):
|
||||||
iniPath = self._getConfigurationFilePath()
|
iniPath = self._getConfigurationFilePath()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user