From 67c58c824012814c01c33cca335497cb621ad309 Mon Sep 17 00:00:00 2001 From: Jonathan Baecker Date: Tue, 11 Jun 2019 15:28:52 +0200 Subject: [PATCH] reorder variables --- ffplayout.conf | 11 +++++------ ffplayout.py | 12 ++++++------ 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/ffplayout.conf b/ffplayout.conf index 1b1f022a..35ca79c6 100644 --- a/ffplayout.conf +++ b/ffplayout.conf @@ -116,19 +116,18 @@ shuffle = False # overlay text # for paramters check ffmpeg doc -# with show you can enable/disable the filter +# leave textfile blank when you don't need this # in some systems decimal point is a comma, have this in mind when ffmpeg complains about wrong values # on windows fontfile path need to be like this: C\:/WINDOWS/fonts/DejaVuSans.ttf # textfile has the same pattern [TEXT] -show = True -box = 1 -boxcolor = black@0xbb -boxborderw = 6 +textfile = /opt/live.txt fontsize = 24 fontcolor = white fontfile = /usr/share/fonts/truetype/dejavu/DejaVuSans.ttf -textfile = /opt/live.txt +box = 1 +boxcolor = black@0xbb +boxborderw = 6 x = w-w/8*mod(t,8*(w+tw)/w) y = (h-line_h)*0.9 diff --git a/ffplayout.py b/ffplayout.py index 61c2986b..cddf2a4b 100755 --- a/ffplayout.py +++ b/ffplayout.py @@ -108,14 +108,13 @@ _folder = SimpleNamespace( ) _text = SimpleNamespace( - show=cfg.getboolean('TEXT', 'show'), - box=cfg.get('TEXT', 'box'), - boxcolor=cfg.get('TEXT', 'boxcolor'), - boxborderw=cfg.get('TEXT', 'boxborderw'), + textfile=cfg.get('TEXT', 'textfile'), fontsize=cfg.get('TEXT', 'fontsize'), fontcolor=cfg.get('TEXT', 'fontcolor'), fontfile=cfg.get('TEXT', 'fontfile'), - textfile=cfg.get('TEXT', 'textfile'), + box=cfg.get('TEXT', 'box'), + boxcolor=cfg.get('TEXT', 'boxcolor'), + boxborderw=cfg.get('TEXT', 'boxborderw'), x=cfg.get('TEXT', 'x'), y=cfg.get('TEXT', 'y') ) @@ -1029,7 +1028,8 @@ def main(): '-ar', '48000', '-ac', '2', '-f', 'mpegts', '-'] - if _text.show: + if os.path.isfile(_text.textfile): + logger.info('Use text file "{}" for overlay'.format(_text.textfile)) overlay = [ '-vf', ("drawtext=box={}:boxcolor='{}':boxborderw={}:fontsize={}" ":fontcolor={}:fontfile='{}':textfile={}:reload=1"