mirror of
				https://github.com/Thor77/TeamspeakStats.git
				synced 2025-11-03 23:32:45 -05:00 
			
		
		
		
	add onlinedc config-option
* inverse of --noonlinedc
This commit is contained in:
		
							parent
							
								
									573838c35e
								
							
						
					
					
						commit
						892680fe4d
					
				
					 3 changed files with 9 additions and 4 deletions
				
			
		| 
						 | 
					@ -53,7 +53,7 @@ def main(config=None, idmap=None, log=None,
 | 
				
			||||||
        config = abspath(config)
 | 
					        config = abspath(config)
 | 
				
			||||||
        if not exists(config):
 | 
					        if not exists(config):
 | 
				
			||||||
            logger.fatal('config not found (%s)', config)
 | 
					            logger.fatal('config not found (%s)', config)
 | 
				
			||||||
        idmap, log, output, debug = parse_config(config)
 | 
					        idmap, log, output, debug, noonlinedc = parse_config(config)
 | 
				
			||||||
        if debug:
 | 
					        if debug:
 | 
				
			||||||
            logger.setLevel(logging.DEBUG)
 | 
					            logger.setLevel(logging.DEBUG)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -28,10 +28,13 @@ def parse_config(config_path):
 | 
				
			||||||
    config_items = dict(config.items('General'))
 | 
					    config_items = dict(config.items('General'))
 | 
				
			||||||
    if 'debug' in config_items:
 | 
					    if 'debug' in config_items:
 | 
				
			||||||
        config_items['debug'] = config.getboolean('General', 'debug')
 | 
					        config_items['debug'] = config.getboolean('General', 'debug')
 | 
				
			||||||
 | 
					    if 'onlinedc' in config_items:
 | 
				
			||||||
 | 
					        config_items['onlinedc'] = config.getboolean('General', 'onlinedc')
 | 
				
			||||||
    logger.debug('raw config: %s', config_items)
 | 
					    logger.debug('raw config: %s', config_items)
 | 
				
			||||||
    return (
 | 
					    return (
 | 
				
			||||||
        config_items.get('idmap'),
 | 
					        config_items.get('idmap'),
 | 
				
			||||||
        config_items.get('log'),
 | 
					        config_items.get('log'),
 | 
				
			||||||
        config_items.get('output'),
 | 
					        config_items.get('output'),
 | 
				
			||||||
        config_items.get('debug', False)
 | 
					        config_items.get('debug', False),
 | 
				
			||||||
 | 
					        config_items.get('onlinedc', True)
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -35,10 +35,12 @@ def test_config(config):
 | 
				
			||||||
        'idmap': 'tsstats/tests/res/id_map.json',
 | 
					        'idmap': 'tsstats/tests/res/id_map.json',
 | 
				
			||||||
        'log': 'tsstats/tests/res/test.log',
 | 
					        'log': 'tsstats/tests/res/test.log',
 | 
				
			||||||
        'output': 'output.html',
 | 
					        'output': 'output.html',
 | 
				
			||||||
        'debug': 'true'
 | 
					        'debug': 'true',
 | 
				
			||||||
 | 
					        'onlinedc': 'false'
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
    idmap, log, output, debug = parse_config(configpath)
 | 
					    idmap, log, output, debug, onlinedc = parse_config(configpath)
 | 
				
			||||||
    assert idmap == 'tsstats/tests/res/id_map.json'
 | 
					    assert idmap == 'tsstats/tests/res/id_map.json'
 | 
				
			||||||
    assert log == 'tsstats/tests/res/test.log'
 | 
					    assert log == 'tsstats/tests/res/test.log'
 | 
				
			||||||
    assert output == 'output.html'
 | 
					    assert output == 'output.html'
 | 
				
			||||||
    assert debug is True
 | 
					    assert debug is True
 | 
				
			||||||
 | 
					    assert onlinedc is False
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue