correctly handle resolving and whitesace
parent
df48e246a7
commit
93c39b3f28
|
@ -70,11 +70,17 @@ lastfm_set.rule = (['lastfm-set'], r'(\S+)\s+(?:(.*?),(.*)|(\S+))')
|
||||||
|
|
||||||
def now_playing(phenny, input):
|
def now_playing(phenny, input):
|
||||||
nick = input.nick
|
nick = input.nick
|
||||||
user = input.group(2)
|
user = ""
|
||||||
if not user or len(user.strip()) == 0:
|
arg = input.group(2)
|
||||||
user = resolve_username(nick)
|
if not arg or len(arg.strip()) == 0:
|
||||||
if not user:
|
user = resolve_username(nick) # use the sender
|
||||||
user = nick
|
if not user: #nick didnt resolve
|
||||||
|
user = nick
|
||||||
|
else: # use the argument
|
||||||
|
user = resolve_username(arg.strip())
|
||||||
|
if not user: # user didnt resolve
|
||||||
|
user = arg
|
||||||
|
user = user.strip()
|
||||||
try:
|
try:
|
||||||
req = urlopen("%smethod=user.getrecenttracks&user=%s" % (APIURL, urlquote(user)))
|
req = urlopen("%smethod=user.getrecenttracks&user=%s" % (APIURL, urlquote(user)))
|
||||||
except HTTPError, e:
|
except HTTPError, e:
|
||||||
|
|
Loading…
Reference in New Issue