From 61d145ce43a514719c23cfa62aacc8a05777ab99 Mon Sep 17 00:00:00 2001 From: Pecusx Date: Sun, 8 Jan 2017 15:43:48 +0100 Subject: [PATCH] Change timeout if called from PHP. --- create_m3u.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/create_m3u.py b/create_m3u.py index 1e55dc1..27ae752 100755 --- a/create_m3u.py +++ b/create_m3u.py @@ -455,9 +455,15 @@ for line in open(StationList,'r'): filenumber += 1 continue + # Set timeout depending on the parameter + if deleteOld: + timeo = 1 + else: + timeo = 10 + # Get the published URL to the stream file try: - file = urllib2.urlopen(url) + file = urllib2.urlopen(url, timeout=timeo) data = file.read() file.close() # Creat list from data