Remove extraneous f-string.
This commit is contained in:
@@ -128,14 +128,14 @@ def cut_recording(media: PreparedMedia, options: ProcessingOptions,
|
|||||||
head_frames = get_nearest_iframe(options.tools_paths['ffprobe'], media.movie, ts1,
|
head_frames = get_nearest_iframe(options.tools_paths['ffprobe'], media.movie, ts1,
|
||||||
before=False)
|
before=False)
|
||||||
if head_frames is None:
|
if head_frames is None:
|
||||||
raise InvalidMediaError(f"Impossible to retrieve first I-frame")
|
raise InvalidMediaError("Impossible to retrieve first I-frame")
|
||||||
|
|
||||||
# Get the nearest I-frame whose timestamp ...
|
# Get the nearest I-frame whose timestamp ...
|
||||||
# TODO: wrong here ...
|
# TODO: wrong here ...
|
||||||
tail_frames = get_nearest_iframe(options.tools_paths['ffprobe'], media.movie,
|
tail_frames = get_nearest_iframe(options.tools_paths['ffprobe'], media.movie,
|
||||||
ts2, before=True)
|
ts2, before=True)
|
||||||
if tail_frames is None:
|
if tail_frames is None:
|
||||||
raise InvalidMediaError(f"Impossible to retrieve last I-frame")
|
raise InvalidMediaError("Impossible to retrieve last I-frame")
|
||||||
|
|
||||||
nb_head_frames, head_iframe = head_frames
|
nb_head_frames, head_iframe = head_frames
|
||||||
nb_tail_frames, tail_iframe = tail_frames
|
nb_tail_frames, tail_iframe = tail_frames
|
||||||
@@ -147,10 +147,10 @@ def cut_recording(media: PreparedMedia, options: ProcessingOptions,
|
|||||||
|
|
||||||
head_iframe_ts = get_ts_frame(head_iframe)
|
head_iframe_ts = get_ts_frame(head_iframe)
|
||||||
if head_iframe_ts is None:
|
if head_iframe_ts is None:
|
||||||
raise InvalidMediaError(f"Impossible to retrieve timestamp of first i-frame.")
|
raise InvalidMediaError("Impossible to retrieve timestamp of first i-frame.")
|
||||||
tail_iframe_ts = get_ts_frame(tail_iframe)
|
tail_iframe_ts = get_ts_frame(tail_iframe)
|
||||||
if tail_iframe_ts is None:
|
if tail_iframe_ts is None:
|
||||||
raise InvalidMediaError(f"Impossible to retrieve timestamp of final i-frame.")
|
raise InvalidMediaError("Impossible to retrieve timestamp of final i-frame.")
|
||||||
|
|
||||||
checks.append(pos+head_iframe_ts-ts1)
|
checks.append(pos+head_iframe_ts-ts1)
|
||||||
|
|
||||||
@@ -298,7 +298,7 @@ def cut_recording(media: PreparedMedia, options: ProcessingOptions,
|
|||||||
try:
|
try:
|
||||||
full_h264 = open(f'{media.basename}-full.h264', 'wb+')
|
full_h264 = open(f'{media.basename}-full.h264', 'wb+')
|
||||||
except OSError:
|
except OSError:
|
||||||
raise TemporaryFileError(f"Impossible to create file full H264 stream.")
|
raise TemporaryFileError("Impossible to create file full H264 stream.")
|
||||||
|
|
||||||
logger.info('Merging all H264 tracks')
|
logger.info('Merging all H264 tracks')
|
||||||
concatenate_h264_parts(h264parts=h264parts, output=full_h264)
|
concatenate_h264_parts(h264parts=h264parts, output=full_h264)
|
||||||
@@ -307,7 +307,7 @@ def cut_recording(media: PreparedMedia, options: ProcessingOptions,
|
|||||||
try:
|
try:
|
||||||
full_h264_ts = open(f'{media.basename}-ts.txt', 'w+', encoding='utf8')
|
full_h264_ts = open(f'{media.basename}-ts.txt', 'w+', encoding='utf8')
|
||||||
except OSError:
|
except OSError:
|
||||||
raise TemporaryFileError(f"Impossible to create file containing all video timestamps.")
|
raise TemporaryFileError("Impossible to create file containing all video timestamps.")
|
||||||
|
|
||||||
logger.info('Merging H264 timestamps')
|
logger.info('Merging H264 timestamps')
|
||||||
concatenate_h264_ts_parts(h264_ts_parts=h264_ts, output=full_h264_ts)
|
concatenate_h264_ts_parts(h264_ts_parts=h264_ts, output=full_h264_ts)
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ def process_recording(options: ProcessingOptions, temporaries: TemporaryFiles) -
|
|||||||
main_video = None
|
main_video = None
|
||||||
|
|
||||||
if main_video is None:
|
if main_video is None:
|
||||||
raise InvalidMediaError(f"Impossible to find main video stream.")
|
raise InvalidMediaError("Impossible to find main video stream.")
|
||||||
|
|
||||||
# We retrieve the main private codec data
|
# We retrieve the main private codec data
|
||||||
_, main_codec_private_data = get_codec_private_data_from_mkv(
|
_, main_codec_private_data = get_codec_private_data_from_mkv(
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ def change_codec_private_data(mkvinfo_path:str, input_file: IO[bytes],
|
|||||||
logger.info('Current size of file: %d', current_length)
|
logger.info('Current size of file: %d', current_length)
|
||||||
position, current_data = get_codec_private_data_from_mkv(mkvinfo_path, input_file)
|
position, current_data = get_codec_private_data_from_mkv(mkvinfo_path, input_file)
|
||||||
if position is None or current_data is None:
|
if position is None or current_data is None:
|
||||||
raise InvalidMediaError(f"Impossible to retrieve private data from file")
|
raise InvalidMediaError("Impossible to retrieve private data from file")
|
||||||
current_data_length = len(current_data)
|
current_data_length = len(current_data)
|
||||||
future_length = current_length - current_data_length + len(codec_data)
|
future_length = current_length - current_data_length + len(codec_data)
|
||||||
logger.info('Expected size of file: %d', future_length)
|
logger.info('Expected size of file: %d', future_length)
|
||||||
@@ -147,7 +147,7 @@ def change_codec_private_data(mkvinfo_path:str, input_file: IO[bytes],
|
|||||||
break
|
break
|
||||||
|
|
||||||
if not found:
|
if not found:
|
||||||
raise InvalidMediaError(f"Impossible to retrieve the key of codec private data")
|
raise InvalidMediaError("Impossible to retrieve the key of codec private data")
|
||||||
|
|
||||||
if current_length < future_length:
|
if current_length < future_length:
|
||||||
lseek(infd, position+current_data_length, SEEK_SET)
|
lseek(infd, position+current_data_length, SEEK_SET)
|
||||||
|
|||||||
Reference in New Issue
Block a user