boolean option for showing logo and text, #34

This commit is contained in:
jb-alvarado 2019-10-29 21:25:09 +01:00
parent a630b6a777
commit 644738c3db
2 changed files with 6 additions and 2 deletions

View File

@ -69,6 +69,7 @@ width = 1024
height = 576 height = 576
aspect = 1.778 aspect = 1.778
fps = 25 fps = 25
add_logo = True
logo = logo.png logo = logo.png
logo_opacity = 0.7 logo_opacity = 0.7
logo_filter = overlay=W-w-12:12 logo_filter = overlay=W-w-12:12
@ -114,6 +115,7 @@ shuffle = False
; on windows fontfile path need to be like this: C\:/WINDOWS/fonts/DejaVuSans.ttf ; on windows fontfile path need to be like this: C\:/WINDOWS/fonts/DejaVuSans.ttf
; textfile has the same pattern ; textfile has the same pattern
[TEXT] [TEXT]
add_text = True
textfile = /media/live.txt textfile = /media/live.txt
fontsize = 24 fontsize = 24
fontcolor = white fontcolor = white

View File

@ -115,6 +115,7 @@ _pre_comp = SimpleNamespace(
fps=cfg.getint('PRE_COMPRESS', 'fps'), fps=cfg.getint('PRE_COMPRESS', 'fps'),
v_bitrate=cfg.getint('PRE_COMPRESS', 'width') * 50, v_bitrate=cfg.getint('PRE_COMPRESS', 'width') * 50,
v_bufsize=cfg.getint('PRE_COMPRESS', 'width') * 50 / 2, v_bufsize=cfg.getint('PRE_COMPRESS', 'width') * 50 / 2,
add_logo=cfg.getboolean('PRE_COMPRESS', 'add_logo'),
logo=cfg.get('PRE_COMPRESS', 'logo'), logo=cfg.get('PRE_COMPRESS', 'logo'),
opacity=cfg.get('PRE_COMPRESS', 'logo_opacity'), opacity=cfg.get('PRE_COMPRESS', 'logo_opacity'),
logo_filter=cfg.get('PRE_COMPRESS', 'logo_filter'), logo_filter=cfg.get('PRE_COMPRESS', 'logo_filter'),
@ -146,6 +147,7 @@ _storage = SimpleNamespace(
) )
_text = SimpleNamespace( _text = SimpleNamespace(
add_text=cfg.getboolean('TEXT', 'add_text'),
textfile=cfg.get('TEXT', 'textfile'), textfile=cfg.get('TEXT', 'textfile'),
fontsize=cfg.get('TEXT', 'fontsize'), fontsize=cfg.get('TEXT', 'fontsize'),
fontcolor=cfg.get('TEXT', 'fontcolor'), fontcolor=cfg.get('TEXT', 'fontcolor'),
@ -805,7 +807,7 @@ def overlay_filter(duration, ad, ad_last, ad_next):
""" """
logo_filter = '[v]null[logo]' logo_filter = '[v]null[logo]'
if os.path.isfile(_pre_comp.logo) and not ad: if _pre_comp.add_logo and os.path.isfile(_pre_comp.logo) and not ad:
logo_chain = [] logo_chain = []
opacity = 'format=rgba,colorchannelmixer=aa={}'.format( opacity = 'format=rgba,colorchannelmixer=aa={}'.format(
_pre_comp.opacity) _pre_comp.opacity)
@ -1404,7 +1406,7 @@ def main():
'-c:a', 's302m', '-strict', '-2', '-ar', '48000', '-ac', '2', '-c:a', 's302m', '-strict', '-2', '-ar', '48000', '-ac', '2',
'-f', 'mpegts', '-'] '-f', 'mpegts', '-']
if os.path.isfile(_text.textfile): if _text.add_text and os.path.isfile(_text.textfile):
messenger.info('Overlay text file: "{}"'.format(_text.textfile)) messenger.info('Overlay text file: "{}"'.format(_text.textfile))
overlay = [ overlay = [
'-vf', ("drawtext=box={}:boxcolor='{}':boxborderw={}" '-vf', ("drawtext=box={}:boxcolor='{}':boxborderw={}"