Meilleure gestion du journal des erreurs

This commit is contained in:
Antoine Van Elstraete 2022-07-06 20:08:13 +02:00
parent b738a3106c
commit d82cb8a0b3
Signed by: AntoineVe
GPG Key ID: E36069A977E2A9ED

View File

@ -152,7 +152,7 @@ def extract_subs(file, track, lang):
logging.debug(command) logging.debug(command)
result = subprocess.getoutput(command) result = subprocess.getoutput(command)
if result != "": if result != "":
logging.info(result) logging.error(result)
def convert_audio(file, track, volume_adj, channels, channel_layout, language, title): def convert_audio(file, track, volume_adj, channels, channel_layout, language, title):
@ -163,7 +163,8 @@ def convert_audio(file, track, volume_adj, channels, channel_layout, language, t
command = f'ffmpeg -loglevel error -i {file} -map 0:{track} -map_metadata -1 -vn -sn -c:a {codec} -mapping_family 1 -filter:a volume={volume_adj},aformat=channel_layouts={channel_layout} {metadatas} -y {file}_audio_{track}_{language}.mka' command = f'ffmpeg -loglevel error -i {file} -map 0:{track} -map_metadata -1 -vn -sn -c:a {codec} -mapping_family 1 -filter:a volume={volume_adj},aformat=channel_layouts={channel_layout} {metadatas} -y {file}_audio_{track}_{language}.mka'
logging.debug(command) logging.debug(command)
result = subprocess.getoutput(command) result = subprocess.getoutput(command)
logging.info(result) if result != "":
logging.error(result)
def convert_video(file, infos, start, crop, crf, animation): def convert_video(file, infos, start, crop, crf, animation):
@ -215,7 +216,8 @@ def convert_video(file, infos, start, crop, crf, animation):
command = f'ffmpeg -loglevel error -i {file} -map 0:{track} -ss {start} -t 300 -an -sn -c:v {codec} {tune} {hdr} -crf {crf} -pix_fmt {fmt} -filter:v {crop} -y {output}' command = f'ffmpeg -loglevel error -i {file} -map 0:{track} -ss {start} -t 300 -an -sn -c:v {codec} {tune} {hdr} -crf {crf} -pix_fmt {fmt} -filter:v {crop} -y {output}'
logging.debug(command) logging.debug(command)
result = subprocess.getoutput(command) result = subprocess.getoutput(command)
logging.info(result) if result != "":
logging.error(result)
def create_mkv(filename): def create_mkv(filename):
@ -272,9 +274,11 @@ def create_mkv(filename):
def mkv_to_mp4(filename): def mkv_to_mp4(filename):
options = "-c:a copy -c:v copy -c:s copy -movflags faststart" options = "-c:a copy -c:v copy -c:s copy -movflags faststart"
command = f"ffmpeg -i {filename}_FINAL.mkv {options} -y NEW_{filename}.mp4" command = f"ffmpeg -loglevel error -i {filename}_FINAL.mkv {options} -y NEW_{filename}.mp4"
result = subprocess.getoutput(command) result = subprocess.getoutput(command)
logging.debug(result) if result != "":
logging.error(result)
else:
remove(f"{filename}_FINAL.mkv") remove(f"{filename}_FINAL.mkv")