loop filler when our > duration
This commit is contained in:
parent
e302366f18
commit
beb1031932
@ -33,7 +33,7 @@ import requests
|
|||||||
from .filters.default import build_filtergraph
|
from .filters.default import build_filtergraph
|
||||||
from .utils import (MediaProbe, check_sync, get_date, get_delta, get_float,
|
from .utils import (MediaProbe, check_sync, get_date, get_delta, get_float,
|
||||||
get_time, messenger, playlist, src_or_dummy, stdin_args,
|
get_time, messenger, playlist, src_or_dummy, stdin_args,
|
||||||
storage, sync_op, valid_json)
|
sync_op, valid_json)
|
||||||
|
|
||||||
|
|
||||||
def handle_list_init(node):
|
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"]}')
|
f'Last clip less then 1 second long, skip:\n{node["source"]}')
|
||||||
node = None
|
node = None
|
||||||
else:
|
else:
|
||||||
missing_secs = abs(duration - (node['duration'] - node['seek']))
|
_, total_delta = get_delta(node['begin'])
|
||||||
messenger.error(
|
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']
|
out = node['out']
|
||||||
node = src_or_dummy(node)
|
node = src_or_dummy(node)
|
||||||
|
|
||||||
@ -383,8 +383,7 @@ class GetSourceFromPlaylist:
|
|||||||
'in': 0,
|
'in': 0,
|
||||||
'seek': 0,
|
'seek': 0,
|
||||||
'out': duration,
|
'out': duration,
|
||||||
'duration': duration + 1,
|
'duration': duration + 1
|
||||||
'source': storage.filler
|
|
||||||
}
|
}
|
||||||
|
|
||||||
self.generate_cmd()
|
self.generate_cmd()
|
||||||
|
@ -874,18 +874,19 @@ def gen_filler(node):
|
|||||||
|
|
||||||
if probe.format:
|
if probe.format:
|
||||||
if probe.format.get('duration'):
|
if probe.format.get('duration'):
|
||||||
filler_dur = float(probe.format['duration'])
|
node['duration'] = float(probe.format['duration'])
|
||||||
if filler_dur > duration:
|
node['source'] = storage.filler
|
||||||
|
if node['duration'] > duration:
|
||||||
# cut filler
|
# cut filler
|
||||||
messenger.info(
|
messenger.info(
|
||||||
f'Generate filler with {duration:.2f} seconds')
|
f'Generate filler with {duration:.2f} seconds')
|
||||||
node['source'] = storage.filler
|
|
||||||
node['src_cmd'] = ['-i', storage.filler] + set_length(
|
node['src_cmd'] = ['-i', storage.filler] + set_length(
|
||||||
filler_dur, 0, duration)
|
node['duration'], 0, duration)
|
||||||
return node
|
return node
|
||||||
|
|
||||||
# loop file n times
|
# 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
|
return node
|
||||||
|
|
||||||
messenger.error("Can't get filler length, generate dummy!")
|
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'],
|
['-i', node['source']] + set_length(node['duration'],
|
||||||
node['seek'], node['out'])
|
node['seek'], node['out'])
|
||||||
else:
|
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)
|
node = gen_filler(node)
|
||||||
|
|
||||||
return node
|
return node
|
||||||
|
Loading…
Reference in New Issue
Block a user