diff options
author | Karl Berry <karl@freefriends.org> | 2015-05-11 21:37:36 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2015-05-11 21:37:36 +0000 |
commit | 0053a5222ec78ba41126c246eafd8cdb02f9a56a (patch) | |
tree | 22b38b1430bb1084ec8357362fc51d55ffd2fddb /Master/texmf-dist/scripts/context/lua | |
parent | c4e86cc3b89e06b5f6a6ea80c907cfa69a7231da (diff) |
context/11may15
git-svn-id: svn://tug.org/texlive/trunk@37341 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts/context/lua')
-rw-r--r-- | Master/texmf-dist/scripts/context/lua/mtx-flac.lua | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/Master/texmf-dist/scripts/context/lua/mtx-flac.lua b/Master/texmf-dist/scripts/context/lua/mtx-flac.lua index 4e01abc997f..eb3b485911d 100644 --- a/Master/texmf-dist/scripts/context/lua/mtx-flac.lua +++ b/Master/texmf-dist/scripts/context/lua/mtx-flac.lua @@ -107,29 +107,34 @@ function flac.savecollection(pattern,filename) local music = { } table.sort(files) for i=1,#files do - local data = flac.getmetadata(files[i]) + local name = files[i] + local data = flac.getmetadata(name) if data then local tags = data.tags local info = data.info - local artist = tags.artist or "no-artist" - local album = tags.album or "no-album" - local albums = music[artist] - if not albums then - albums = { } - music[artist] = albums - end - local albumx = albums[album] - if not albumx then - albumx = { - year = tags.date, - tracks = { }, + if tags and info then + local artist = tags.artist or "no-artist" + local album = tags.album or "no-album" + local albums = music[artist] + if not albums then + albums = { } + music[artist] = albums + end + local albumx = albums[album] + if not albumx then + albumx = { + year = tags.date, + tracks = { }, + } + albums[album] = albumx + end + albumx.tracks[tonumber(tags.tracknumber) or 0] = { + title = tags.title, + length = math.round((info.samples_in_stream/info.sample_rate_in_hz)), } - albums[album] = albumx + else + flac.report("unable to read file",name) end - albumx.tracks[tonumber(tags.tracknumber) or 0] = { - title = tags.title, - length = math.round((info.samples_in_stream/info.sample_rate_in_hz)), - } end end -- inspect(music) @@ -153,6 +158,7 @@ function flac.savecollection(pattern,filename) return ya < yb end end) + nofalbums = nofalbums + #list for nofalbums=1,#list do local album = list[nofalbums] local data = albums[album] |