diff --git a/ffplayout/playlist.py b/ffplayout/playlist.py index f84540c2..6150244e 100644 --- a/ffplayout/playlist.py +++ b/ffplayout/playlist.py @@ -33,7 +33,7 @@ import requests from .filters.default import build_filtergraph from .utils import (MediaProbe, check_sync, get_date, get_delta, get_float, get_time, messenger, playlist, src_or_dummy, stdin_args, - storage, sync_op, valid_json) + sync_op, valid_json) def handle_list_init(node): @@ -88,9 +88,9 @@ def handle_list_end(duration, node): f'Last clip less then 1 second long, skip:\n{node["source"]}') node = None else: - missing_secs = abs(duration - (node['duration'] - node['seek'])) + _, total_delta = get_delta(node['begin']) messenger.error( - f'Playlist is not long enough:\n{missing_secs:.2f} seconds needed') + f'Playlist is not long enough:\n{total_delta:.2f} seconds needed') out = node['out'] node = src_or_dummy(node) @@ -383,8 +383,7 @@ class GetSourceFromPlaylist: 'in': 0, 'seek': 0, 'out': duration, - 'duration': duration + 1, - 'source': storage.filler + 'duration': duration + 1 } self.generate_cmd() diff --git a/ffplayout/utils.py b/ffplayout/utils.py index 5c0adc4d..ed2f6dfd 100644 --- a/ffplayout/utils.py +++ b/ffplayout/utils.py @@ -874,18 +874,19 @@ def gen_filler(node): if probe.format: if probe.format.get('duration'): - filler_dur = float(probe.format['duration']) - if filler_dur > duration: + node['duration'] = float(probe.format['duration']) + node['source'] = storage.filler + if node['duration'] > duration: # cut filler messenger.info( f'Generate filler with {duration:.2f} seconds') - node['source'] = storage.filler node['src_cmd'] = ['-i', storage.filler] + set_length( - filler_dur, 0, duration) + node['duration'], 0, duration) return node # loop file n times - node['src_cmd'] = loop_input(storage.filler, filler_dur, duration) + node['src_cmd'] = loop_input( + storage.filler, node['duration'], duration) return node messenger.error("Can't get filler length, generate dummy!") @@ -939,7 +940,8 @@ def src_or_dummy(node): ['-i', node['source']] + set_length(node['duration'], node['seek'], node['out']) else: - messenger.error(f'File not exist: {node.get("source")}') + if 'source' in node: + messenger.error(f'File not exist: {node.get("source")}') node = gen_filler(node) return node