Merge branch 'develop' into refresh

This commit is contained in:
Luke Rogers 2013-11-11 09:59:24 +13:00
commit 6e53e8b9bd
3 changed files with 14 additions and 11 deletions

View file

@ -21,7 +21,7 @@ def soundcloud(url, api_key):
url = web.try_isgd(data['permalink_url'])
return u"SoundCloud track: \x02{}\x02 by \x02{}user\x02 {}{}- {} plays, {} downloads, {} comments - {}".format(
return u"SoundCloud track: \x02{}\x02 by \x02{}\x02 {}{}- {} plays, {} downloads, {} comments - {}".format(
data['title'], data['user']['username'], desc, genre, data['playback_count'], data['download_count'],
data['comment_count'], url)

View file

@ -1,19 +1,15 @@
import random
from util import hook, http
from util import hook, http, web
@hook.command
def stock(inp):
""".stock <symbol> -- gets stock information"""
"""stock <symbol> -- gets stock information"""
sym = inp.strip().lower()
url = ('http://query.yahooapis.com/v1/public/yql?format=json&'
'env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys')
parsed = http.get_json(url, q='select * from yahoo.finance.quote '
'where symbol in ("%s")' % inp) # heh, SQLI
quote = parsed['query']['results']['quote']
query = "SELECT * FROM yahoo.finance.quote WHERE symbol=@symbol LIMIT 1"
quote = web.query(query, {"symbol": sym}).one()
# if we dont get a company name back, the symbol doesn't match a company
if quote['Change'] is None: