mirror of
				https://github.com/Thor77/TeamspeakStats.git
				synced 2025-11-03 15:22:45 -05:00 
			
		
		
		
	fix path for config and template
This commit is contained in:
		
							parent
							
								
									df4e563714
								
							
						
					
					
						commit
						26c518ddfe
					
				
					 1 changed files with 11 additions and 8 deletions
				
			
		
							
								
								
									
										19
									
								
								tsstats.py
									
										
									
									
									
								
							
							
						
						
									
										19
									
								
								tsstats.py
									
										
									
									
									
								
							| 
						 | 
					@ -5,9 +5,19 @@ from time import mktime
 | 
				
			||||||
from datetime import datetime, timedelta
 | 
					from datetime import datetime, timedelta
 | 
				
			||||||
from jinja2 import Environment, FileSystemLoader
 | 
					from jinja2 import Environment, FileSystemLoader
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# get path
 | 
				
			||||||
 | 
					arg = sys.argv[0]
 | 
				
			||||||
 | 
					arg_find = arg.rfind('/')
 | 
				
			||||||
 | 
					if arg_find == -1:
 | 
				
			||||||
 | 
					    path = '.'
 | 
				
			||||||
 | 
					else:
 | 
				
			||||||
 | 
					    path = arg[:arg_find]
 | 
				
			||||||
 | 
					path += '/'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# parse config
 | 
					# parse config
 | 
				
			||||||
config = configparser.ConfigParser()
 | 
					config = configparser.ConfigParser()
 | 
				
			||||||
config.read('config.ini')
 | 
					config.read(path + 'config.ini')
 | 
				
			||||||
if 'General' not in config or not ('logfile' in config['General'] and 'outputfile' in config['General']):
 | 
					if 'General' not in config or not ('logfile' in config['General'] and 'outputfile' in config['General']):
 | 
				
			||||||
    print('Invalid configuration!')
 | 
					    print('Invalid configuration!')
 | 
				
			||||||
    import sys
 | 
					    import sys
 | 
				
			||||||
| 
						 | 
					@ -128,13 +138,6 @@ def desc(key):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def render_template():
 | 
					def render_template():
 | 
				
			||||||
    arg = sys.argv[0]
 | 
					 | 
				
			||||||
    arg_find = arg.rfind('/')
 | 
					 | 
				
			||||||
    if arg_find == -1:
 | 
					 | 
				
			||||||
        path = '.'
 | 
					 | 
				
			||||||
    else:
 | 
					 | 
				
			||||||
        path = arg[:arg_find] + '/'
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    env = Environment(loader=FileSystemLoader(path))
 | 
					    env = Environment(loader=FileSystemLoader(path))
 | 
				
			||||||
    template = env.get_template('template.html')
 | 
					    template = env.get_template('template.html')
 | 
				
			||||||
    # format onlinetime
 | 
					    # format onlinetime
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue