mirror of
https://github.com/stronk-dev/Guitar-Sheet-Parser.git
synced 2025-07-05 08:25:09 +02:00
In combination with the dynamic up/down sizing to fit whitespace, we get pretty good output images Also removed the check that we do not resize the font size that much fixes #13
50 lines
1.4 KiB
Python
50 lines
1.4 KiB
Python
#!/usr/bin/env python3
|
|
##
|
|
# @file config.py
|
|
#
|
|
# @brief This program contains functions to load & create the program configuration
|
|
#
|
|
# @section description Description
|
|
# Contains the default values for all parameters
|
|
# Can create the config file update it with new settings
|
|
#
|
|
# @section notes Notes
|
|
# -
|
|
#
|
|
# @section todo TODO
|
|
# - if CMD arguments: load CMD arguments to override defaults
|
|
|
|
import os
|
|
import configparser
|
|
|
|
|
|
"""!@brief Load, creates and keeps the config up to date
|
|
"""
|
|
def initConfig():
|
|
# Default config
|
|
global config
|
|
config = configparser.ConfigParser()
|
|
# If a config file exists, load it
|
|
if os.path.isfile('./config.ini'):
|
|
config.read('config.ini')
|
|
# Else load defaults
|
|
else:
|
|
config['input'] = {'inputFolders': os.getcwd(),
|
|
'supportedExtensions': ".txt",
|
|
'maxDepth': 3
|
|
}
|
|
config['output'] = {'metafontfamily': 'fonts/CourierPrime-Regular.ttf',
|
|
'metaFontWeight': 16,
|
|
'lyricfontfamily': 'fonts/CourierPrime-Regular.ttf',
|
|
'tablaturefontfamliy': 'fonts/CourierPrime-Bold.ttf',
|
|
'imageppi': 144,
|
|
'backgroundColour': '255,255,255',
|
|
'fontColour': '0,0,0',
|
|
'metadataColour': '128,128,128',
|
|
'topMargin': 10,
|
|
'leftMargin': 25,
|
|
'rightMargin': 25
|
|
}
|
|
# (if CMD arguments: load CMD arguments to override specific settings)
|
|
with open('config.ini', 'w') as configfile:
|
|
config.write(configfile) |