DEFAULTBASE = nil
OBSDIRECTORY = nil
GLOBALINI = nil
PROFILEDIR = nil
BASICINI = nil
MODE = nil
RECEXT = nil
function read_config(filename)
filename = filename or ''
local ans,u,k,v,temp = {}
if not file_exists(filename) then return ans end
for line in io.lines(filename) do
temp = line:match('^%[(.+)%]$')
if temp ~= nil and u ~= temp then u = temp end
k,v = line:match('^([^=]+)=(.+)$')
if u ~= nil then
ans[u] = ans[u] or {}
if k ~= nil then
ans[u][k] = v
end
end
end
return ans
end
dst = " "
dst = o.os_getcwd(dst, #dst)
local lenth = string.find(dst, "OBS")
OBSDIRECTORY = string.sub(dst, 1, lenth + 2)
GLOBALINI = OBSDIRECTORY .. "\\config\\obs-studio\\global.ini"
local globini = {}
globini = read_config(GLOBALINI)
PROFILEDIR = globini['Basic']['ProfileDir']
BASICINI = OBSDIRECTORY .. "\\config\\obs-studio\\basic\\profiles\\" .. PROFILEDIR .. "\\basic.ini"
local basini = {}
basini = read_config(BASICINI)
MODE = basini['Output']['Mode']
if MODE == "Advanced" then MODE = "AdvOut" else MODE = "SimpleOutput" end
if MODE == "SimpleOutput" then DEFAULTBASE = basini[MODE]['FilePath'] end
if MODE == "AdvOut" then
if basini[MODE]['RecType'] == 'Standard' then
DEFAULTBASE = basini[MODE]['RecFilePath']
else
DEFAULTBASE = basini[MODE]['FFFilePath']
end
end
if basini[MODE]['RecFormat'] then
RECEXT = basini[MODE]['RecFormat']
else RECEXT = "mkv"
end
RECEXT = "." .. RECEXT