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

local inAdr =  m_simpleTV.Control.CurrentAdress

if inAdr==nil then return end

if  string.match( inAdr, '^torrent://' ) then return end

if  string.match( inAdr, '^acestream://' ) then 
   inAdr = 	string.gsub( inAdr, '^acestream://','')
   m_simpleTV.Control.ChangeAdress='Yes'
   m_simpleTV.Control.CurrentAdress = 'torrent://PID=' .. inAdr	
   return 
end

if  string.match( inAdr, '%.acestream$' ) then 
   m_simpleTV.Control.ChangeAdress='Yes'
   m_simpleTV.Control.CurrentAdress = 'torrent://' .. inAdr	
   return 
end

if  string.len(inAdr)==40 and findpattern( inAdr, '(%x+)',1,0,0 )==inAdr then
        m_simpleTV.Control.ChangeAdress='Yes'
		m_simpleTV.Control.CurrentAdress = 'torrent://PID=' .. inAdr
		return
 end  
 
local t = findpattern( inAdr, '(%x+)%$',1,0,1)
if t~=nil and string.len(t)==40 and findpattern( t, '(%x+)',1,0,0 )==t then
        m_simpleTV.Control.ChangeAdress='Yes'
		m_simpleTV.Control.CurrentAdress = 'torrent://PID=' .. inAdr
		return
 end  

 
if  string.match( inAdr, '%.torrent$' ) or string.match( inAdr, '%.torrent%$' )  then 
   m_simpleTV.Control.ChangeAdress='Yes'
   m_simpleTV.Control.CurrentAdress = 'torrent://' .. inAdr
   return 
end


if  string.match( inAdr, '%.acelive$' ) or string.match( inAdr, '%.acelive%$' )  then 
   m_simpleTV.Control.ChangeAdress='Yes'
   m_simpleTV.Control.CurrentAdress = 'torrent://' .. inAdr
   return 
end



