AFX.lua is a library for parsing audio file metadata.
require the library and run it as a function.
local getmeta = require("afx")It takes 3 arguments:
File fileorstring file- the file it will parse. If it's a string, try to create a file from the path, or if running under LÖVE, read the given file and parse a customcursor.table meta- the table it will append to. If it's missing, creates a new table and returns it.string htype- metadata type. set tonilto automatically determine.
It returns a new table, or meta if provided, on success.
On failure, it returns false and the error string.
ID3v2 tags might require zlib decompression, and will throw an error if not implemented. It works out-of-the-box when running under LÖVE.
local getmeta = require("afx")
local meta = getmeta("music/Layla And Other Assorted Love Songs/13 - Layla.mp3") -- Creates a new table
print(table.concat(meta["TPE1"])) -- Output: Derek & The Dominos
getmeta("music/Agents Of Fortune/3 - (Don't Fear) The Reaper.flac", meta) -- Writes in the given table
print(meta.ARTIST[1]) -- Output: Blue Öyster Cult- Vorbis comments (
.oggand.flac) - ID3v1, ID3v1.1, ID3v2.2 (untested!), ID3v2.3, ID3v2.4