From 62466723d5cef86ebc3a8637b8822f4308f0fa86 Mon Sep 17 00:00:00 2001 From: Casey Link Date: Sat, 5 Feb 2011 13:30:32 -0500 Subject: [PATCH] add support for single user taste comparisons --- modules/lastfm.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/lastfm.py b/modules/lastfm.py index e33ca8f..46156bd 100644 --- a/modules/lastfm.py +++ b/modules/lastfm.py @@ -130,6 +130,8 @@ def tasteometer(phenny, input): user2 = resolve_username(input2) if not user2: user2 = input2 + if not user2 or len(user2) == 0: + user2 = input.nick try: req = urlopen("%smethod=tasteometer.compare&type1=user&type2=user&value1=%s&value2=%s" % (APIURL, urlquote(user1), urlquote(user2))) except HTTPError, e: @@ -172,7 +174,7 @@ def tasteometer(phenny, input): phenny.say("%s's and %s's musical compatibility rating is %s %s" % (user1, user2, rating, common_artists)) -tasteometer.rule = (['taste'], r'(\S+)\s+(\S+)') +tasteometer.rule = (['taste'], r'(\S+)(?:\s+(\S+))?') def save_config(): configfile = open(config_filename, 'wb')