From ce9f83dc96932d79da0d1a5d55e96488d236449c Mon Sep 17 00:00:00 2001 From: georg Date: Fri, 6 Nov 2020 20:23:08 +0100 Subject: [PATCH] fixing m3u Problem --- radiorec.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/radiorec.py b/radiorec.py index 73543cf..bc1b819 100755 --- a/radiorec.py +++ b/radiorec.py @@ -123,11 +123,9 @@ def record(args): if streamurl.endswith('.m3u'): verboseprint('Seems to be an M3U playlist. Trying to parse...') pool = urllib3.PoolManager() - with pool.request('GET',streamurl) as remotefile: - for line in remotefile: - if not line.decode('utf-8').startswith('#') and len(line) > 1: - tmpstr = line.decode('utf-8') - break + remotefile = pool.request('GET', streamurl) + if not remotefile.data.decode('utf-8').startswith('#') and len(remotefile.data) > 1: + tmpstr = remotefile.data.decode('utf-8') streamurl = tmpstr verboseprint(print_time() + " ... Stream URL: " + streamurl)