Commit ee688f8d authored by Valentin Samir's avatar Valentin Samir

[wiki/macro] Réparation de la macro TV

Elle n'importait pas le bon module tv et plantait.
Du coup, je mets temporairement /usr/scripts en tête du path.
J'en profite aussi pour remplacer la conf hardcodé par celle de
gestion.config.tv.
parent 721681c1
import sys
if '/usr/scripts' not in sys.path:
sys.path.append('/usr/scripts')
import tv.dns
sys.path.insert(0, '/usr/scripts')
try:
import tv.dns
import gestion.config.tv as tv_config
finally:
del sys.path[0]
Dependencies = ["Time"]
SAP_FILE_URL = "http://tv.crans.org/sap.txt"
BASE_IMAGE_URL = "http://tv.crans.org/images/"
IMAGE_SUFFIX = ".jpg"
SMALL_IMAGE_SUFFIX = "_petites.jpg"
SAP_FILE_TXT = tv_config.SAP_FILE_TXT
BASE_IMAGE_URL = tv_config.BASE_IMAGE_URL
IMAGE_SUFFIX = tv_config.IMAGE_SUFFIX
SMALL_IMAGE_SUFFIX = tv_config.SMALL_IMAGE_SUFFIX
def image_url_for_channel(channel_name, channel_ip, small=0 ):
......@@ -21,10 +27,9 @@ def image_url_for_channel(channel_name, channel_ip, small=0 ):
def get_channel_list():
import urllib
# Getsap file from web sever.
f = urllib.urlopen(SAP_FILE_URL)
# Read it.
s = f.read()
f.close()
with open(SAP_FILE_TXT) as f:
# Read it.
s = f.read()
s = s.split("\n")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment