release: 1.2.4

This commit is contained in:
acgnhik 2022-01-15 19:11:59 +08:00
parent 047c098271
commit e8d655ef2b
5 changed files with 31 additions and 3 deletions

View File

@ -1,5 +1,10 @@
# 更新日志
## 1.2.4
- 修复回收空间时文件不存在异常
- 修复章节标记时间异常导致转封装出错
## 1.2.3
- 修复直播间标题有特殊字符导致文件创建失败

View File

@ -1,4 +1,4 @@
__prog__ = 'blrec'
__version__ = '1.2.3'
__version__ = '1.2.4'
__github__ = 'https://github.com/acgnhiki/blrec'

View File

@ -331,6 +331,9 @@ class StreamRecorder(
logger.debug('Response received')
response.raise_for_status()
if self._stopped:
return
assert self._stream_processor is not None
self._stream_processor.process_stream(
io.BufferedReader(

View File

@ -7,6 +7,12 @@ import asyncio
from functools import partial
from typing import Iterable, List
from tenacity import (
retry,
wait_none,
stop_after_attempt,
retry_if_exception_type,
)
from .helpers import delete_file, is_space_enough
from .space_monitor import SpaceMonitor, DiskUsage, SpaceEventListener
@ -65,6 +71,11 @@ class SpaceReclaimer(SpaceEventListener, SwitchableMixin):
return True
return False
@retry(
retry=retry_if_exception_type(OSError),
wait=wait_none(),
stop=stop_after_attempt(3),
)
async def _get_record_file_paths(self, max_ctime: float) -> List[str]:
glob_path = os.path.join(self.path, '*/**/*.*')
paths: Iterable[Path]

View File

@ -1,3 +1,4 @@
import logging
import json
from typing import Iterable, cast
@ -8,6 +9,9 @@ from ..flv.stream_processor import JoinPoint
from ..flv.helpers import make_comment_for_joinpoints
logger = logging.getLogger(__name__)
async def make_metadata_file(flv_path: str) -> str:
path = flv_path + '.meta'
async with aiofiles.open(path, 'wb') as f:
@ -57,11 +61,16 @@ def _make_chapters(
result = ''
for i in range(1, len(timestamps)):
start = timestamps[i - 1]
end = timestamps[i]
if end < start:
logger.warning(f'Chapter end time {end} before start {start}')
end = start
result += f"""\
[CHAPTER]
TIMEBASE=1/1000
START={timestamps[i-1]}
END={timestamps[i]}
START={start}
END={end}
title=segment \\#{i}
"""
return result