simplify generate_placeholder
This commit is contained in:
parent
7d139cce81
commit
6f38daec14
@ -25,7 +25,6 @@ import socket
|
|||||||
import time
|
import time
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from math import isclose
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
|
|
||||||
@ -34,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,
|
||||||
sync_op, valid_json)
|
storage, sync_op, valid_json)
|
||||||
|
|
||||||
|
|
||||||
def handle_list_init(node):
|
def handle_list_init(node):
|
||||||
@ -336,8 +335,6 @@ class GetSourceFromPlaylist:
|
|||||||
delta += seek + 1
|
delta += seek + 1
|
||||||
|
|
||||||
next_start = begin - playlist.start + out + delta
|
next_start = begin - playlist.start + out + delta
|
||||||
elif begin == playlist.start:
|
|
||||||
next_start = playlist.length + 1
|
|
||||||
else:
|
else:
|
||||||
delta, _ = get_delta(begin)
|
delta, _ = get_delta(begin)
|
||||||
next_start = begin - playlist.start + sync_op.threshold + delta
|
next_start = begin - playlist.start + sync_op.threshold + delta
|
||||||
@ -374,17 +371,7 @@ class GetSourceFromPlaylist:
|
|||||||
when playlist not exists, or is not long enough,
|
when playlist not exists, or is not long enough,
|
||||||
generate a placeholder node
|
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()
|
self.init_time()
|
||||||
begin = self.last_time
|
begin = self.last_time
|
||||||
|
|
||||||
@ -395,7 +382,7 @@ class GetSourceFromPlaylist:
|
|||||||
'seek': 0,
|
'seek': 0,
|
||||||
'out': duration,
|
'out': duration,
|
||||||
'duration': duration + 1,
|
'duration': duration + 1,
|
||||||
'source': None
|
'source': storage.filler
|
||||||
}
|
}
|
||||||
|
|
||||||
self.generate_cmd()
|
self.generate_cmd()
|
||||||
|
Loading…
Reference in New Issue
Block a user