mirror of
https://github.com/acgnhiki/blrec.git
synced 2025-01-13 20:00:37 +08:00
fix: avoid Found duplicated MOOV Atom. Skipped it
This commit is contained in:
parent
fff5994f0b
commit
772eb5e3e7
@ -4,10 +4,11 @@ import io
|
||||
from copy import deepcopy
|
||||
from decimal import Decimal
|
||||
from pathlib import PurePath
|
||||
from typing import Optional, Tuple, Union
|
||||
from typing import Optional, Tuple, Union, cast
|
||||
|
||||
import m3u8
|
||||
from loguru import logger
|
||||
from m3u8.model import InitializationSection
|
||||
from reactivex import Observable, Subject, abc
|
||||
from reactivex.disposable import CompositeDisposable, Disposable, SerialDisposable
|
||||
|
||||
@ -139,7 +140,9 @@ class PlaylistDumper:
|
||||
) -> m3u8.Segment:
|
||||
seg = deepcopy(segment)
|
||||
if init_section := getattr(seg, 'init_section', None):
|
||||
init_section = cast(InitializationSection, init_section)
|
||||
init_section.uri = uri
|
||||
init_section.base_uri = ''
|
||||
init_section.byterange = init_section_byterange
|
||||
seg.uri = uri
|
||||
seg.byterange = segment_byterange
|
||||
|
@ -72,6 +72,14 @@ class SegmentDumper:
|
||||
def _update_filesize(self, size: int) -> None:
|
||||
self._filesize += size
|
||||
|
||||
def _is_redundant(
|
||||
self, prev_init_item: Optional[InitSectionData], curr_init_item: InitSectionData
|
||||
) -> bool:
|
||||
return (
|
||||
prev_init_item is not None
|
||||
and curr_init_item.payload == prev_init_item.payload
|
||||
)
|
||||
|
||||
def _must_split_file(
|
||||
self, prev_init_item: Optional[InitSectionData], curr_init_item: InitSectionData
|
||||
) -> bool:
|
||||
@ -141,6 +149,8 @@ class SegmentDumper:
|
||||
split_file = False
|
||||
|
||||
if isinstance(item, InitSectionData):
|
||||
if self._is_redundant(last_init_item, item):
|
||||
return
|
||||
split_file = self._must_split_file(last_init_item, item)
|
||||
last_init_item = item
|
||||
|
||||
|
@ -92,7 +92,6 @@ class SegmentFetcher:
|
||||
(
|
||||
last_segment is None
|
||||
or seg.init_section != last_segment.init_section
|
||||
or seg.discontinuity
|
||||
)
|
||||
):
|
||||
url = seg.init_section.absolute_uri
|
||||
|
Loading…
Reference in New Issue
Block a user