summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/context/lua/mtx-context.lua2
-rw-r--r--scripts/context/lua/mtx-flac.lua37
-rw-r--r--scripts/context/lua/mtxrun.lua6
-rw-r--r--scripts/context/stubs/mswin/mtxrun.lua6
-rw-r--r--scripts/context/stubs/unix/mtxrun6
5 files changed, 39 insertions, 18 deletions
diff --git a/scripts/context/lua/mtx-context.lua b/scripts/context/lua/mtx-context.lua
index 2ca3253d0..4c6672051 100644
--- a/scripts/context/lua/mtx-context.lua
+++ b/scripts/context/lua/mtx-context.lua
@@ -854,7 +854,7 @@ local function make_mkiv_format(name,engine)
end
local function make_mkii_format(name,engine)
- local command = format("mtxrun texexec.rb --make --%s %s",name,engine)
+ local command = format("mtxrun texexec.rb --make %s --%s",name,engine)
report("running command: %s",command)
os.spawn(command)
end
diff --git a/scripts/context/lua/mtx-flac.lua b/scripts/context/lua/mtx-flac.lua
index 2155b24be..4e01abc99 100644
--- a/scripts/context/lua/mtx-flac.lua
+++ b/scripts/context/lua/mtx-flac.lua
@@ -56,11 +56,20 @@ readers.default = function(f,size,target)
f:seek("cur",size)
end
+local valid = {
+ ["fLaC"] = true,
+ ["ID3♥"] = false,
+}
+
function flac.getmetadata(filename)
local f = io.open(filename, "rb")
if f then
- local banner = readstring(f,4)
- if banner == "fLaC" then
+ local banner = readstring(f,4)
+ local whatsit = valid[banner]
+ if whatsit ~= nil then
+ if whatsit == false then
+ flac.report("suspicious flac file: %s (%s)",filename,banner)
+ end
local data = {
banner = banner,
filename = filename,
@@ -96,13 +105,14 @@ function flac.savecollection(pattern,filename)
local files = dir.glob(pattern)
flac.report("%s files found, analyzing files",#files)
local music = { }
+ table.sort(files)
for i=1,#files do
local data = flac.getmetadata(files[i])
if data then
- local tags = data.tags
- local info = data.info
- local artist = tags.artist
- local album = tags.album
+ 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 = { }
@@ -134,8 +144,18 @@ function flac.savecollection(pattern,filename)
f:write("\t<artist>\n")
f:write("\t\t<name>",lpegmatch(p_escaped,artist),"</name>\n")
f:write("\t\t<albums>\n")
- for album, data in sortedpairs(albums) do
- nofalbums = nofalbums + 1
+ local list = table.keys(albums)
+ table.sort(list,function(a,b)
+ local ya, yb = albums[a].year or 0, albums[b].year or 0
+ if ya == yb then
+ return a < b
+ else
+ return ya < yb
+ end
+ end)
+ for nofalbums=1,#list do
+ local album = list[nofalbums]
+ local data = albums[album]
f:write("\t\t\t<album year='",data.year or 0,"'>\n")
f:write("\t\t\t\t<name>",lpegmatch(p_escaped,album),"</name>\n")
f:write("\t\t\t\t<tracks>\n")
@@ -179,6 +199,7 @@ local helpinfo = [[
<category name="basic">
<subcategory>
<flag name="collect"><short>collect albums in xml file</short></flag>
+ <flag name="pattern"><short>use pattern for locating files</short></flag>
</subcategory>
</category>
</flags>
diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua
index 682425a23..0ddb7f65c 100644
--- a/scripts/context/lua/mtxrun.lua
+++ b/scripts/context/lua/mtxrun.lua
@@ -434,7 +434,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-lpeg"] = package.loaded["l-lpeg"] or true
--- original size: 29071, stripped down to: 15964
+-- original size: 29245, stripped down to: 15964
if not modules then modules={} end modules ['l-lpeg']={
version=1.001,
@@ -16546,8 +16546,8 @@ end -- of closure
-- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 679359
--- stripped bytes : 240332
+-- original bytes : 679533
+-- stripped bytes : 240506
-- end library merge
diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua
index 682425a23..0ddb7f65c 100644
--- a/scripts/context/stubs/mswin/mtxrun.lua
+++ b/scripts/context/stubs/mswin/mtxrun.lua
@@ -434,7 +434,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-lpeg"] = package.loaded["l-lpeg"] or true
--- original size: 29071, stripped down to: 15964
+-- original size: 29245, stripped down to: 15964
if not modules then modules={} end modules ['l-lpeg']={
version=1.001,
@@ -16546,8 +16546,8 @@ end -- of closure
-- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 679359
--- stripped bytes : 240332
+-- original bytes : 679533
+-- stripped bytes : 240506
-- end library merge
diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun
index 682425a23..0ddb7f65c 100644
--- a/scripts/context/stubs/unix/mtxrun
+++ b/scripts/context/stubs/unix/mtxrun
@@ -434,7 +434,7 @@ do -- create closure to overcome 200 locals limit
package.loaded["l-lpeg"] = package.loaded["l-lpeg"] or true
--- original size: 29071, stripped down to: 15964
+-- original size: 29245, stripped down to: 15964
if not modules then modules={} end modules ['l-lpeg']={
version=1.001,
@@ -16546,8 +16546,8 @@ end -- of closure
-- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua
-- skipped libraries : -
--- original bytes : 679359
--- stripped bytes : 240332
+-- original bytes : 679533
+-- stripped bytes : 240506
-- end library merge