From f52b5dc34de2d444c1bf41132fe90c75515bf20c Mon Sep 17 00:00:00 2001 From: Terry Geng Date: Thu, 6 Feb 2020 10:24:50 +0800 Subject: [PATCH] beautified radio display, and refresh playlist once web interface is loaded --- mumbleBot.py | 12 ++++++++---- templates/index.html | 4 +++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/mumbleBot.py b/mumbleBot.py index a3ede1f..48089e8 100644 --- a/mumbleBot.py +++ b/mumbleBot.py @@ -458,6 +458,8 @@ class MumbleBot: if url != "-1": logging.info('bot: Found url: ' + url) music = {'type': 'radio', + 'title': stationname, + 'artist': homepage, 'url': url, 'user': user} var.playlist.append(music) @@ -687,12 +689,14 @@ class MumbleBot: elif music["type"] == "radio": uri = music["url"] - logging.info("bot: fetching radio server description") - title = media.radio.get_radio_server_description(uri) - music["title"] = title + if 'title' not in music: + logging.info("bot: fetching radio server description") + title = media.radio.get_radio_server_description(uri) + music["title"] = title + if var.config.getboolean('bot', 'announce_current_music'): self.send_msg(var.config.get('strings', 'now_playing') % - (title, "URL : " + uri)) + (music["title"], "URL: " + uri)) if var.config.getboolean('debug', 'ffmpeg'): ffmpeg_debug = "debug" diff --git a/templates/index.html b/templates/index.html index d73257d..b064158 100644 --- a/templates/index.html +++ b/templates/index.html @@ -152,7 +152,7 @@ - Play list is empty. + Fetching playlist .... @@ -344,6 +344,8 @@ }); } , 3000); + $(document).ready(updatePlaylist); +