
 if m_simpleTV.User.Triolan.ScanServer == '1' then
 
 m_simpleTV.User.Triolan.LastServer = nil 

if m_simpleTV.User.Triolan.SvrTable == nil then
    dofile(m_simpleTV.MainScriptDir .. "user/tvplaylists/triolan/triolansvr.lua") 
    if m_simpleTV.User.Triolan.SvrTable == nil then return end 
end

--scan if table empty
if m_simpleTV.User.Triolan.SvrTable[1] == nil then 
    m_simpleTV.User.Triolan.SvrTable = nil
    m_simpleTV.OSD.ShowMessage("Triolan: server not found, need rescan",255,3)
    dofile(m_simpleTV.MainScriptDir .. "user/tvplaylists/triolan/doscan.lua") 
   return
end


local svr = m_simpleTV.User.Triolan.SvrTable[math.random(#m_simpleTV.User.Triolan.SvrTable)]
--debug_in_file(svr .. '\n')

m_simpleTV.User.Triolan.LastServer = 'http://'..svr..'/udp'

elseif m_simpleTV.User.Triolan.ScanServer ~= '1' then

 m_simpleTV.User.Triolan.LastServer = nil 


 local session = m_simpleTV.WinInet.New("Opera/9.80 (Windows NT 6.1; U; ru) Presto/2.9.168 Version/11.52")
 if session == nil then return end

  --INTERNET_OPTION_CONNECT_TIMEOUT
  m_simpleTV.WinInet.SetOptionInt(session,2,8000,0)
  --INTERNET_OPTION_RECEIVE_TIMEOUT
  m_simpleTV.WinInet.SetOptionInt(session,6,8000,0)
-----------------------------------------------
 local url = 'http://www.satorbita.com/iptv/free/novotest90T.php?rand=' .. math.random()
 local rc,answer=m_simpleTV.WinInet.Get(session,url)
 m_simpleTV.WinInet.Close(session)
 if rc~=200 then
	   m_simpleTV.WinInet.Close(session)
	   m_simpleTV.OSD.ShowMessage("Triolan - connection error - " .. rc ,255,10)
	   return
  end
--debug_in_file(answer)

m_simpleTV.User.Triolan.LastServer = string.match(answer,'http.+udp')

end