Better handling when FFmpeg isn't found

This commit is contained in:
Ritiek Malhotra
2020-05-12 20:41:00 +05:30
parent ad34bb01a3
commit f40f69fdc5
7 changed files with 10 additions and 77 deletions

View File

@@ -292,10 +292,13 @@ class Arguments:
"--write-to can only be used with --playlist, --album, --all-albums, --username, or --write-m3u."
)
ffmpeg_exists = shutil.which("ffmpeg")
ffmpeg_exists = shutil.which("fffmpeg")
if not ffmpeg_exists:
logger.warn("FFmpeg was not found in PATH. Will not re-encode media to specified output format.")
self.parsed.output_ext = self.parsed.input_ext
self.parsed.no_encode = True
if self.parsed.no_encode and self.parsed.trim_silence:
logger.warn("--trim-silence can only be used when an encoder is set.")
if self.parsed.output_file == "-" and self.parsed.no_metadata is False:
logger.warn(
@@ -311,7 +314,7 @@ class Arguments:
logger.warn(
"Given output file is a directory. Will download tracks "
"in this directory with their filename as per the default "
"file format. Pass '--output-file=\"{}\"' to hide this "
"file format. Pass --output-file=\"{}\" to hide this "
"warning.".format(
adjusted_output_file
)

View File

@@ -34,7 +34,7 @@ class TestArguments:
arguments["spotify_client_secret"] = None
expect_arguments = {
"track": ["elena coats - one last song"],
"song": ["elena coats - one last song"],
"song": None,
"list": None,
"playlist": None,
@@ -46,7 +46,6 @@ class TestArguments:
"no_remove_original": False,
"no_metadata": False,
"no_fallback_metadata": False,
"avconv": False,
"directory": "/home/ritiek/Music",
"overwrite": "prompt",
"input_ext": ".m4a",
@@ -60,7 +59,6 @@ class TestArguments:
"music_videos_only": False,
"no_spaces": False,
"log_level": 20,
"youtube_api_key": None,
"skip": None,
"write_successful": None,
"spotify_client_id": None,
@@ -72,5 +70,5 @@ class TestArguments:
def test_grouped_arguments(self):
with pytest.raises(SystemExit):
spotdl.command_line.arguments.get_arguments(to_merge=True)
spotdl.command_line.arguments.get_arguments()