1
0
mirror of https://github.com/DigitalDevices/octonet.git synced 2023-10-10 11:36:52 +00:00

channelscan: doscan (WIP)

NIT scan added, adapted to revised octoscan cli interface

Manual usage:
	/var/channels/doscan.lua <key>
This commit is contained in:
mvoelkel 2016-01-09 19:57:54 +01:00
parent edffd6e172
commit 175f58aaa5

View File

@ -67,19 +67,39 @@ if tl.SourceList then
for _,Source in ipairs(tl.SourceList) do for _,Source in ipairs(tl.SourceList) do
print(Source.Title) print(Source.Title)
if key == Source.Key then if key == Source.Key then
local req = "" local SourceOptions = ""
if Source.DVBType == "S" then if Source.UseNIT then
req = 'src=1&' SourceOptions = SourceOptions.."--use_nit "
end end
if Source.DVBType == "S" then
SourceOptions = '--src=1'
end
for _,Transponder in ipairs(Source.TransponderList) do for _,Transponder in ipairs(Source.TransponderList) do
Count = Count + 1 Count = Count + 1
if Count > Max then if Count > Max then
break break
end end
local Params = ""
local p,v
for p,v in Transponder.Request:gmatch("(%a+)=([%w%.]+)") do
if p == "freq" then
Params = Params .. " --freq="..v
elseif p == "pol" then
Params = Params .. " --pol="..v
elseif p == "msys" then
Params = Params .. " --msys="..v
elseif p == "sr" then
Params = Params .. " --sr="..v
elseif p == "mtype" then
Params = Params .. " --mtype="..v
end
end
print("--------------------------------------------------------------") print("--------------------------------------------------------------")
print(Transponder.Request) print('octoscan '..SourceOptions..Params..' '..ipAddr)
local octoscan = io.popen('octoscan '..ipAddr..' "'..req..Transponder.Request..'"',"r") local octoscan = io.popen('octoscan '..SourceOptions..' '..Params..' '..ipAddr,"r")
if octoscan then if octoscan then
while true do while true do
local line = octoscan:read("*l") local line = octoscan:read("*l")
@ -101,7 +121,7 @@ if tl.SourceList then
end end
print(line) print(line)
if line == "END" then if line == "END" then
local channel = { Title=sname, Service=sid, Request = req..Transponder.Request.."&pids=0,"..pids, Tracks=tracks } local channel = { Title=sname, Service=sid, Request = Request.."&pids=0,"..pids, Tracks=tracks }
local cname = pname local cname = pname
if isradio then if isradio then
cname = "Radio - "..pname cname = "Radio - "..pname
@ -132,6 +152,8 @@ if tl.SourceList then
end end
end end
end end
elseif line:sub(1,5) == "TUNE:" then
Request = line:sub(6)
end end
end end
octoscan:close() octoscan:close()