mirror of
https://github.com/KevinMidboe/spotify-downloader.git
synced 2025-10-29 18:00:15 +00:00
Refactor embedding metadata to media
This commit is contained in:
@@ -15,47 +15,47 @@ class TestEncoderFFmpeg:
|
||||
|
||||
|
||||
class TestEncodingDefaults:
|
||||
def m4a_to_mp3_encoder(input_file, output_file):
|
||||
def m4a_to_mp3_encoder(input_path, target_path):
|
||||
command = [
|
||||
'ffmpeg', '-y', '-nostdin', '-hide_banner', '-nostats', '-v', 'panic',
|
||||
'-i', input_file,
|
||||
'-i', input_path,
|
||||
'-codec:v', 'copy',
|
||||
'-codec:a', 'libmp3lame',
|
||||
'-ar', '48000',
|
||||
'-b:a', '192k',
|
||||
'-vn', output_file
|
||||
'-vn', target_path
|
||||
]
|
||||
return command
|
||||
|
||||
def m4a_to_webm_encoder(input_file, output_file):
|
||||
def m4a_to_webm_encoder(input_path, target_path):
|
||||
command = [
|
||||
'ffmpeg', '-y', '-nostdin', '-hide_banner', '-nostats', '-v', 'panic',
|
||||
'-i', input_file,
|
||||
'-i', input_path,
|
||||
'-codec:a', 'libopus',
|
||||
'-vbr', 'on',
|
||||
'-b:a', '192k',
|
||||
'-vn', output_file
|
||||
'-vn', target_path
|
||||
]
|
||||
return command
|
||||
|
||||
def m4a_to_m4a_encoder(input_file, output_file):
|
||||
def m4a_to_m4a_encoder(input_path, target_path):
|
||||
command = [
|
||||
'ffmpeg', '-y', '-nostdin', '-hide_banner', '-nostats', '-v', 'panic',
|
||||
'-i', input_file,
|
||||
'-i', input_path,
|
||||
'-acodec', 'copy',
|
||||
'-b:a', '192k',
|
||||
'-vn', output_file
|
||||
'-vn', target_path
|
||||
]
|
||||
return command
|
||||
|
||||
def m4a_to_flac_encoder(input_file, output_file):
|
||||
def m4a_to_flac_encoder(input_path, target_path):
|
||||
command = [
|
||||
'ffmpeg', '-y', '-nostdin', '-hide_banner', '-nostats', '-v', 'panic',
|
||||
'-i', input_file,
|
||||
'-i', input_path,
|
||||
'-codec:a', 'flac',
|
||||
'-ar', '48000',
|
||||
'-b:a', '192k',
|
||||
'-vn', output_file
|
||||
'-vn', target_path
|
||||
]
|
||||
return command
|
||||
|
||||
@@ -71,47 +71,47 @@ class TestEncodingDefaults:
|
||||
|
||||
|
||||
class TestEncodingInDebugMode:
|
||||
def m4a_to_mp3_encoder_with_debug(input_file, output_file):
|
||||
def m4a_to_mp3_encoder_with_debug(input_path, target_path):
|
||||
command = [
|
||||
'ffmpeg', '-y', '-nostdin', '-loglevel', 'debug',
|
||||
'-i', input_file,
|
||||
'-i', input_path,
|
||||
'-codec:v', 'copy',
|
||||
'-codec:a', 'libmp3lame',
|
||||
'-ar', '48000',
|
||||
'-b:a', '192k',
|
||||
'-vn', output_file
|
||||
'-vn', target_path
|
||||
]
|
||||
return command
|
||||
|
||||
def m4a_to_webm_encoder_with_debug(input_file, output_file):
|
||||
def m4a_to_webm_encoder_with_debug(input_path, target_path):
|
||||
command = [
|
||||
'ffmpeg', '-y', '-nostdin', '-loglevel', 'debug',
|
||||
'-i', input_file,
|
||||
'-i', input_path,
|
||||
'-codec:a', 'libopus',
|
||||
'-vbr', 'on',
|
||||
'-b:a', '192k',
|
||||
'-vn', output_file
|
||||
'-vn', target_path
|
||||
]
|
||||
return command
|
||||
|
||||
def m4a_to_m4a_encoder_with_debug(input_file, output_file):
|
||||
def m4a_to_m4a_encoder_with_debug(input_path, target_path):
|
||||
command = [
|
||||
'ffmpeg', '-y', '-nostdin', '-loglevel', 'debug',
|
||||
'-i', input_file,
|
||||
'-i', input_path,
|
||||
'-acodec', 'copy',
|
||||
'-b:a', '192k',
|
||||
'-vn', output_file
|
||||
'-vn', target_path
|
||||
]
|
||||
return command
|
||||
|
||||
def m4a_to_flac_encoder_with_debug(input_file, output_file):
|
||||
def m4a_to_flac_encoder_with_debug(input_path, target_path):
|
||||
command = [
|
||||
'ffmpeg', '-y', '-nostdin', '-loglevel', 'debug',
|
||||
'-i', input_file,
|
||||
'-i', input_path,
|
||||
'-codec:a', 'flac',
|
||||
'-ar', '48000',
|
||||
'-b:a', '192k',
|
||||
'-vn', output_file
|
||||
'-vn', target_path
|
||||
]
|
||||
return command
|
||||
|
||||
@@ -128,55 +128,55 @@ class TestEncodingInDebugMode:
|
||||
|
||||
|
||||
class TestEncodingAndTrimSilence:
|
||||
def m4a_to_mp3_encoder_and_trim_silence(input_file, output_file):
|
||||
def m4a_to_mp3_encoder_and_trim_silence(input_path, target_path):
|
||||
command = [
|
||||
'ffmpeg', '-y', '-nostdin', '-hide_banner', '-nostats', '-v', 'panic',
|
||||
'-i', input_file,
|
||||
'-i', input_path,
|
||||
'-codec:v', 'copy',
|
||||
'-codec:a', 'libmp3lame',
|
||||
'-ar', '48000',
|
||||
'-b:a', '192k',
|
||||
'-vn',
|
||||
'-af', 'silenceremove=start_periods=1',
|
||||
output_file
|
||||
target_path
|
||||
]
|
||||
return command
|
||||
|
||||
def m4a_to_webm_encoder_and_trim_silence(input_file, output_file):
|
||||
def m4a_to_webm_encoder_and_trim_silence(input_path, target_path):
|
||||
command = [
|
||||
'ffmpeg', '-y', '-nostdin', '-hide_banner', '-nostats', '-v', 'panic',
|
||||
'-i', input_file,
|
||||
'-i', input_path,
|
||||
'-codec:a', 'libopus',
|
||||
'-vbr', 'on',
|
||||
'-b:a', '192k',
|
||||
'-vn',
|
||||
'-af', 'silenceremove=start_periods=1',
|
||||
output_file
|
||||
target_path
|
||||
]
|
||||
return command
|
||||
|
||||
def m4a_to_m4a_encoder_and_trim_silence(input_file, output_file):
|
||||
def m4a_to_m4a_encoder_and_trim_silence(input_path, target_path):
|
||||
command = [
|
||||
'ffmpeg', '-y', '-nostdin', '-hide_banner', '-nostats', '-v', 'panic',
|
||||
'-i', input_file,
|
||||
'-i', input_path,
|
||||
'-acodec', 'copy',
|
||||
'-b:a', '192k',
|
||||
'-vn',
|
||||
'-af', 'silenceremove=start_periods=1',
|
||||
output_file
|
||||
target_path
|
||||
]
|
||||
return command
|
||||
|
||||
def m4a_to_flac_encoder_and_trim_silence(input_file, output_file):
|
||||
def m4a_to_flac_encoder_and_trim_silence(input_path, target_path):
|
||||
command = [
|
||||
'ffmpeg', '-y', '-nostdin', '-hide_banner', '-nostats', '-v', 'panic',
|
||||
'-i', input_file,
|
||||
'-i', input_path,
|
||||
'-codec:a', 'flac',
|
||||
'-ar', '48000',
|
||||
'-b:a', '192k',
|
||||
'-vn',
|
||||
'-af', 'silenceremove=start_periods=1',
|
||||
output_file
|
||||
target_path
|
||||
]
|
||||
return command
|
||||
|
||||
|
||||
Reference in New Issue
Block a user