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