lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Has anyone written a Lua module for reading ID3 tags (both v1 and v2) in MP3 files? If not, I may translate one of the available Python modules.

I wrote a tiny binding for id3lib for Lua 5.0 or 5.1. Now I
don't use it anymore. I simply use os.execute and get the
tags directly from "id3v2 --list". Sure, for images etc this
might not work. But for text it works just fine.

    -- non-optimized kludge follows
        local f = io.popen("id3v2 --list '" .. f .. "'")
        local s = f:read("*a")
        -- kill header
        s = string.gsub(s, "^.-id3v2.-\n", "")
        local t = {}
        string.gsub(s, "(.-)%s+.-:%s+(.-)\n", function(a, b, c)
            t[a] = c
        return t

If you have a decent bind, I guess I would use it instead. :)
If you want my old bind, I can send it to you.