Merge pull request #55 from ffplayout/dev

add backup count to config
This commit is contained in:
jb-alvarado 2020-05-30 22:21:23 +02:00 committed by GitHub
commit e3d29c0659
4 changed files with 17 additions and 13 deletions

View File

@ -38,12 +38,14 @@ leave recipient blank, if you don't need this.
```YAML
logging:
log_to_file: True
backup_count: 7
log_path: "/var/log/ffplayout/"
log_level: "DEBUG"
ffmpeg_level: "ERROR"
```
Logging to file, if `log_to_file = False` > log to console.
`backup_count` says how long log files will be saved in days.
Path to **/var/log/** only if you run this program as *deamon*.
`log_level` can be: **DEBUG, INFO, WARNING, ERROR**
`ffmpeg_level` can be: **INFO, WARNING, ERROR**

View File

@ -37,7 +37,7 @@ except ImportError:
print('colorama import failed, no colored console output on windows...')
_WINDOWS = os.name == 'nt'
COPY_BUFSIZE = 1024 * 1024 if _WINDOWS else 64 * 1024
COPY_BUFSIZE = 1024 * 1024 if _WINDOWS else 65424
# ------------------------------------------------------------------------------
@ -66,7 +66,8 @@ def main():
_text.address
))
overlay = [
'-vf', "null,zmq=b=tcp\\\://'{}',drawtext=text='':fontfile='{}'".format(
'-vf',
"null,zmq=b=tcp\\\\://'{}',drawtext=text='':fontfile='{}'".format(
_text.address.replace(':', '\\:'), _text.fontfile)
]
@ -79,8 +80,8 @@ def main():
else:
_ff.encoder = Popen([
'ffmpeg', '-v', _log.ff_level.lower(), '-hide_banner',
'-nostats', '-re', '-thread_queue_size', '256',
'-i', 'pipe:0'] + overlay + [
'-nostats', '-re', '-thread_queue_size', '256', '-i', 'pipe:0'
] + overlay + [
'-metadata', 'service_name=' + _playout.name,
'-metadata', 'service_provider=' + _playout.provider,
'-metadata', 'year={}'.format(year)

View File

@ -21,10 +21,12 @@ mail:
mail_level: "ERROR"
logging:
helptext: Logging to file, if 'log_to_file' False log to console. Path to /var/log/
only if you run this program as deamon. 'log_level' can be DEBUG, INFO, WARNING,
helptext: Logging to file, if 'log_to_file' False log to console. 'backup_count'
says how long log files will be saved in days. Path to /var/log/ only if you
run this program as deamon. 'log_level' can be DEBUG, INFO, WARNING,
ERROR. 'ffmpeg_level' can be INFO, WARNING, ERROR.
log_to_file: True
backup_count: 7
log_path: "/var/log/ffplayout/"
log_level: "DEBUG"
ffmpeg_level: "ERROR"

View File

@ -204,6 +204,7 @@ def load_config():
if _init.load:
_log.to_file = cfg['logging']['log_to_file']
_log.backup_count = cfg['logging']['backup_count']
_log.path = cfg['logging']['log_path']
_log.level = cfg['logging']['log_level']
_log.ff_level = cfg['logging']['ffmpeg_level']
@ -307,11 +308,11 @@ if _log.to_file and _log.path != 'none':
p_format = logging.Formatter('[%(asctime)s] [%(levelname)s] %(message)s')
f_format = logging.Formatter('[%(asctime)s] %(message)s')
p_file_handler = TimedRotatingFileHandler(playout_log, when='midnight',
backupCount=5)
backupCount=_log.backup_count)
d_file_handler = TimedRotatingFileHandler(decoder_log, when='midnight',
backupCount=5)
backupCount=_log.backup_count)
e_file_handler = TimedRotatingFileHandler(encoder_log, when='midnight',
backupCount=5)
backupCount=_log.backup_count)
p_file_handler.setFormatter(p_format)
d_file_handler.setFormatter(f_format)
@ -990,8 +991,6 @@ def pre_audio_codec():
"""
if _pre_comp.add_loudnorm:
acodec = 'libtwolame' if 'libtwolame' in FF_LIBS['libs'] else 'mp2'
audio = ['-c:a', acodec, '-b:a', '384k', '-ar', '48000', '-ac', '2']
return ['-c:a', acodec, '-b:a', '384k', '-ar', '48000', '-ac', '2']
else:
audio = ['-c:a', 's302m', '-strict', '-2', '-ar', '48000', '-ac', '2']
return audio
return ['-c:a', 's302m', '-strict', '-2', '-ar', '48000', '-ac', '2']