def get_radio_source(url): LOG.fprint(url) if url: if url.lower().endswith(".pls"): source_url = getStationPath(url) if source_url: logging.info("Radio url " + source_url) return source_url elif url.lower().endswith(".m3u"): content = get_content(url) if not content: return None for line in content.rsplit(): if line.startswith("http://") and is_valid_station(line): logging.info("Radio url " + line) return line logging.info("Radio url " + url) return url