Added Spotify search command.
This commit is contained in:
parent
9d2140d8b8
commit
bbdfb23e16
2 changed files with 15 additions and 2 deletions
|
@ -9,6 +9,7 @@ A starship ride has been promised to you by the galactic wizard.
|
||||||
That wasn’t chicken.
|
That wasn’t chicken.
|
||||||
You will become a hermit and be sad and lonely for the rest of your life.
|
You will become a hermit and be sad and lonely for the rest of your life.
|
||||||
Don’t fry bacon in the nude.
|
Don’t fry bacon in the nude.
|
||||||
|
The road to riches is paved with homework.
|
||||||
Take calculated risks. That is quite different from being rash.
|
Take calculated risks. That is quite different from being rash.
|
||||||
DO THE IMPOSSIBLE, SEE THE INVISIBLE.
|
DO THE IMPOSSIBLE, SEE THE INVISIBLE.
|
||||||
You cannot plough a field by turning it over in your mind. Unless you have telekinesis.
|
You cannot plough a field by turning it over in your mind. Unless you have telekinesis.
|
||||||
|
@ -17,12 +18,13 @@ Never lose the ability to find beauty in ordinary things.
|
||||||
Ignore previous fortune.
|
Ignore previous fortune.
|
||||||
Smile more.
|
Smile more.
|
||||||
YOU'RE THE BEST AROUND, NOTHIN'S GONNA EVER KEEP YA DOWN.
|
YOU'RE THE BEST AROUND, NOTHIN'S GONNA EVER KEEP YA DOWN.
|
||||||
The cake is a lie.
|
The cake is not a lie.
|
||||||
Never take life seriously. Nobody gets out alive anyway.
|
Never take life seriously. Nobody gets out alive anyway.
|
||||||
Friendship is like peeing on yourself: everyone can see it, but only you get the warm feeling that it brings.
|
Friendship is like peeing on yourself: everyone can see it, but only you get the warm feeling that it brings.
|
||||||
Never go to a doctor whose office plants have died.
|
Never go to a doctor whose office plants have died.
|
||||||
Always remember you're unique, just like everyone else.
|
Always remember you're unique, just like everyone else.
|
||||||
What if everything is an illusion and nothing exists? In that case, I definitely overpaid for my carpet.
|
What if everything is an illusion and nothing exists? (In that case, I definitely overpaid for my carpet)
|
||||||
|
Don’t be discouraged, because every wrong attempt discarded is another step forward.
|
||||||
Even if you are on the right track, you will get run over if you just sit there.
|
Even if you are on the right track, you will get run over if you just sit there.
|
||||||
Think like a man of action, and act like a man of thought.
|
Think like a man of action, and act like a man of thought.
|
||||||
When in doubt, lubricate.
|
When in doubt, lubricate.
|
||||||
|
@ -36,6 +38,7 @@ You will die, but become reanimated as a Zombie, and forever roam the earth in s
|
||||||
This message will self destruct in 10 seconds.
|
This message will self destruct in 10 seconds.
|
||||||
You will live a normal life, with a normal home, a normal job, and a normal future.
|
You will live a normal life, with a normal home, a normal job, and a normal future.
|
||||||
You'll never know what you can do until you try.
|
You'll never know what you can do until you try.
|
||||||
|
A person of words and not deeds is like a garden full of weeds.
|
||||||
You are talented in many ways
|
You are talented in many ways
|
||||||
Be both a speaker of words and a doer of deeds.
|
Be both a speaker of words and a doer of deeds.
|
||||||
A visit to a strange place will bring you renewed perspective.
|
A visit to a strange place will bring you renewed perspective.
|
||||||
|
@ -49,5 +52,6 @@ You can expect a change for the better in job or status in the future.
|
||||||
As the wallet grows, so do the needs.
|
As the wallet grows, so do the needs.
|
||||||
You have a reputation for being straightforward and honest.
|
You have a reputation for being straightforward and honest.
|
||||||
Learn a new language and get a new soul.
|
Learn a new language and get a new soul.
|
||||||
|
A dubious friend may be an enemy in camouflage.
|
||||||
A tall dark stranger will soon enter our life.
|
A tall dark stranger will soon enter our life.
|
||||||
Keep staring. I'll do a trick.
|
Keep staring. I'll do a trick.
|
||||||
|
|
|
@ -9,6 +9,15 @@ spotify_re = (r'(spotify:(track|album|artist|user):([a-zA-Z0-9]+))', re.I)
|
||||||
http_re = (r'(open\.spotify\.com\/(track|album|artist|user)\/'
|
http_re = (r'(open\.spotify\.com\/(track|album|artist|user)\/'
|
||||||
'([a-zA-Z0-9]+))', re.I)
|
'([a-zA-Z0-9]+))', re.I)
|
||||||
|
|
||||||
|
@hook.command
|
||||||
|
def spotify(inp):
|
||||||
|
"spotify <song> -- Search Spotify for <song>"
|
||||||
|
data = spotimeta.search_track(inp.strip())
|
||||||
|
type, id = data["result"][0]["href"].split(":")[1:]
|
||||||
|
url = gateway.format(type, id)
|
||||||
|
return u"{} by {} - {}".format(data["result"][0]["name"], data["result"][0]["artist"]["name"], url)
|
||||||
|
|
||||||
|
|
||||||
@hook.regex(*http_re)
|
@hook.regex(*http_re)
|
||||||
@hook.regex(*spotify_re)
|
@hook.regex(*spotify_re)
|
||||||
def spotify_url(match):
|
def spotify_url(match):
|
||||||
|
|
Reference in a new issue