host = "server-address.local" -- Do not change __playlist_cache = nil astra_storage["/playlist.m3u8"] = function(server, client, request) if not request then return nil end if not __playlist_cache then __playlist_cache = "#EXTM3U\r\n" for _,c in ipairs(channel_list) do if c.config.enable and c.config.output then for _,o in ipairs(c.config.output) do local oc = parse_url(o) if oc.format == "http" then __playlist_cache = __playlist_cache .. "#EXTINF:-1," .. c.config.name .. "\r\n" .. "http://" .. host .. oc.path .. "\r\n" end end end end end server:send(client, { code = 200, headers = { "Content-Type: application/x-mpegurl", "Connection: close", }, content = __playlist_cache, }) end