From bfccb2854f52eb1404a1cb8935dc343ab2ab2a4a Mon Sep 17 00:00:00 2001 From: mutantmonkey Date: Sun, 5 Apr 2015 19:11:52 -0700 Subject: [PATCH] wuvt: add listener count support --- modules/wuvt.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/modules/wuvt.py b/modules/wuvt.py index bc64375..9b38412 100644 --- a/modules/wuvt.py +++ b/modules/wuvt.py @@ -17,9 +17,18 @@ def wuvt(phenny, input): except: raise GrumbleError("Failed to fetch current track from WUVT") - phenny.say("{dj} is currently playing {title} by {artist}".format( - dj=trackinfo['dj'].strip(), - title=trackinfo['title'].strip(), - artist=trackinfo['artist'].strip())) + if 'listeners' in trackinfo: + phenny.say( + "{dj} is currently playing {title} by {artist} with {listeners:d} " + "online listeners".format( + dj=trackinfo['dj'], + title=trackinfo['title'], + artist=trackinfo['artist'], + listeners=trackinfo['listeners'])) + else: + phenny.say("{dj} is currently playing {title} by {artist}".format( + dj=trackinfo['dj'], + title=trackinfo['title'], + artist=trackinfo['artist'])) wuvt.commands = ['wuvt'] wuvt.example = '.wuvt'