Check for exiftool dependency

This commit is contained in:
2024-05-29 22:13:21 +02:00
parent 442d087e16
commit 2eaf3fe7a2

View File

@@ -4,6 +4,8 @@ defmodule FindOldMp3s.Application do
""" """
def start(_, _) do def start(_, _) do
check_exif_tools()
get_options() get_options()
|> validate_options() |> validate_options()
|> execute() |> execute()
@@ -11,6 +13,13 @@ defmodule FindOldMp3s.Application do
System.halt(0) System.halt(0)
end end
defp check_exif_tools() do
case System.find_executable("exiftool") do
nil -> show_exiftool_error()
_ -> true
end
end
defp get_options() do defp get_options() do
Burrito.Util.Args.get_arguments() Burrito.Util.Args.get_arguments()
|> OptionParser.parse( |> OptionParser.parse(
@@ -72,6 +81,15 @@ defmodule FindOldMp3s.Application do
Enum.each(files, fn file -> IO.puts(file) end) Enum.each(files, fn file -> IO.puts(file) end)
end end
defp show_exiftool_error() do
IO.puts(
:stderr,
"This command needs to have tool 'exiftool' installed! Please consult your OS manual in order to install it."
)
System.halt(2)
end
defp print_help() do defp print_help() do
IO.puts(""" IO.puts("""
This command will find audio files with low bitrates in a folder folder (recursively) and shows the bitrate and This command will find audio files with low bitrates in a folder folder (recursively) and shows the bitrate and