Files
dotfiles/.config/mpv/scripts/japan7.lua
2023-09-28 13:53:07 +02:00

36 lines
1.4 KiB
Lua

local settings = {
username = "",
password = "",
projo_host = ""
}
local opts = require 'mp.options'
opts.read_options(settings, "japan7")
local function is_projo(path)
return path:match("^https://projection")
end
function on_load()
local path = mp.get_property("path")
local match = path:gsub("^https://fubuki.aidoru.agency", "https://"..settings.username..":"..settings.password.."@fubuki.aidoru.agency")
match = match:gsub("^https://korone.aidoru.agency", "https://"..settings.username..":"..settings.password.."@korone.aidoru.agency")
match = match:gsub("^https://yuyuko.butaishoujo.moe", "https://"..settings.username..":"..settings.password.."@yuyuko.butaishoujo.moe")
match = match:gsub("^https://projo.yuru.moe", "https://"..settings.username..":"..settings.password.."@projo.yuru.moe")
match = match:gsub("^https://gungnir.dato.moe", "https://"..settings.username..":"..settings.password.."@gungnir.dato.moe")
match = match:gsub("^https://projection", settings.projo_host)
if match ~= path then
if is_projo(path) then
local stream = match:gsub("^(.+)/.-$", "%1/stream")
mp.set_property("ordered-chapters-files", stream)
end
mp.set_property("stream-open-filename", match)
local ass = match:gsub("...$", "ass")
mp.commandv("sub-add", ass)
end
end
mp.register_event('start-file', on_load)