fix: fix file details

This commit is contained in:
acgnhik 2022-08-24 12:00:27 +08:00
parent 91ccd8c595
commit fd18d89808
2 changed files with 17 additions and 5 deletions

View File

@ -17,7 +17,7 @@ from ..flv.helpers import is_valid_flv_file
from ..flv.metadata_analysis import analyse_metadata
from ..flv.metadata_injection import InjectingProgress, inject_metadata
from ..logging.room_id import aio_task_with_room_id
from ..path import extra_metadata_path
from ..path import danmaku_path, extra_metadata_path
from ..utils.mixins import AsyncCooperationMixin, AsyncStoppableMixin, SupportDebugMixin
from .ffmpeg_metadata import make_metadata_file
from .helpers import copy_files_related, discard_dir, discard_file, get_extra_metadata
@ -172,6 +172,9 @@ class Postprocessor(
remuxing_result,
) = await self._remux_video_to_mp4(video_path)
await copy_files_related(video_path)
if result_path != video_path:
self._completed_files.append(danmaku_path(result_path))
self._completed_files.remove(danmaku_path(video_path))
if not self._debug:
if self._should_delete_source_files(remuxing_result):
await discard_dir(os.path.dirname(video_path))

View File

@ -1,6 +1,6 @@
import logging
import os
from pathlib import Path
from pathlib import PurePath
from typing import Iterator, Optional
from blrec.bili.danmaku_client import DanmakuClient
@ -133,7 +133,10 @@ class RecordTask:
size = os.path.getsize(path)
exists = True
except FileNotFoundError:
mp4_path = str(Path(path).with_suffix('.mp4'))
if path.endswith('.m3u8'):
mp4_path = str(PurePath(path).parent.with_suffix('.mp4'))
else:
mp4_path = str(PurePath(path).with_suffix('.mp4'))
try:
size = os.path.getsize(mp4_path)
exists = True
@ -175,8 +178,14 @@ class RecordTask:
size = os.path.getsize(path)
exists = True
except FileNotFoundError:
size = 0
exists = False
_path = str(PurePath(path).parent.with_suffix('.xml'))
try:
size = os.path.getsize(_path)
exists = True
path = _path
except FileNotFoundError:
size = 0
exists = False
if not exists:
status = DanmukuFileStatus.MISSING