diff --git a/ffplayout.conf b/ffplayout.conf index 70e6371c..44374356 100644 --- a/ffplayout.conf +++ b/ffplayout.conf @@ -15,6 +15,17 @@ # ------------------------------------------------------------------------------ +# sometimes it can happen, that a file is corrupt but still playable, +# this can produce an streaming error over all following files +# the only way in this case is, to stop ffplayout and start it again +# here we only say it can stop, the starting process is in your hand +# best way is a systemd serivce on linux +# stop_threshold: stop ffplayout, if it is async in time above this value +# in copy mode this is tricky + +[GENERAL] +stop_on_error = True +stop_threshold = 12 # send error messages to email address, like: # missing playlist diff --git a/ffplayout.py b/ffplayout.py index dfa66f4f..eb9e683f 100755 --- a/ffplayout.py +++ b/ffplayout.py @@ -49,6 +49,11 @@ if os.path.exists("/etc/ffplayout/ffplayout.conf"): else: cfg.read("ffplayout.conf") +_general = SimpleNamespace( + stop=cfg.get('GENERAL', 'stop_on_error'), + threshold=cfg.get('GENERAL', 'stop_threshold') +) + _mail = SimpleNamespace( subject=cfg.get('MAIL', 'subject'), server=cfg.get('MAIL', 'smpt_server'), @@ -395,6 +400,10 @@ def check_sync(begin): ) logger.error('Playlist is {} seconds async!'.format(t_dist)) + if _general.stop and t_dist > _general.threshold: + logger.error('Sync tolerance value exceeded, program is terminated') + exit() + # prepare input clip # check begin and length from clip