Skip to content

Commit 66c544c

Browse files
committed
fix: duplicate danmaku filename when fallback
1 parent 7ed245a commit 66c544c

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

api.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,8 +491,9 @@ function get_danmaku_fallback(query)
491491

492492
local url = options.fallback_server .. "/?url=" .. query
493493
msg.verbose("尝试获取弹幕:" .. url)
494-
local temp_file = "danmaku-" .. pid .. ".xml"
494+
local temp_file = "danmaku-" .. pid .. danmaku.count .. ".xml"
495495
local danmaku_xml = utils.join_path(danmaku_path, temp_file)
496+
danmaku.count = danmaku.count + 1
496497
local arg = {
497498
"curl",
498499
"-L",

render.lua

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -366,9 +366,7 @@ mp.add_hook("on_unload", 50, function()
366366
local danmaku_path = os.getenv("TEMP") or "/tmp/"
367367
local rm1 = utils.join_path(danmaku_path, "danmaku-" .. pid .. ".json")
368368
local rm2 = utils.join_path(danmaku_path, "danmaku-" .. pid .. ".ass")
369-
local rm3 = utils.join_path(danmaku_path, "danmaku-" .. pid .. ".xml")
370-
local rm4 = utils.join_path(danmaku_path, "temp-" .. pid .. ".mp4")
371-
local rm5 = utils.join_path(danmaku_path, "bahamut-" .. pid .. ".json")
369+
local rm3 = utils.join_path(danmaku_path, "temp-" .. pid .. ".mp4")
372370
if file_exists(rm1) then os.remove(rm1) end
373371
if file_exists(rm2) then
374372
if options.save_danmaku then
@@ -377,8 +375,6 @@ mp.add_hook("on_unload", 50, function()
377375
os.remove(rm2)
378376
end
379377
if file_exists(rm3) then os.remove(rm3) end
380-
if file_exists(rm4) then os.remove(rm4) end
381-
if file_exists(rm5) then os.remove(rm5) end
382378
for _, source in pairs(danmaku.sources) do
383379
if source.fname and source.from and source.from ~= "user_local" and file_exists(source.fname) then
384380
os.remove(source.fname)

0 commit comments

Comments
 (0)