diff --git a/ffplayout.conf b/ffplayout.conf index aeb0b5a9..1a2ea0a2 100644 --- a/ffplayout.conf +++ b/ffplayout.conf @@ -92,7 +92,7 @@ live_protocols = ["http", "https", "ftp", "rtmp", "rtmpe", "rtmps", "rtp", "rtsp [PLAYLIST] playlist_mode = True path = /playlists -day_start = 05:59:25.000 +day_start = 05:59:25 length = 24:00:00 diff --git a/ffplayout.py b/ffplayout.py index 7671e16f..64b08e81 100755 --- a/ffplayout.py +++ b/ffplayout.py @@ -104,17 +104,12 @@ def load_config(): """ cfg = configparser.ConfigParser() - def validate_time(t): - timeformat = "%H:%M:%S" - try: - datetime.strptime(t, timeformat) - return True - except ValueError: - print('wrong time format!') - sys.exit(1) - def str_to_sec(s): - return float(s[0]) * 3600 + float(s[1]) * 60 + float(s[2]) + s = s.split(':') + try: + return float(s[0]) * 3600 + float(s[1]) * 60 + float(s[2]) + except ValueError: + return None if stdin_args.config: cfg.read(stdin_args.config) @@ -124,24 +119,11 @@ def load_config(): cfg.read('ffplayout.conf') if stdin_args.start: - if stdin_args.start == 'now': - p_start = None - elif validate_time(stdin_args.start): - p_start = str_to_sec(stdin_args.start.split(':')) + p_start = str_to_sec(stdin_args.start) else: - stime = cfg.get('PLAYLIST', 'day_start') + p_start = str_to_sec(cfg.get('PLAYLIST', 'day_start')) - if validate_time(stime): - p_start = str_to_sec(stime.split(':')) - else: - p_start = None - - ltime = cfg.get('PLAYLIST', 'length').split(':') - - if ltime[0] and ltime[1] and ltime[2]: - p_length = str_to_sec(ltime) - else: - p_length = None + p_length = str_to_sec(cfg.get('PLAYLIST', 'length')) _general.stop = cfg.getboolean('GENERAL', 'stop_on_error') _general.threshold = cfg.getfloat('GENERAL', 'stop_threshold')