Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Get Project Data (v0.04)
- -- Edgemeal - Sept, 20, 2019
- -- Donate: paypal.me/Edgemeal
- function GetLastWord(line)
- local lastpos = (line:reverse()):find(' ')
- return (line:sub(-lastpos+1))
- end
- local function RemoveFileExt(file)
- local index = (file:reverse()):find("%.")
- if index > 0 then
- return string.sub(file, 1, #file-index)
- else
- return file
- end
- end
- function AddFX(track,fx_count)
- for fx = 0, fx_count-1 do
- local _, fx_name = reaper.TrackFX_GetFXName(track, fx, "")
- local _, presetname = reaper.TrackFX_GetPreset(track, fx, "")
- local enabled = reaper.TrackFX_GetEnabled(track, fx) -- enabled
- if presetname ~= "" then -- add track fx name and preset name
- t[#t+1] = (enabled and "" or "* ") .. fx_name .. " Preset: " .. presetname
- else
- t[#t+1] = (enabled and "" or "* ") .. fx_name
- end
- end
- end
- function get_line(filename, line_number)
- local i = 0
- for line in io.lines(filename) do
- i = i + 1
- if i == line_number then
- return line
- end
- end
- return nil -- line not found
- end
- function Main()
- local proj, projfn = reaper.EnumProjects(-1, "")
- if projfn ~= "" then
- t[#t+1]="Project: "..reaper.GetProjectName(proj, "")
- t[#t+1]="Path: "..reaper.GetProjectPath("")
- local line = get_line(projfn, 1)-- project time stamp, Unix format, last word in 1st line of project file.
- local unixTS = (GetLastWord(line))
- t[#t+1]='Date: ' ..(os.date("%B %d, %Y %X", tonumber(unixTS))) -- convert to "month day, year time"
- else
- t[#t+1]="Unknown project (not saved)"
- end
- t[#t+1]= "" -- empty line
- -- Master Track
- local track = reaper.GetMasterTrack(0)
- local fx_count = reaper.TrackFX_GetCount(track)
- if fx_count > 0 then
- local tn ="Master Track\n" -- add track name
- t[#t+1]=tn..string.rep('-', #tn-1)
- AddFX(track,fx_count)
- t[#t+1]= "" -- empty line
- end
- -- Regular Tracks
- local track_count = reaper.CountTracks(0)
- for i = 0, track_count-1 do
- local track = reaper.GetTrack(0, i)
- local _, track_name = reaper.GetTrackName(track)
- local tn ='Track '..tostring(i+1)..': '..track_name..'\n' -- add track name
- t[#t+1]=tn..string.rep('-', #tn-1)
- AddFX(track,reaper.TrackFX_GetCount(track))
- t[#t+1]= "" -- empty line
- end
- -- save project data to text file in project folder
- if projfn ~= "" then
- file = io.open(RemoveFileExt(projfn).." - Project Plugins.txt", "w")
- file:write(table.concat(t,"\n"))
- file:close()
- else
- reaper.ShowConsoleMsg(table.concat(t,"\n"))
- end
- end
- t = {} -- store proj data
- Main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement