Index: contrib/radiolist.py ================================================================== --- contrib/radiolist.py +++ contrib/radiolist.py @@ -44,11 +44,11 @@ # · Entries may contain more than one streaming url. Each accompanied by a # bitrate. → Therefore the .best_url() sorting method. # # · Later versions might of course use multi-urls again… # -class radiolist (ChannelPlugin): +class radiolist (ChannelPlugin, action.heuristic_funcs): # module attributes listformat = "pls" has_search = False categories = ["Europe", "America", "Canada", "Oceania", "Asia"] @@ -91,12 +91,12 @@ entries.append(dict( homepage = ut[0][0], title = unhtml(ut[0][1]), url = url, bitrate = br, - format = self.guess_fmt(url), - listformat = self.guess_pls(url), + format = self.mime_guess(url, "audio/mpeg"), + listformat = self.list_guess(url), playing = lg[0], genre = lg[1] )) # done [log.DATA(e) for e in entries] @@ -106,21 +106,6 @@ def best_url(self, urls): r = dict([(u, to_int(b)) for u,b in urls]) # {url: bitrate, …} best = sorted(r, key=r.get, reverse=True) return best[0], r[best[0]] - # see if audio type can be guessed - def guess_fmt(self, url): - ext = re.findall("mp3|ogg|wma|aac|mp4", url) - if ext: - return mime_fmt(ext[0]) - else: - return "audio/mpeg" - - # guess PLS/M3U from url - def guess_pls(self, url): - ext = re.findall("|".join(action.playlist_fmt_prio), url) - if ext: - return ext[0] - else: - return "srv"