Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions thumbfast.lua
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ local function remove_thumbnail_files()
os.remove(options.thumbnail..".bgra")
end

local activity_timer
local activity_timer, run

local function spawn(time)
if disabled then return end
Expand All @@ -451,7 +451,23 @@ local function spawn(time)
local open_filename = properties["stream-open-filename"]
local ytdl = open_filename and properties["demuxer-via-network"] and path ~= open_filename
if ytdl then
path = open_filename
path = ""
local edl = open_filename:gsub("\\", "\\\\")
:gsub('"', '\\"'):gsub("\n", "\\n")
:gsub("\r", "\\r"):gsub("\t", "\\t")
local loadfile_timer
loadfile_timer = mp.add_periodic_timer(file_check_period, function()
local socket
if os_name == "windows" then
socket = io.open("\\\\.\\pipe\\"..options.socket, "r")
else
socket = io.open(options.socket, "r")
end
if not socket then return end
loadfile_timer:kill()
socket:close()
run(string.format('{"command": ["loadfile", "%s"]}', edl))
end)
end

remove_thumbnail_files()
Expand Down Expand Up @@ -555,7 +571,7 @@ local function spawn(time)
)
end

local function run(command)
function run(command)
if not spawned then return end

if options.direct_io then
Expand Down