-- Script for Astra 5.63 and newer -- Save script to /etc/astra/mod/playlist.lua , and restart Astra -- -- Create groups (category and group names for example): -- Open Settings -> Groups -> New Category -- Category Name : Genre -- Group Name : Music -- Press "Add Group" and append other groups Sport, Movie, etc... -- Press "Apply", then press "Streams" -- Select Music and check all channels related to this groups. Then select other group and check related channels -- -- Link for playlist will be next: -- http://your-server:8000/playlist/Genre/Music.m3u8 - all music channels -- http://your-server:8000/playlist/Genre/Sport.m3u8 - all sport channels -- http://your-server:8000/playlist/Genre.m3u8 - all channels function custom_playlist_m3u8(server, client, request) if not request then return nil end local a = request.query.server if not a then a = request.headers["host"] if not a then server:abort(client, 400, "Server address is not defined") return nil end end local q = request.request_uri:sub(#request.path + 1) if http_play_hls then q = "/index.m3u8" .. q end local g = request.path:sub(1, #request.path - 5):sub(11):split("/") local category = g[1] local group = g[2] local content = "#EXTM3U\n" if not group then for k,c in pairs(channel_list_ID) do if c.config.groups and c.config.groups[category] ~= nil then content = content .. "#EXTINF:-1," .. c.config.name .. "\nhttp://" .. a .. "/play/" .. k .. q .. "\n" end end else for k,c in pairs(channel_list_ID) do if c.config.groups and c.config.groups[category] == group then content = content .. "#EXTINF:-1," .. c.config.name .. "\nhttp://" .. a .. "/play/" .. k .. q .. "\n" end end end server:send(client, { code = 200, headers = { "Content-Type: application/x-mpegurl", "Connection: close" }, content = content, }) end control_server_instance:insert("/playlist/*", custom_playlist_m3u8)