From b4988e7299cda507a4421131059848418dd063eb Mon Sep 17 00:00:00 2001 From: georg Date: Mon, 21 Dec 2020 22:34:20 +0100 Subject: [PATCH] No mor open with, plain fileobject --- radiorec.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/radiorec.py b/radiorec.py index bc1b819..05b4dfd 100755 --- a/radiorec.py +++ b/radiorec.py @@ -124,8 +124,10 @@ def record(args): verboseprint('Seems to be an M3U playlist. Trying to parse...') pool = urllib3.PoolManager() remotefile = pool.request('GET', streamurl) - if not remotefile.data.decode('utf-8').startswith('#') and len(remotefile.data) > 1: - tmpstr = remotefile.data.decode('utf-8') + for line in remotefile.data.decode().split(): + if not line.startswith('#') and len(line) > 1: + tmpstr = line + break streamurl = tmpstr verboseprint(print_time() + " ... Stream URL: " + streamurl)