Add Lua script to sort tracks by name
This commit is contained in:
parent
3a2b577719
commit
8a78b19e1b
30
scripts/_sort_tracks_by_name.lua
Normal file
30
scripts/_sort_tracks_by_name.lua
Normal file
@ -0,0 +1,30 @@
|
||||
ardour {
|
||||
["type"] = "EditorAction",
|
||||
name = "Track Sort",
|
||||
author = "Ardour Lua Taskforce",
|
||||
description = [[Sort tracks alphabetically by name]]
|
||||
}
|
||||
|
||||
function factory () return function ()
|
||||
|
||||
function tsort (a, b)
|
||||
return a:name() < b:name()
|
||||
end
|
||||
|
||||
local tracklist = {}
|
||||
for t in Session:get_tracks():iter() do
|
||||
table.insert(tracklist, t)
|
||||
print (t:name(), t:presentation_info_ptr():order())
|
||||
end
|
||||
|
||||
table.sort(tracklist, tsort)
|
||||
|
||||
local pos = 1;
|
||||
for _, t in ipairs(tracklist) do
|
||||
t:set_presentation_order(pos)
|
||||
pos = pos + 1
|
||||
end
|
||||
|
||||
tracklist = nil
|
||||
collectgarbage ()
|
||||
end end
|
Loading…
Reference in New Issue
Block a user