Handle !soundcloud returning no results (soundcloud.py)
This commit is contained in:
parent
38b7a1dadf
commit
93336efd38
1 changed files with 13 additions and 10 deletions
|
@ -48,15 +48,18 @@ class Module(ModuleManager.BaseModule):
|
|||
get_params=get_params, json=True)
|
||||
|
||||
if page:
|
||||
page = page.data[0] if has_query else page
|
||||
title = page["title"]
|
||||
user = page["user"]["username"]
|
||||
duration = time.strftime("%H:%M:%S", time.gmtime(page[
|
||||
"duration"]/1000))
|
||||
if duration.startswith("00:"):
|
||||
duration = duration[3:]
|
||||
link = page["permalink_url"]
|
||||
event["stdout"].write("%s [%s] (posted by %s) %s" % (title,
|
||||
duration, user, link))
|
||||
if len(page.data):
|
||||
page = page.data[0] if has_query else page
|
||||
title = page["title"]
|
||||
user = page["user"]["username"]
|
||||
duration = time.strftime("%H:%M:%S", time.gmtime(page[
|
||||
"duration"]/1000))
|
||||
if duration.startswith("00:"):
|
||||
duration = duration[3:]
|
||||
link = page["permalink_url"]
|
||||
event["stdout"].write("%s [%s] (posted by %s) %s" % (title,
|
||||
duration, user, link))
|
||||
else:
|
||||
event["stderr"].write("No results found")
|
||||
else:
|
||||
raise utils.EventsResultsError()
|
||||
|
|
Loading…
Reference in a new issue