Linting with ruff.
This commit is contained in:
+18
-28
@@ -3,40 +3,29 @@
|
||||
# Copyright (C) 2026 Frédéric Tronel
|
||||
|
||||
import logging
|
||||
from typing import IO, Any
|
||||
from datetime import timedelta
|
||||
from shutil import copyfile, move
|
||||
from shutil import copyfile
|
||||
from typing import IO, Any
|
||||
|
||||
import hexdump
|
||||
|
||||
from tscut.exceptions import InvalidMediaError
|
||||
from tscut.models import PreparedMedia, ProcessingOptions, CutResult
|
||||
from tscut.h264.avc import get_avc_config_from_h264
|
||||
from tscut.matroska.codec import dump_codec_private_data
|
||||
from tscut.models import CutResult, PreparedMedia, ProcessingOptions
|
||||
from tscut.tools.ffmpeg import extract_all_streams
|
||||
from tscut.tools.ffprobe import (
|
||||
find_subtitles_tracks,
|
||||
get_format,
|
||||
get_frame_rate,
|
||||
get_movie_duration,
|
||||
get_nearest_iframe,
|
||||
get_streams,
|
||||
)
|
||||
from tscut.tools.ffmpeg import extract_all_streams, ffmpeg_convert
|
||||
from tscut.h264.avc import get_avc_config_from_h264, parse_codec_private
|
||||
from tscut.tools.mkvtoolnix import (
|
||||
change_codec_private_data,
|
||||
extract_mkv_part,
|
||||
extract_track_from_mkv,
|
||||
get_codec_private_data_from_mkv,
|
||||
merge_mkvs,
|
||||
remove_video_tracks_from_mkv,
|
||||
remux_srt_subtitles,
|
||||
)
|
||||
from tscut.tools.timeframe import get_ts_frame
|
||||
from tscut.tscut import (
|
||||
concatenate_h264_parts,
|
||||
concatenate_h264_ts_parts
|
||||
)
|
||||
from tscut.matroska.codec import dump_codec_private_data
|
||||
|
||||
from tscut.tscut import concatenate_h264_parts, concatenate_h264_ts_parts
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -206,16 +195,17 @@ def cut_recording(media: PreparedMedia, options: ProcessingOptions,
|
||||
|
||||
if (not options.coarse) and (nb_tail_frames > options.threshold):
|
||||
# We extract all frames between the I-frame (including it) upto the end.
|
||||
h264_tail, h264_tail_ts, mkv_tail = extract_all_streams(ffmpeg_path=options.tools_paths['ffmpeg'],
|
||||
ffprobe_path=options.tools_paths['ffprobe'],
|
||||
input_file=media.movie, begin=tail_iframe_ts,
|
||||
end=ts2, nb_frames=nb_tail_frames,
|
||||
framerate=media.framerate,
|
||||
files_prefix=f'part-{partnum:d}-tail',
|
||||
streams=media.streams,
|
||||
width=media.width, height=media.height,
|
||||
temporaries=temporaries,
|
||||
dump_mem_fd=options.dump_memory)
|
||||
h264_tail, h264_tail_ts, mkv_tail = extract_all_streams(
|
||||
ffmpeg_path=options.tools_paths['ffmpeg'],
|
||||
ffprobe_path=options.tools_paths['ffprobe'],
|
||||
input_file=media.movie, begin=tail_iframe_ts,
|
||||
end=ts2, nb_frames=nb_tail_frames,
|
||||
framerate=media.framerate,
|
||||
files_prefix=f'part-{partnum:d}-tail',
|
||||
streams=media.streams,
|
||||
width=media.width, height=media.height,
|
||||
temporaries=temporaries,
|
||||
dump_mem_fd=options.dump_memory)
|
||||
|
||||
if mkv_tail is not None:
|
||||
subparts.append(mkv_tail)
|
||||
|
||||
+3
-2
@@ -4,12 +4,13 @@
|
||||
|
||||
from dataclasses import dataclass
|
||||
from datetime import timedelta
|
||||
from pathlib import Path
|
||||
from enum import IntEnum, unique
|
||||
from typing import BinaryIO, IO
|
||||
from pathlib import Path
|
||||
from typing import IO, BinaryIO
|
||||
|
||||
from tscut.h264.avc import AVCDecoderConfiguration
|
||||
|
||||
|
||||
@unique
|
||||
class SupportedFormat(IntEnum):
|
||||
TS = 1
|
||||
|
||||
+4
-26
@@ -12,45 +12,23 @@ from typing import IO, Any, BinaryIO
|
||||
|
||||
import hexdump
|
||||
|
||||
from tscut.models import ProcessingOptions, PreparedMedia, SupportedFormat
|
||||
from tscut.cutting import cut_recording
|
||||
from tscut.exceptions import InvalidMediaError
|
||||
from tscut.h264.avc import (
|
||||
get_avc_config_from_h264,
|
||||
parse_codec_private
|
||||
)
|
||||
from tscut.h264.avc import parse_codec_private
|
||||
from tscut.matroska.codec import dump_codec_private_data
|
||||
from tscut.subtitles.ocr import (
|
||||
do_ocr,
|
||||
extract_srt,
|
||||
get_tesseract_supported_lang
|
||||
)
|
||||
from tscut.tools.ffmpeg import (
|
||||
extract_all_streams,
|
||||
ffmpeg_convert
|
||||
)
|
||||
from tscut.models import PreparedMedia, ProcessingOptions, SupportedFormat
|
||||
from tscut.subtitles.ocr import do_ocr, extract_srt, get_tesseract_supported_lang
|
||||
from tscut.tools.ffmpeg import ffmpeg_convert
|
||||
from tscut.tools.ffprobe import (
|
||||
find_subtitles_tracks,
|
||||
get_format,
|
||||
get_frame_rate,
|
||||
get_movie_duration,
|
||||
get_nearest_iframe,
|
||||
get_streams,
|
||||
)
|
||||
from tscut.tools.mkvtoolnix import (
|
||||
change_codec_private_data,
|
||||
extract_mkv_part,
|
||||
extract_track_from_mkv,
|
||||
get_codec_private_data_from_mkv,
|
||||
merge_mkvs,
|
||||
remove_video_tracks_from_mkv,
|
||||
remux_srt_subtitles,
|
||||
)
|
||||
from tscut.tools.timeframe import get_ts_frame
|
||||
from tscut.tscut import (
|
||||
concatenate_h264_parts,
|
||||
concatenate_h264_ts_parts
|
||||
)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user