[~] Refactor
This commit is contained in:
parent
5cb6394e27
commit
7dff2a98f2
@ -289,12 +289,15 @@ def tiktok_videos_process(meta: Iterable[dict[str, Any]]) -> dict[str, Any]:
|
|||||||
path_parts = os.path.splitext(path)
|
path_parts = os.path.splitext(path)
|
||||||
|
|
||||||
processed_path = path_parts[0] + '-proc' + path_parts[1]
|
processed_path = path_parts[0] + '-proc' + path_parts[1]
|
||||||
|
processed_path_tmp = path_parts[0] + '-proc.tmp' + path_parts[1]
|
||||||
|
|
||||||
print(processed_path)
|
|
||||||
if not os.path.exists(path) or os.path.exists(processed_path):
|
if not os.path.exists(path) or os.path.exists(processed_path):
|
||||||
stats['skipped'] += 1
|
stats['skipped'] += 1
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
if os.path.exists(processed_path_tmp):
|
||||||
|
os.unlink(processed_path_tmp)
|
||||||
|
|
||||||
ffmpeg = [
|
ffmpeg = [
|
||||||
'ffmpeg',
|
'ffmpeg',
|
||||||
'-i', path,
|
'-i', path,
|
||||||
@ -308,9 +311,18 @@ def tiktok_videos_process(meta: Iterable[dict[str, Any]]) -> dict[str, Any]:
|
|||||||
'-sws_flags', 'bilinear',
|
'-sws_flags', 'bilinear',
|
||||||
'-map', '0:v:0',
|
'-map', '0:v:0',
|
||||||
'-map', '1:a:0',
|
'-map', '1:a:0',
|
||||||
processed_path,
|
processed_path_tmp,
|
||||||
]
|
]
|
||||||
subprocess.check_call(ffmpeg)
|
|
||||||
|
subprocess.check_call(
|
||||||
|
ffmpeg,
|
||||||
|
stdin=subprocess.DEVNULL,
|
||||||
|
stderr=subprocess.DEVNULL,
|
||||||
|
stdout=subprocess.DEVNULL
|
||||||
|
)
|
||||||
|
|
||||||
|
os.rename(processed_path_tmp, processed_path)
|
||||||
|
|
||||||
stats['saved'] += 1
|
stats['saved'] += 1
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
break
|
break
|
||||||
|
Loading…
Reference in New Issue
Block a user