lua-users home
lua-l archive

Re: Reading ID3 tags from Lua

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


Hi,
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
 function id3.read(f)
 local f = io.popen("id3v2 --list '" .. f .. "'")
 local s = f:read("*a")
 f:close()
 -- kill header
 s = string.gsub(s, "^.-id3v2.-\n", "")
 local t = {}
 string.gsub(s, "(.-)%s+.-:%s+(.-)\n", function(a, b, c)
 t[a] = c
 end)
 return t
 end
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.
[]s,
Diego

AltStyle によって変換されたページ (->オリジナル) /