simplify generate_placeholder

This commit is contained in:
jonathan 2021-06-22 18:04:09 +02:00
parent 7d139cce81
commit 6f38daec14

View File

@ -25,7 +25,6 @@ import socket
import time
from copy import deepcopy
from datetime import timedelta
from math import isclose
from pathlib import Path
from threading import Thread
@ -34,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,
sync_op, valid_json)
storage, sync_op, valid_json)
def handle_list_init(node):
@ -336,8 +335,6 @@ class GetSourceFromPlaylist:
delta += seek + 1
next_start = begin - playlist.start + out + delta
elif begin == playlist.start:
next_start = playlist.length + 1
else:
delta, _ = get_delta(begin)
next_start = begin - playlist.start + sync_op.threshold + delta
@ -374,17 +371,7 @@ class GetSourceFromPlaylist:
when playlist not exists, or is not long enough,
generate a placeholder node
"""
current_time = get_time('full_sec')
if playlist.start == 0:
current_time -= 86400
# balance small difference to start time
if playlist.start is not None and isclose(playlist.start,
current_time, abs_tol=1.5):
self.node = None
self.check_for_next_playlist(playlist.start)
else:
self.init_time()
begin = self.last_time
@ -395,7 +382,7 @@ class GetSourceFromPlaylist:
'seek': 0,
'out': duration,
'duration': duration + 1,
'source': None
'source': storage.filler
}
self.generate_cmd()