Frage

My fiber internet provider supports IPTV over UDP. They do not however list the channels anywhere.

I have found most of them manually, but would like to have a script that can verify if a channel is active/available.

Any ideas on how to go about this in Python?

War es hilfreich?

Lösung

I think the python code should look like below. Note that don't run it in Python IDLE since ipRange() will hang it.

def ipRange(start_ip, end_ip):
  start = list(map(int, start_ip.split(".")))
  end = list(map(int, end_ip.split(".")))
  temp = start
  ip_range = []

  ip_range.append(start_ip)
  while temp != end:
    start[3] += 1
    for i in (3, 2, 1):
      if temp[i] == 256:
        temp[i] = 0
        temp[i-1] += 1
    ip_range.append(".".join(map(str, temp)))    
  return ip_range

def IPTVSignalTest(ip):
  # do your test here, return true if IPTV signal, false otherwise
  return TRUE

ip_range = ipRange("192.168.1.0", "192.171.3.25")
save_ip = []
for ip in ip_range:
  if IPTVSignalTest(ip):
    save_ip.append(ip)
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top