bcns-gameDistributionSystem/api/modules/db_connect.py
odecif edfb0d2162 Added printing of failed cover art
Also parametricised nfo suffix to look for

Fixes #18
2022-10-31 11:48:23 +01:00

38 lines
1.0 KiB
Python

import argparse
import configparser
import os
import inspect
def init():
global config
# Decide what config-file to use
parser = argparse.ArgumentParser()
parser.add_argument('-e', '--environment', choices=['dev', 'prod', 'test'],
default='prod',
help='choose what environment type to run.'
' Defaults to prod')
args = parser.parse_args()
if args.environment == 'dev':
print("Using devapi.conf")
configfile = '/../devapi.conf'
elif args.environment == 'test':
print("Using testapi.conf")
configfile = '/../testapi.conf'
else:
print("Using api.conf")
configfile = '/../api.conf'
config = configparser.RawConfigParser()
config.read(os.path.dirname(
os.path.abspath(inspect.getfile(
inspect.currentframe()))) + configfile)
def contentpath():
return(config.get('Database','contentpath'))
def nfosuffix():
return(config.get('Database','nfo_suffix'))