From 145e3f9c32f82666381aa91fd7597983ecbaa640 Mon Sep 17 00:00:00 2001 From: Azlux Date: Sun, 16 Jun 2019 00:12:04 +0200 Subject: [PATCH] feature #51 Radio list and comments --- configuration.default.ini | 9 +++++---- mumbleBot.py | 27 +++++++++++++++++++-------- pymumble | 2 +- 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/configuration.default.ini b/configuration.default.ini index 54af800..87bd2b7 100644 --- a/configuration.default.ini +++ b/configuration.default.ini @@ -72,11 +72,11 @@ url_unban = urlunban reload = reload [radio] -ponyville = http://192.99.131.205:8000/stream.mp3 -luna = http://radio.ponyvillelive.com:8002/stream -radiobrony = http://62.210.138.34:8000/live +ponyville = http://192.99.131.205:8000/stream.mp3 "Here a command of !radio comment" +luna = http://radio.ponyvillelive.com:8002/stream "calm and orchestra music" +radiobrony = http://62.210.138.34:8000/live "Borny music of a friend" celestiaradio = http://celestia.aiverse.org:8000/mp3_256 -jazz = http://jazz-wr04.ice.infomaniak.ch/jazz-wr04-128.mp3 +jazz = http://jazz-wr04.ice.infomaniak.ch/jazz-wr04-128.mp3 "Jazz Yeah !" [strings] current_volume = volume : %d%% @@ -87,6 +87,7 @@ not_playing = No music right now bad_file = Bad file requested no_file = File not found bad_url = Bad URL requested +preconfigurated_radio = Preconfigurated Radio available unable_download = Error while downloading the music... multiple_matches = Track not found! Possible candidates: queue_contents = The next items in the queue are: diff --git a/mumbleBot.py b/mumbleBot.py index 1aece0b..378687b 100644 --- a/mumbleBot.py +++ b/mumbleBot.py @@ -307,14 +307,25 @@ class MumbleBot: if media.playlist.get_playlist_info(url=self.get_url_from_input(parameter), start_index=offset, user=user): self.async_download_next() - elif command == var.config.get('command', 'play_radio') and parameter: - if var.config.has_option('radio', parameter): - parameter = var.config.get('radio', parameter) - music = {'type': 'radio', - 'url': self.get_url_from_input(parameter), - 'user': user} - var.playlist.append(music) - self.async_download_next() + elif command == var.config.get('command', 'play_radio'): + if not parameter: + all_radio = var.config.items('radio') + msg = var.config.get('strings', 'preconfigurated_radio') + " :
" + for i in all_radio: + comment = "" + if len(i[1].split(maxsplit=1)) == 2: + comment = " - " + i[1].split(maxsplit=1)[1] + msg += "
" + i[0] + comment + self.send_msg(msg) + else: + if var.config.has_option('radio', parameter): + parameter = var.config.get('radio', parameter) + parameter = parameter.split()[0] + music = {'type': 'radio', + 'url': self.get_url_from_input(parameter), + 'user': user} + var.playlist.append(music) + self.async_download_next() elif command == var.config.get('command', 'help'): self.send_msg(var.config.get('strings', 'help'), text) diff --git a/pymumble b/pymumble index 95945ca..437d2eb 160000 --- a/pymumble +++ b/pymumble @@ -1 +1 @@ -Subproject commit 95945caf51b67919477d088b5d339087bb4397c5 +Subproject commit 437d2ebec6e18b5ad69b77020596c250a5e1b785