--script zabava.ru (04/03/2015)
--http://$zabavasvr.svc.iptv.rt.ru/hls/CH_KTOESTKTO/variant.m3u8?version=2

if m_simpleTV.Control.ChangeAdress ~= 'No' then return end

local inAdr =  m_simpleTV.Control.CurrentAdress
if inAdr==nil then return end

if not  string.match( inAdr, '%$zabavasvr' ) then return end

m_simpleTV.Control.ChangeAdress='Yes'
m_simpleTV.Control.CurrentAdress = ''

local t ={'hlsstr01','hlsstr02','hlsstr03','hlsstr04'}

local tt={}
local j=1
local retAdr

for i, v in ipairs(t) do 
         tt[i] = {}
         tt[i].Id   =  i
         tt[i].Name = 'Server ' .. i
         tt[i].Adress  = string.gsub(inAdr,'%$zabavasvr', v)
--debug_in_file(tt[i].Name .. '  ' .. tt[i].Adress .. '\n')
j=j+1
end

 if j>2 then
    m_simpleTV.OSD.ShowSelect('Shoose Server',0,tt,10000,32)
 end

if j>1 then
   retAdr = tt[1].Adress
end

if retAdr == nil then return end

m_simpleTV.Control.CurrentAdress = retAdr

