Get Recording Path Without Folder Monitoring

Solace-9024

New Member
Is there a way to get the full path of a recording without monitoring a folder for a new file to be created? I know for replays there is an API exposure for get_latest_replay() is there something like this for recordings though?
 

khaver

Member
I don't believe there is. You can get it from the basic.ini file in the profiles folder. I have a Lua script that retrieves the file path from it.

Here's part of the code that does this for my portable OBS installation on Windows:
Lua:
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
 
Top