Check for exiftool dependency
This commit is contained in:
@@ -4,6 +4,8 @@ defmodule FindOldMp3s.Application do
|
||||
"""
|
||||
|
||||
def start(_, _) do
|
||||
check_exif_tools()
|
||||
|
||||
get_options()
|
||||
|> validate_options()
|
||||
|> execute()
|
||||
@@ -11,6 +13,13 @@ defmodule FindOldMp3s.Application do
|
||||
System.halt(0)
|
||||
end
|
||||
|
||||
defp check_exif_tools() do
|
||||
case System.find_executable("exiftool") do
|
||||
nil -> show_exiftool_error()
|
||||
_ -> true
|
||||
end
|
||||
end
|
||||
|
||||
defp get_options() do
|
||||
Burrito.Util.Args.get_arguments()
|
||||
|> OptionParser.parse(
|
||||
@@ -72,6 +81,15 @@ defmodule FindOldMp3s.Application do
|
||||
Enum.each(files, fn file -> IO.puts(file) 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
|
||||
IO.puts("""
|
||||
This command will find audio files with low bitrates in a folder folder (recursively) and shows the bitrate and
|
||||
|
||||
Reference in New Issue
Block a user