Merge pull request 'config value for logo' (#3) from devel into master
Reviewed-on: #3
This commit is contained in:
commit
c71de1d95d
@ -57,5 +57,8 @@ conf.registerGlobalValue(Spotify, 'clientID',
|
|||||||
|
|
||||||
conf.registerGlobalValue(Spotify, 'clientSECRET',
|
conf.registerGlobalValue(Spotify, 'clientSECRET',
|
||||||
registry.string('', """ Sets the ClientSECRET obtainable from https://developer.spotify.com/""", private=True))
|
registry.string('', """ Sets the ClientSECRET obtainable from https://developer.spotify.com/""", private=True))
|
||||||
|
conf.registerChannelValue(Spotify, 'Logo',
|
||||||
|
registry.string(' 🎶️ \x02\x0301,03SPOTIFY\x0f 🎶️',"""Formatting prependended to response"""))
|
||||||
|
|
||||||
|
|
||||||
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
|
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
|
||||||
|
12
plugin.py
12
plugin.py
@ -50,7 +50,8 @@ class Spotify(callbacks.Plugin):
|
|||||||
threaded = True
|
threaded = True
|
||||||
|
|
||||||
def sp(self, irc, msg, args, song):
|
def sp(self, irc, msg, args, song):
|
||||||
"""<artist> <song>
|
"""[<artist>] [<song>] [<trackName>]
|
||||||
|
|
||||||
The track details for which the URL/trackID is desired.
|
The track details for which the URL/trackID is desired.
|
||||||
"""
|
"""
|
||||||
clientID = self.registryValue('clientID')
|
clientID = self.registryValue('clientID')
|
||||||
@ -74,13 +75,14 @@ class Spotify(callbacks.Plugin):
|
|||||||
results = spotified.search(song)
|
results = spotified.search(song)
|
||||||
items = results['tracks']['items']
|
items = results['tracks']['items']
|
||||||
if len(items) > 0:
|
if len(items) > 0:
|
||||||
track = items[0]
|
track = items.get(0)
|
||||||
track_uri = track['uri']
|
track_uri = track.get('uri')
|
||||||
track_artist = track['artists'][0]['name']
|
track_artist = track['artists'][0]['name']
|
||||||
track_album = track['album']['name']
|
track_album = track['album']['name']
|
||||||
track_name =track['name']
|
track_name =track.get('name')
|
||||||
track_url = track['external_urls']['spotify']
|
track_url = track['external_urls']['spotify']
|
||||||
re = utils.str.format(' 🎶️ \x02\x0301,03SPOTIFY\x0f 🎶️ %s by %s from %s at %s and uri %s', track_name, track_artist, track_album, track_url, track_uri)
|
logo = self.registryValue('Logo')
|
||||||
|
re = utils.str.format('%s %s by %s from %s at %s and uri %s', logo, track_name, track_artist, track_album, track_url, track_uri)
|
||||||
irc.reply(re)
|
irc.reply(re)
|
||||||
else:
|
else:
|
||||||
irc.error('No Results')
|
irc.error('No Results')
|
||||||
|
Loading…
Reference in New Issue
Block a user