Print out file bitrates as table
This commit is contained in:
@@ -80,7 +80,10 @@ defmodule FindOldMp3s.Application do
|
||||
System.halt(0)
|
||||
end
|
||||
|
||||
Enum.each(files, fn file -> IO.puts(file) end)
|
||||
IO.puts("Running exiftool...\n")
|
||||
|
||||
Stream.map(files, fn file -> {get_bitrate(file), file} end)
|
||||
|> Enum.each(fn {bitrate, path} -> IO.puts("#{bitrate}\t|\t#{path}") end)
|
||||
end
|
||||
|
||||
defp show_exiftool_error() do
|
||||
@@ -112,4 +115,13 @@ defmodule FindOldMp3s.Application do
|
||||
|
||||
""")
|
||||
end
|
||||
|
||||
defp get_bitrate(file) do
|
||||
System.cmd("exiftool", ["-AudioBitrate", file])
|
||||
|> elem(0)
|
||||
|> String.split(":")
|
||||
|> Enum.at(1, "---")
|
||||
|> String.trim()
|
||||
|> String.pad_trailing(8)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user